You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Unfortunately, the IO classes are not in the best shape in typeshed. Our long-term plan is to change arguments requiring IO classes to use protocols. I recommend to do the same in custom code-bases, i.e. write protocols for functions and classes that take IO classes as arguments. See python/typing#564 for more information.
Closing this here. I suggest using protocols in your own code. If GzipFile isn't accepted somewhere in the standard library, where it works, please file a separate bug report, or even better, submit a PR that changes the function in question to use protocols. If someone wants to experiment with deriving GzipFile from IO, I'd be open to review such a PR, but no need to keep the issue open.
I'm not sure if this is a bug in MyPy or the typeshed, however tryngi to use a
gzip.GzipFile
where a file should be produces an error:test.py
Running
mypy test.py
(I ran from/tmp
to ensure no config files were causing problems) gives:The text was updated successfully, but these errors were encountered: