From c03b014400e8a7abdb3e99c09823d112e69d858e Mon Sep 17 00:00:00 2001 From: Dan Meliza Date: Tue, 16 Jan 2024 11:42:54 -0500 Subject: [PATCH] add __all__ to some modules to more clearly define the public API; bump version --- README.rst | 4 ++-- nbank/__init__.py | 3 +-- nbank/archive.py | 10 ++++++++++ nbank/core.py | 12 ++++++++++++ nbank/registry.py | 27 +++++++++++++++++++++++++++ nbank/util.py | 13 ++++++++++--- 6 files changed, 62 insertions(+), 7 deletions(-) diff --git a/README.rst b/README.rst index 3c5aa75..ec5bff8 100644 --- a/README.rst +++ b/README.rst @@ -9,8 +9,8 @@ neurobank .. |Version| image:: https://img.shields.io/pypi/v/neurobank.svg .. _Version: https://pypi.python.org/pypi/neurobank/ -.. |BuildStatus| image:: https://github.com/melizalab/neurobank/actions/workflows/tests-python.yml/badge.svg -.. _BuildStatus: https://github.com/melizalab/neurobank/actions/workflows/tests-python.yml +.. |BuildStatus| image:: https://github.com/melizalab/neurobank/actions/workflows/python_tests.yml/badge.svg +.. _BuildStatus: https://github.com/melizalab/neurobank/actions/workflows/python_tests.yml .. |License| image:: https://img.shields.io/pypi/l/neurobank.svg .. _License: https://opensource.org/license/bsd-3-clause/ diff --git a/nbank/__init__.py b/nbank/__init__.py index 3a7ea3b..d13a0e4 100644 --- a/nbank/__init__.py +++ b/nbank/__init__.py @@ -3,8 +3,7 @@ Copyright (C) 2013--2023 Dan Meliza """ - -__version__ = "0.10.8" +__version__ = "0.10.9" # Variables: diff --git a/nbank/archive.py b/nbank/archive.py index b8025ea..1ff48d2 100644 --- a/nbank/archive.py +++ b/nbank/archive.py @@ -284,3 +284,13 @@ def fix(p: Path) -> None: log.warning("unable to change uid/gid or permissions of %s", p) return fix + + +__all__ = [ + "get_config", + "create", + "id_stub", + "resolve_extension", + "check_permissions", + "store_resource", +] diff --git a/nbank/core.py b/nbank/core.py index 0ea0eb6..579d2ea 100644 --- a/nbank/core.py +++ b/nbank/core.py @@ -261,5 +261,17 @@ def update( yield r.json() +__all__ = [ + "deposit", + "search", + "describe", + "describe_many", + "find", + "get", + "verify", + "fetch", + "update", +] + # Variables: # End: diff --git a/nbank/registry.py b/nbank/registry.py index f0a6e1e..abace54 100644 --- a/nbank/registry.py +++ b/nbank/registry.py @@ -169,3 +169,30 @@ def log_error(err): log.error(" registry error: %s", err.response.reason) else: raise err + + +def local_schemes() -> Tuple[str]: + return _local_schemes + + +__all__ = [ + "default_registry", + "parse_resource_url", + "full_url", + "get_info", + "get_datatypes", + "get_archives", + "find_archive_by_path", + "find_resource", + "get_resource", + "get_resource_bulk", + "fetch_resource", + "get_locations", + "get_locations_bulk", + "add_datatype", + "add_archive", + "add_resource", + "update_resource_metadata", + "log_error", + "local_schemes", +] diff --git a/nbank/util.py b/nbank/util.py index 6bbc264..9badf51 100644 --- a/nbank/util.py +++ b/nbank/util.py @@ -63,9 +63,7 @@ def hash_directory(path: Union[Path, str], method: str = "sha1") -> str: hashes = [] for fn in sorted(p.rglob("*")): with open(fn, "rb") as fp: - hashes.append( - f"{fn}={hashlib.new(method, fp.read()).hexdigest()}" - ) + hashes.append(f"{fn}={hashlib.new(method, fp.read()).hexdigest()}") return hashlib.new(method, "\n".join(hashes).encode("utf-8")).hexdigest() @@ -176,3 +174,12 @@ def query_registry_bulk( r.raise_for_status() for line in r.iter_lines(): yield json.loads(line) + + +__all__ = [ + "parse_location", + "query_registry", + "query_registry_bulk", + "query_registry_paginated", + "download_to_file", +]