1919
2020
2121@cache
22- def _have_datalad ():
22+ def _have_datalad () -> bool :
2323 import importlib .util
2424
2525 return importlib .util .find_spec ('datalad' ) is not None
@@ -34,7 +34,7 @@ class CacheConfig:
3434 autoupdate : bool = field (default_factory = env_to_bool ('TEMPLATEFLOW_AUTOUPDATE' , True ))
3535 timeout : int = field (default = 10 )
3636
37- def __post_init__ (self ):
37+ def __post_init__ (self ) -> None :
3838 global STACKLEVEL
3939 if self .use_datalad and not _have_datalad ():
4040 self .use_datalad = False
@@ -46,7 +46,7 @@ def __post_init__(self):
4646class S3Manager :
4747 s3_root : str
4848
49- def install (self , path : Path , overwrite : bool , timeout : int ):
49+ def install (self , path : Path , overwrite : bool , timeout : int ) -> None :
5050 from ._s3 import update
5151
5252 update (path , local = True , overwrite = overwrite , silent = True , timeout = timeout )
@@ -56,7 +56,7 @@ def update(self, path: Path, local: bool, overwrite: bool, silent: bool, timeout
5656
5757 return _update_s3 (path , local = local , overwrite = overwrite , silent = silent , timeout = timeout )
5858
59- def wipe (self , path : Path ):
59+ def wipe (self , path : Path ) -> None :
6060 from shutil import rmtree
6161
6262 def _onerror (func , path , excinfo ):
@@ -72,7 +72,7 @@ def _onerror(func, path, excinfo):
7272class DataladManager :
7373 source : str
7474
75- def install (self , path : Path , overwrite : bool , timeout : int ):
75+ def install (self , path : Path , overwrite : bool , timeout : int ) -> None :
7676 from datalad .api import install
7777
7878 install (path = path , source = self .source , recursive = True )
@@ -91,7 +91,7 @@ def update(self, path: Path, local: bool, overwrite: bool, silent: bool, timeout
9191 return False
9292 return True
9393
94- def wipe (self , path : Path ):
94+ def wipe (self , path : Path ) -> None :
9595 print ('TemplateFlow is configured in DataLad mode, wipe() has no effect' )
9696
9797
@@ -101,7 +101,7 @@ class TemplateFlowCache:
101101 precached : bool = field (init = False )
102102 manager : DataladManager | S3Manager = field (init = False )
103103
104- def __post_init__ (self ):
104+ def __post_init__ (self ) -> None :
105105 self .manager = (
106106 DataladManager (self .config .origin )
107107 if self .config .use_datalad
@@ -133,13 +133,13 @@ def layout(self) -> BIDSLayout:
133133 ),
134134 )
135135
136- def ensure (self ):
136+ def ensure (self ) -> None :
137137 if not self .cached :
138138 self .manager .install (
139139 self .config .root , overwrite = self .config .autoupdate , timeout = self .config .timeout
140140 )
141141
142- def update (self , local : bool = False , overwrite : bool = True , silent : bool = False ):
142+ def update (self , local : bool = False , overwrite : bool = True , silent : bool = False ) -> bool :
143143 if self .manager .update (
144144 self .config .root ,
145145 local = local ,
@@ -151,6 +151,6 @@ def update(self, local: bool = False, overwrite: bool = True, silent: bool = Fal
151151 return True
152152 return False
153153
154- def wipe (self ):
154+ def wipe (self ) -> None :
155155 self .__dict__ .pop ('layout' , None ) # Uncache property
156156 self .manager .wipe (self .config .root )
0 commit comments