Skip to content

Commit 1924477

Browse files
committed
doc: Add docstring for TemplateFlowClient
1 parent a60d926 commit 1924477

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

templateflow/client.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,49 @@
3333

3434

3535
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+
"""
3679
def __init__(
3780
self,
3881
root: os.PathLike[str] | str | None = None,

0 commit comments

Comments
 (0)