7
7
from . import _utils as ut
8
8
9
9
10
- def local_registry (cache : Optional [str ], url : str ) -> str :
10
+ def _local_registry (cache : Optional [str ], url : str ) -> str :
11
11
if cache is None :
12
12
import appdirs
13
13
cache = appdirs .user_data_dir ("gobbler" , "aaron" )
14
14
return os .path .join (cache , urllib .parse .quote_plus (url ))
15
15
16
16
17
- def acquire_file (cache : str , path : str , name : str , url : str , overwrite : bool ) -> str :
17
+ def _acquire_file (cache : str , path : str , name : str , url : str , overwrite : bool ) -> str :
18
18
target = os .path .join (cache , "REGISTRY" , path , name )
19
19
20
20
if overwrite or not os .path .exists (target ):
@@ -79,7 +79,7 @@ def fetch_directory(path: str, registry: str, url: str, cache: Optional[str] = N
79
79
if not force_remote and os .path .exists (registry ):
80
80
return os .path .join (registry , path )
81
81
82
- cache = local_registry (cache , url )
82
+ cache = _local_registry (cache , url )
83
83
final = os .path .join (cache , "REGISTRY" , path )
84
84
ok = os .path .join (cache , "SUCCESS" , path , "....OK" )
85
85
if not overwrite and os .path .exists (ok ) and os .path .exists (final ):
@@ -92,12 +92,12 @@ def fetch_directory(path: str, registry: str, url: str, cache: Optional[str] = N
92
92
93
93
if concurrent == 1 :
94
94
for y in listing :
95
- acquire_file (cache , name = y , path = path , url = url , overwrite = overwrite )
95
+ _acquire_file (cache , name = y , path = path , url = url , overwrite = overwrite )
96
96
else :
97
97
import multiprocessing
98
98
import functools
99
99
with multiprocessing .Pool (concurrent ) as p :
100
- p .map (functools .partial (acquire_file , cache , path , url = url , overwrite = overwrite ), listing )
100
+ p .map (functools .partial (_acquire_file , cache , path , url = url , overwrite = overwrite ), listing )
101
101
102
102
# We use a directory-level OK file to avoid having to scan through all
103
103
# the directory contents to indicate that it's complete.
0 commit comments