Repository navigation
Tell what an asset is with is_nwb, is_bids and is_ome_zarr - #2009
Draft
CodyCBakerPhD wants to merge 3 commits into
Draft
CodyCBakerPhD wants to merge 3 commits into
CodyCBakerPhD wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## claude/zarr-depth-chunk-keys #2009 +/- ##
================================================================
+ Coverage 91.36% 91.38% +0.01%
================================================================
Files 99 99
Lines 15919 15954 +35
================================================================
+ Hits 14545 14580 +35
Misses 1374 1374
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
LocalAsset.is_nwb (an NWB file, *.nwb, or *.nwb.zarr when stored as Zarr), LocalAsset.is_bids (part of a BIDS dataset) and ZarrAsset.is_ome_zarr replace the suffix checks, and the isinstance() check on NWBBIDSAsset, scattered over the asset classes. Code can thus ask what an asset is without knowing which of the classes combining storage and format it is an instance of. NWBAsset.get_metadata() and NWBAsset.get_validation_errors() take any LocalAsset as self (calling LocalAsset.get_validation_errors() rather than super()'s), so that other assets which are NWB files, such as ZarrAsset for NWB files stored as Zarr, can use them, as NWBBIDSAsset does. No change in behaviour. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw5ecrJY9QseLyohB4j
CodyCBakerPhD
force-pushed
the
claude/asset-kind-predicates
branch
from
December 4, 2026 16:23
8edb6d4 to
511a4f4
Compare
is_nwb, is_bids and is_ome_zarr are now all properties of LocalAsset, returning False, which the classes knowing better override: NWBAsset (is_nwb), ZarrAsset (is_nwb and is_ome_zarr, by name) and the BIDS classes (is_bids). Any asset can thus be asked any of them, and each answer lives in the class which knows it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DQrzw5ecrJY9QseLyohB4j
…to claude/asset-kind-predicates
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.
A refactoring split out of #1996, with no change in behaviour, so that #1996 can handle NWB files stored as Zarr by asking what an asset is, rather than adding another subclass.
All three are properties of
LocalAsset, false unless a subclass which knows better says otherwise, so any asset can be asked any of them:is_nwb: the asset is an NWB file: anNWBAsset, or aZarrAssetnamed*.nwb.zarr.is_bids: the asset is part of a BIDS dataset: the BIDS classes.is_ome_zarr: the asset is an OME-Zarr: aZarrAssetnamed*.ome.zarr.They replace the suffix checks, and the
isinstance(self, NWBBIDSAsset)check, spread over the asset classes. Code can thus ask what an asset is without knowing which of the classes combining storage and format it is an instance of.NWBAsset.get_metadata()andNWBAsset.get_validation_errors()now take anyLocalAssetasself, so that other assets which are NWB files can call them, asNWBBIDSAssetalready does. #1996'sZarrAssetdoes so for*.nwb.zarr.Stacked on #2008.
Generated by Claude Code