|
33 | 33 |
|
34 | 34 |
|
35 | 35 | class TemplateFlowClient: |
| 36 | + """TemplateFlow client for querying and retrieving template files. |
| 37 | +
|
| 38 | + If instantiated without arguments, uses the default cache, which is |
| 39 | + located at a platform-dependent location (e.g., ``$HOME/.cache/templateflow`` on |
| 40 | + most Unix-like systems), or at the location specified by the ``TEMPLATEFLOW_HOME`` |
| 41 | + environment variable: |
| 42 | +
|
| 43 | + >>> client = TemplateFlowClient() |
| 44 | + >>> client |
| 45 | + <TemplateFlowClient[...] cache=".../templateflow"> |
| 46 | +
|
| 47 | + To select a custom cache location, provide the ``root`` argument: |
| 48 | +
|
| 49 | + >>> client = TemplateFlowClient(root='/path/to/templateflow_cache') |
| 50 | +
|
| 51 | + Additional configuration options can be provided as keyword arguments. |
| 52 | +
|
| 53 | + Parameters |
| 54 | + ---------- |
| 55 | + root: :class:`os.PathLike` or :class:`str`, optional |
| 56 | + Path to the root of the TemplateFlow cache (will be created if it does not exist). |
| 57 | +
|
| 58 | + Keyword Arguments |
| 59 | + ----------------- |
| 60 | + use_datalad: :class:`bool`, optional |
| 61 | + Whether to use DataLad for managing the cache. Defaults to ``False`` or |
| 62 | + the value of the ``TEMPLATEFLOW_USE_DATALAD`` environment variable |
| 63 | + (1/True/on/yes to enable, 0/False/off/no to disable). |
| 64 | + autoupdate: :class:`bool`, optional |
| 65 | + Whether to automatically update the cache on first load. |
| 66 | + Defaults to ``True`` or the value of the ``TEMPLATEFLOW_AUTOUPDATE`` |
| 67 | + environment variable (1/True/on/yes to enable, 0/False/off/no to disable). |
| 68 | + timeout: :class:`float`, optional |
| 69 | + Timeout in seconds for network operations. Default is ``10.0`` seconds. |
| 70 | + origin: :class:`str`, optional |
| 71 | + Git repository URL for DataLad installations. Default is |
| 72 | + <https://github.com/templateflow/templateflow.git>. |
| 73 | + s3_root: :class:`str`, optional |
| 74 | + Base URL for S3 downloads. Default is <https://templateflow.s3.amazonaws.com>. |
| 75 | + cache: :class:`TemplateFlowCache`, optional |
| 76 | + A pre-configured TemplateFlowCache instance. If provided, `root` and other |
| 77 | + configuration keyword arguments cannot be used. |
| 78 | + """ |
36 | 79 | def __init__( |
37 | 80 | self, |
38 | 81 | root: os.PathLike[str] | str | None = None, |
|
0 commit comments