File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change 2424
2525from __future__ import annotations
2626
27+ import os
2728import sys
2829from json import loads
2930from pathlib import Path
3435
3536
3637class TemplateFlowClient :
37- def __init__ (self , cache = None , config = None ):
38+ def __init__ (
39+ self ,
40+ root : os .PathLike [str ] | str | None = None ,
41+ * ,
42+ cache : TemplateFlowCache | None = None ,
43+ ** config_kwargs ,
44+ ):
3845 if cache is None :
39- if config is None :
40- config = CacheConfig ()
41- cache = TemplateFlowCache (config )
46+ if root :
47+ config_kwargs ['root' ] = root
48+ cache = TemplateFlowCache (CacheConfig (** config_kwargs ))
49+ elif root or config_kwargs :
50+ raise ValueError (
51+ 'If `cache` is provided, `root` and other config kwargs cannot be used.'
52+ )
4253 self .cache = cache
4354
4455 def __getattr__ (self , name : str ):
Original file line number Diff line number Diff line change @@ -124,12 +124,7 @@ def test_s3_400_error(monkeypatch):
124124
125125def test_bad_skeleton (tmp_path , monkeypatch ):
126126 newhome = (tmp_path / 's3-update' ).resolve ()
127- client = templateflow .client .TemplateFlowClient (
128- config = tfc .cache .CacheConfig (
129- root = newhome ,
130- use_datalad = False ,
131- )
132- )
127+ client = templateflow .client .TemplateFlowClient (root = newhome , use_datalad = False )
133128
134129 assert client .cache .layout .root == str (newhome )
135130
You can’t perform that action at this time.
0 commit comments