Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/narrow array name type #2499

Merged
merged 5 commits into from
Nov 22, 2024

Conversation

d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Nov 18, 2024

Remove the possibility that Array.name is None. In situations when Array.name would be None (i.e., when the array is at the root of the store), it will be the empty string ''.

TODO:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/tutorial.rst
  • Changes documented in docs/release.rst
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

@d-v-b
Copy link
Contributor Author

d-v-b commented Nov 18, 2024

this is a breaking change, but I think it falls into the "wart removal" category..

@dcherian
Copy link
Contributor

Can you add an assert a.name is not None here please?

assert isinstance(a, Array)
if a.metadata.zarr_format == 3:
assert a.fill_value is not None
assert isinstance(root[array_path], Array)
assert nparray.shape == a.shape
assert chunks == a.chunks
assert array_path == a.path, (path, name, array_path, a.name, a.path)
assert a.basename == name, (a.basename, name)
assert dict(a.attrs) == expected_attrs

@d-v-b
Copy link
Contributor Author

d-v-b commented Nov 18, 2024

Can you add an assert a.name is not None here please?

assert isinstance(a, Array)
if a.metadata.zarr_format == 3:
assert a.fill_value is not None
assert isinstance(root[array_path], Array)
assert nparray.shape == a.shape
assert chunks == a.chunks
assert array_path == a.path, (path, name, array_path, a.name, a.path)
assert a.basename == name, (a.basename, name)
assert dict(a.attrs) == expected_attrs

done!

Copy link
Contributor

@dcherian dcherian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. No opinions on backcompat

@dcherian dcherian merged commit 76904ea into zarr-developers:main Nov 22, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants