- I think this is a bug, but whether it's in mypy or typeshed I do not know.
- I am running with
mypy --strict.
Mypy version: 0.670
I've got a snippet like this:
with open(self.path, "rb") as infile:
if infile.peek(2)[0:2] == b'\x1f\x8b':
...
mypy guesses that this type is BinaryIO, but that it does not have the peek() method. That type is correct with regard to the abstract types of things open() can return, but in this case it's an _io.BufferedReader, which does have peek().