-
-
Notifications
You must be signed in to change notification settings - Fork 358
Prevent creation of arrays/groups under a parent array #3407
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3407 +/- ##
==========================================
+ Coverage 94.70% 94.72% +0.01%
==========================================
Files 79 80 +1
Lines 9532 9548 +16
==========================================
+ Hits 9027 9044 +17
+ Misses 505 504 -1
🚀 New features to boost your workflow:
|
conceptually I don't think we want a right now I think a better location would be |
Thanks @d-v-b - I think the only issue with this is it may introduce a circular import? I could move those functions into |
very good points @K-Meech. Now I do think we should have In fact, we might not need the metadata-saving logic in I suspect all of this could be handled by edit: I mistakenly linked to the zarr-python/src/zarr/core/group.py Line 2985 in c9509ee
|
Thanks @d-v-b - sounds like a good plan. I'll look into removing the dependency on |
Closes #2582
Prevents creation of arrays / groups under a parent array with
.create_array
and.create_group
e.g.root.create_array(name='foo/bar')
(wherefoo
is an existing array)This required changes to the
_save_metadata
function of bothzarr/core/array.py
andzarr/core/group.py
. As both used pretty much identical code, I refactored this into a common function inzarr/core/metadata/io.py
(along with the_build_parents
function both relied upon). Happy to move this elsewhere - if there is a more suitable location for it!I tried to avoid looping over the parents multiple times in
_save_metadata
for the sake of performance (potentially this path could be deeply nested). Hence looping once, and creating two sets of awaitables: one for checking if an array exists at the location + one to actually modify the metadata there. Again, happy to update this if there's a simpler solution.TODO:
docs/user-guide/*.rst
changes/