Skip to content

TYPE: Annotate file-handling modules #1197

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

Merged
merged 3 commits into from
Feb 19, 2023
Merged

Conversation

effigies
Copy link
Member

This PR annotates the following modules:

  • filename_parser, which covers coercion of os.PathLikes to str, and detecting related files based on extensions
  • fileholders, which allows us to carry around filenames or open streams somewhat agnostically
  • openers, which allows us to read/write from filenames or open streams, and transparently enables compression

@codecov
Copy link

codecov bot commented Feb 14, 2023

Codecov Report

Base: 92.16% // Head: 92.15% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (d13768f) compared to base (cbd7690).
Patch coverage: 91.11% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1197      +/-   ##
==========================================
- Coverage   92.16%   92.15%   -0.01%     
==========================================
  Files          97       97              
  Lines       12332    12334       +2     
  Branches     2534     2534              
==========================================
+ Hits        11366    11367       +1     
  Misses        645      645              
- Partials      321      322       +1     
Impacted Files Coverage Δ
nibabel/openers.py 93.33% <86.20%> (-2.40%) ⬇️
nibabel/dataobj_images.py 85.93% <100.00%> (+0.22%) ⬆️
nibabel/filebasedimages.py 97.31% <100.00%> (-0.06%) ⬇️
nibabel/fileholders.py 93.54% <100.00%> (+0.21%) ⬆️
nibabel/filename_parser.py 94.25% <100.00%> (+2.20%) ⬆️
nibabel/spatialimages.py 94.06% <100.00%> (+0.02%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@effigies effigies force-pushed the type/filehandling branch 2 times, most recently from 6811774 to 1fd1a44 Compare February 14, 2023 20:24
@effigies effigies requested a review from ZviBaratz February 14, 2023 22:40
Opener proxy methods now match io.BufferedIOBase prototypes.

Remove some version checks for indexed-gzip < 0.8, which supported
Python 3.6 while our minimum is now 3.8.

A runtime-checkable protocol for .read()/.write() was the easiest way to
accommodate weird file-likes that aren't IOBases.

When indexed-gzip is typed, we may need to adjust the output of
_gzip_open.
@effigies effigies merged commit b8b57cc into nipy:master Feb 19, 2023
@effigies effigies added this to the 5.1.0 milestone Mar 29, 2023
@effigies effigies deleted the type/filehandling branch August 31, 2023 18:55
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