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

WIP: generalize class for opening image #1314

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

matthew-brett
Copy link
Member

Allow FileHolder subclasses to change the ImageOpener class.

I wanted to do this to work with the fsspec file objects.

But - I couldn't see immediately what the right way to do the type checking is

  • I was considering using OpenDef from openers.py, but that is only defined
    if ty.TYPE_CHECKING is True. I'd love some advice!

Allow FileHolder subclasses to change the ImageOpener class.
Copy link

codecov bot commented Mar 29, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.26%. Comparing base (c445edd) to head (251c899).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1314   +/-   ##
=======================================
  Coverage   92.26%   92.26%           
=======================================
  Files          99       99           
  Lines       12472    12473    +1     
  Branches     2566     2566           
=======================================
+ Hits        11507    11508    +1     
  Misses        642      642           
  Partials      323      323           

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

@effigies
Copy link
Member

  • I was considering using OpenDef from openers.py, but that is only defined
    if ty.TYPE_CHECKING is True. I'd love some advice!

We could pull that out of the ty.TYPE_CHECKING block. The main point of putting it in there is that it was only used internally and it didn't seem usable at runtime. If you're also only using it as a type annotation, then it will be available to import into other modules like:

if ty.TYPE_CHECKING:
    from nibabel.openers import OpenerDef

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