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

TYP: Annotate SpatialImage accepting affine=None #1253

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

blakedewey
Copy link
Contributor

This corrects the typing for the SpatialImage __init__ function by allowing None for affine.

This corrects the typing for the `SpatialImage` `__init__` function by allowing `None` for `affine`
@blakedewey blakedewey mentioned this pull request Sep 8, 2023
@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Patch coverage: 100.00% and no project coverage change.

Comparison is base (1843355) 92.16% compared to head (21113e3) 92.16%.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1253   +/-   ##
=======================================
  Coverage   92.16%   92.16%           
=======================================
  Files          98       98           
  Lines       12370    12371    +1     
  Branches     2542     2542           
=======================================
+ Hits        11401    11402    +1     
  Misses        646      646           
  Partials      323      323           
Files Changed Coverage Δ
nibabel/spatialimages.py 94.11% <100.00%> (+0.02%) ⬆️

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

@effigies
Copy link
Member

effigies commented Sep 8, 2023

Reading the mypy failure, I think we need to add an assert self._affine is not None before line 569.

@effigies
Copy link
Member

effigies commented Sep 8, 2023

Looking good. If you pip install this version into your pycharm environment, does it resolve your Nifti1Image(data, None, header) issue?

@effigies effigies changed the title Fix typing in SpatialImage __init__ TYP: Annotate SpatialImage accepting affine=None Sep 8, 2023
@blakedewey
Copy link
Contributor Author

Yes! It does.

@effigies
Copy link
Member

effigies commented Sep 8, 2023

Great! Thanks for reporting and fixing the issue!

@effigies effigies merged commit 5f37398 into nipy:master Sep 8, 2023
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