Fix pynwb.validate() for Zarr-backed NWB files#2187
Open
h-mayorquin wants to merge 1 commit into
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #2187 +/- ##
==========================================
+ Coverage 95.18% 95.19% +0.01%
==========================================
Files 30 30
Lines 2991 2999 +8
Branches 444 445 +1
==========================================
+ Hits 2847 2855 +8
Misses 86 86
Partials 58 58
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I encounter this while working on the inspector NeurodataWithoutBorders/nwbinspector#699
Closes #2131 and #2119.
Calling
pynwb.validate()on a Zarr file raisedTypeError: ZarrIO.load_namespaces: unrecognized argument: 'driver', unrecognized argument: 'aws_region'because the validator resolved the backend via_get_backendand then unconditionally forwarded HDF5 (Hierarchical Data Format 5) kwargs (driver,aws_region,load_namespaces) into whichever backend it returned, includingNWBZarrIO.The fix follows, to the best of my understanding, @oruebel recommendation here in hdmf-dev/hdmf-zarr#302: rather than scatter backend dispatch across the validator, concentrate backend-specific construction in a single
_open_backend_iohelper that translates kwargs per backend, and switch namespace loading toHDMFIO.load_namespaces_ioon the open IO. This leverages @rly's instance-method API added in hdmf-dev/hdmf#1299 which replaces the classmethod call that required reaching into the privateio._fileattribute, so the long-standing TODO from #2119 is retired as part of the same change.storage_optionsis added to the publicvalidate()API so Zarr users can pass fsspec (filesystem spec) config through.Checklist
ruff check . && codespellfrom the source directory.