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

Avoid multiple assignments of constant ALLOWED_INPUT_SCHEMAS #280

Merged
merged 1 commit into from
Feb 3, 2025

Conversation

candleindark
Copy link
Member

@candleindark candleindark commented Feb 3, 2025

This PR avoids multiple assignment of the constant ALLOWED_INPUT_SCHEMAS. Incidentally, it improves readability, and ensures ALLOWED_VALIDATION_SCHEMAS is always sorted.

Please, also checkout an alternative to this PR posted below.

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.29%. Comparing base (6fd04fb) to head (c44d1f3).
Report is 2 commits behind head on master.

❗ There is a different number of reports uploaded between BASE (6fd04fb) and HEAD (c44d1f3). Click for more details.

HEAD has 504 uploads less than BASE
Flag BASE (6fd04fb) HEAD (c44d1f3)
unittests 528 24
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #280      +/-   ##
==========================================
- Coverage   97.54%   92.29%   -5.26%     
==========================================
  Files          16       16              
  Lines        1753     1751       -2     
==========================================
- Hits         1710     1616      -94     
- Misses         43      135      +92     
Flag Coverage Δ
unittests 92.29% <100.00%> (-5.26%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +25 to +27
ALLOWED_VALIDATION_SCHEMAS = sorted(
set(ALLOWED_INPUT_SCHEMAS).union(ALLOWED_TARGET_SCHEMAS)
)
Copy link
Member Author

Choose a reason for hiding this comment

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

If set(ALLOWED_TARGET_SCHEMAS) is always a subset of set(ALLOWED_INPUT_SCHEMAS), as it currently is, we can further simplify the definition of ALLOWED_VALIDATION_SCHEMAS to the following.

Suggested change
ALLOWED_VALIDATION_SCHEMAS = sorted(
set(ALLOWED_INPUT_SCHEMAS).union(ALLOWED_TARGET_SCHEMAS)
)
ALLOWED_VALIDATION_SCHEMAS = ALLOWED_INPUT_SCHEMAS

Copy link
Member

Choose a reason for hiding this comment

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

feels like indeed we could have simplified like this, but for now let's just keep as is, may be there would be some time some divergence ;-)

@yarikoptic yarikoptic added the internal Changes only affect the internal API label Feb 3, 2025
@yarikoptic yarikoptic merged commit c300776 into dandi:master Feb 3, 2025
38 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal Changes only affect the internal API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants