-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
topic: ioI/O related issuesI/O related issues
Description
When opening a file with binary mode, typing.BinaryIO is inferred.
This type should have the https://docs.python.org/3/library/io.html#io.BufferedReader.peek method.
It looks like this is known, judging by the TODO on this line in the typing.pyi stub:
Line 509 in bc90043
| # TODO peek? |
(There are also other
TODOs there for BinaryIO - if those should be added, I could of course do those in the same change if that's not a problem.)
A reproducible example:
with open("some-file", 'rb') as f:
f.peek()Running mypy on this results in error: "BinaryIO" has no attribute "peek".
This issue has also been reported earlier in mypy.
I'd be glad to submit a PR for this. Is it as simple as adding peek to BinaryIO in typing.pyi? Or should there also be tests for these changes?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
topic: ioI/O related issuesI/O related issues