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

FIX: Restore access to private attr Nifti1Extension._content #1378

Merged

Conversation

effigies
Copy link
Member

gh-1336 reused the private attribute ext._content to exclusively refer to the bytes representation of the extension contents. This neglected that subclasses might depend on this implementation detail.

Let's be nice to people and rename the attribute to _raw and provide a _content property that calls self.get_content().

Also adds a test to ensure that multiple accesses continue to work as expected.

@effigies effigies changed the base branch from master to maint/5.3.x October 15, 2024 18:09
@effigies effigies force-pushed the fix/legacy_nifti_extension_content branch from ef6df4e to eb145d5 Compare October 15, 2024 18:09
Copy link

codecov bot commented Oct 15, 2024

Codecov Report

Attention: Patch coverage is 92.30769% with 2 lines in your changes missing coverage. Please review.

Project coverage is 86.45%. Comparing base (1712cb0) to head (e97f572).
Report is 3 commits behind head on maint/5.3.x.

Files with missing lines Patch % Lines
nibabel/tests/test_nifti1.py 88.23% 1 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (1712cb0) and HEAD (e97f572). Click for more details.

HEAD has 27 uploads less than BASE
Flag BASE (1712cb0) HEAD (e97f572)
29 2
Additional details and impacted files
@@               Coverage Diff               @@
##           maint/5.3.x    #1378      +/-   ##
===============================================
- Coverage        95.37%   86.45%   -8.93%     
===============================================
  Files              207      207              
  Lines            29652    29672      +20     
  Branches          3017     3018       +1     
===============================================
- Hits             28282    25654    -2628     
- Misses             933     3587    +2654     
+ Partials           437      431       -6     

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

@effigies
Copy link
Member Author

@bpinsard Thanks for checking that this works as intended. Would you have time for a code review as well?

Copy link
Contributor

@bpinsard bpinsard left a comment

Choose a reason for hiding this comment

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

Not 100% familiar with the intricacies of nifti extension but these changes look good to me. Thanks!

@effigies
Copy link
Member Author

Thanks!

nipygh-1336 reused the private attribute ``ext._content`` to exclusively
refer to the ``bytes`` representation of the extension contents.
This neglected that subclasses might depend on this implementation
detail.

Let's be nice to people and rename the attribute to ``_raw`` and provide
a ``_content`` property that calls ``self.get_content()``.

Also adds a test to ensure that multiple accesses continue to work as
expected.
@effigies effigies force-pushed the fix/legacy_nifti_extension_content branch from eb145d5 to e97f572 Compare October 15, 2024 18:37
@effigies effigies merged commit 6260442 into nipy:maint/5.3.x Oct 15, 2024
6 of 10 checks passed
@effigies effigies deleted the fix/legacy_nifti_extension_content branch October 15, 2024 18:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants