typeshed
typeshed copied to clipboard
Make BufferedWriter generic over a protocol
Closes: #13495.
Diff from mypy_primer, showing the effect of this PR on open source code:
ibis (https://github.com/ibis-project/ibis)
- ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
+ ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter[_BufferedWriterStream]", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:156: error: Value of type variable "_BufferedWriterStreamT" of "BufferedRWPair" cannot be "SocketIO" [type-var]
+ src/urllib3/util/ssltransport.py:156: note: Error code "type-var" not covered by "type: ignore" comment
+ src/urllib3/util/ssltransport.py:161: error: Value of type variable "_BufferedWriterStreamT" of "BufferedWriter" cannot be "SocketIO" [type-var]
Diff from mypy_primer, showing the effect of this PR on open source code:
ibis (https://github.com/ibis-project/ibis)
- ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
+ ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter[_BufferedWriterStream]", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
Diff from mypy_primer, showing the effect of this PR on open source code:
ibis (https://github.com/ibis-project/ibis)
- ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
+ ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter[_BufferedWriterStream]", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
Diff from mypy_primer, showing the effect of this PR on open source code:
zope.interface (https://github.com/zopefoundation/zope.interface)
- src/zope/interface/common/tests/test_io.py:36: error: Argument 1 to "BufferedWriter" has incompatible type "StringIO"; expected "RawIOBase" [arg-type]
+ src/zope/interface/common/tests/test_io.py:36: error: Value of type variable "_BufferedWriterStreamT" of "BufferedWriter" cannot be "StringIO" [type-var]
- src/zope/interface/common/tests/test_io.py:41: error: Argument 2 to "BufferedRWPair" has incompatible type "BytesIO"; expected "RawIOBase" [arg-type]
ibis (https://github.com/ibis-project/ibis)
- ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
+ ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter[_BufferedWriterStream]", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
Diff from mypy_primer, showing the effect of this PR on open source code:
zope.interface (https://github.com/zopefoundation/zope.interface)
- src/zope/interface/common/tests/test_io.py:36: error: Argument 1 to "BufferedWriter" has incompatible type "StringIO"; expected "RawIOBase" [arg-type]
+ src/zope/interface/common/tests/test_io.py:36: error: Value of type variable "_BufferedWriterStreamT" of "BufferedWriter" cannot be "StringIO" [type-var]
- src/zope/interface/common/tests/test_io.py:41: error: Argument 2 to "BufferedRWPair" has incompatible type "BytesIO"; expected "RawIOBase" [arg-type]
ibis (https://github.com/ibis-project/ibis)
- ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter", variable has type "_TemporaryFileWrapper[bytes]") [assignment]
+ ibis/expr/visualize.py:182: error: Incompatible types in assignment (expression has type "BufferedWriter[_BufferedWriterStream]", variable has type "_TemporaryFileWrapper[bytes]") [assignment]