Skip to content

Commit

Permalink
add __all__ to some modules to more clearly define the public API; bu…
Browse files Browse the repository at this point in the history
…mp version
  • Loading branch information
dmeliza committed Jan 16, 2024
1 parent d3e375d commit c03b014
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
3 changes: 1 addition & 2 deletions nbank/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
Copyright (C) 2013--2023 Dan Meliza <[email protected]>
"""

__version__ = "0.10.8"
__version__ = "0.10.9"


# Variables:
Expand Down
10 changes: 10 additions & 0 deletions nbank/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
12 changes: 12 additions & 0 deletions nbank/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,5 +261,17 @@ def update(
yield r.json()


__all__ = [
"deposit",
"search",
"describe",
"describe_many",
"find",
"get",
"verify",
"fetch",
"update",
]

# Variables:
# End:
27 changes: 27 additions & 0 deletions nbank/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
]
13 changes: 10 additions & 3 deletions nbank/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down Expand Up @@ -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",
]

0 comments on commit c03b014

Please sign in to comment.