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
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().
I came across #2166, but this looks more like stub definition problems. This case appears to be that peek is really only applicable to a very specific subclass that open() can return to which BinaryIO is not meant to apply, necessarily.
Activity
jnsnow commentedon Feb 22, 2020
I came across #2166, but this looks more like stub definition problems. This case appears to be that
peekis really only applicable to a very specific subclass that open() can return to which BinaryIO is not meant to apply, necessarily.For now, I suppose my workaround is this:
JukkaL commentedon Feb 28, 2020
BinaryIOandopenare defined in typeshed. If you believe that this could be improved, you can file a typeshed issue.