Skip to content

Commit

Permalink
Hide internal functions from the API documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
LTLA committed Apr 24, 2024
1 parent 655e7a3 commit d4044b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/pygobbler/fetch_directory.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
from . import _utils as ut


def local_registry(cache: Optional[str], url: str) -> str:
def _local_registry(cache: Optional[str], url: str) -> str:
if cache is None:
import appdirs
cache = appdirs.user_data_dir("gobbler", "aaron")
return os.path.join(cache, urllib.parse.quote_plus(url))


def acquire_file(cache: str, path: str, name: str, url: str, overwrite: bool) -> str:
def _acquire_file(cache: str, path: str, name: str, url: str, overwrite: bool) -> str:
target = os.path.join(cache, "REGISTRY", path, name)

if overwrite or not os.path.exists(target):
Expand Down Expand Up @@ -79,7 +79,7 @@ def fetch_directory(path: str, registry: str, url: str, cache: Optional[str] = N
if not force_remote and os.path.exists(registry):
return os.path.join(registry, path)

cache = local_registry(cache, url)
cache = _local_registry(cache, url)
final = os.path.join(cache, "REGISTRY", path)
ok = os.path.join(cache, "SUCCESS", path, "....OK")
if not overwrite and os.path.exists(ok) and os.path.exists(final):
Expand All @@ -92,12 +92,12 @@ def fetch_directory(path: str, registry: str, url: str, cache: Optional[str] = N

if concurrent == 1:
for y in listing:
acquire_file(cache, name=y, path=path, url=url, overwrite=overwrite)
_acquire_file(cache, name=y, path=path, url=url, overwrite=overwrite)
else:
import multiprocessing
import functools
with multiprocessing.Pool(concurrent) as p:
p.map(functools.partial(acquire_file, cache, path, url=url, overwrite=overwrite), listing)
p.map(functools.partial(_acquire_file, cache, path, url=url, overwrite=overwrite), listing)

# We use a directory-level OK file to avoid having to scan through all
# the directory contents to indicate that it's complete.
Expand Down
4 changes: 2 additions & 2 deletions src/pygobbler/fetch_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def fetch_manifest(project: str, asset: str, version: str, registry: str, url: s
if not force_remote and os.path.exists(registry):
path = os.path.join(registry, project, asset, version, "..manifest")
else:
cache = fd.local_registry(cache, url)
path = fd.acquire_file(cache, project + "/" + asset + "/" + version, "..manifest", url=url, overwrite=overwrite)
cache = fd._local_registry(cache, url)
path = fd._acquire_file(cache, project + "/" + asset + "/" + version, "..manifest", url=url, overwrite=overwrite)

with open(path, "r") as handle:
out = json.load(handle)
Expand Down
4 changes: 2 additions & 2 deletions src/pygobbler/fetch_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ def fetch_summary(project: str, asset: str, version: str, registry: str, url: st
if not force_remote and os.path.exists(registry):
path = os.path.join(registry, project, asset, version, "..summary")
else:
cache = fd.local_registry(cache, url)
path = fd.acquire_file(cache, project + "/" + asset + "/" + version, "..summary", url=url, overwrite=overwrite)
cache = fd._local_registry(cache, url)
path = fd._acquire_file(cache, project + "/" + asset + "/" + version, "..summary", url=url, overwrite=overwrite)

with open(path, "r") as handle:
out = json.load(handle)
Expand Down

0 comments on commit d4044b9

Please sign in to comment.