-
Notifications
You must be signed in to change notification settings - Fork 54
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
Multiscales metadata API: only support datasets as lists of dictionaries #165
Conversation
Codecov Report
@@ Coverage Diff @@
## master #165 +/- ##
==========================================
+ Coverage 83.53% 83.93% +0.40%
==========================================
Files 12 12
Lines 1354 1357 +3
==========================================
+ Hits 1131 1139 +8
+ Misses 223 218 -5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I missed most of the overarching discussion, but barring one minor comment, lgtm.
if isinstance(dataset, str): | ||
validated_datasets.append({"path": dataset}) | ||
elif isinstance(dataset, dict): | ||
if isinstance(dataset, dict): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might have been simpler as assert isinstance(dataset, dict)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now I'm pondering if there's some generic assertion
or validation
module that one could use to skip for loops where something isn't valid without just throwing a ValueError
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No strong opinion on using assert
vs conditional and a custom error like ValueError
. If we collectively agree on the former version for now, I can quickly go over the codebase after this PR.
My mid-term hope is to replace this internal validation code by a generic validation framework based on schemas/constraints. I expect this should also bring typical features like being able to collect all validation errors like the Validator.iter_errors()
API of the jsonschema
module.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly. No strong opinion on assert isinstance
especially if we'll be reviewing soon anyway.
Follow-up of the discussion in #162, this PR primarily the
write_multiscales_metadata
API introduced in #149 to only work ondatasets
passed as list of dictionaries. The writer unit tests are all adjusted for different version of the OME-NGFF format.Additional unit tests are also added testing various combinations of valid and invalid
coordinateTransformations
. The transformations validation method is updated to add a few extra checks on the presence of mandatory keys.