-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make BufferedReader generic over a protocol #13533
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Diff from mypy_primer, showing the effect of this PR on open source code: streamlit (https://github.com/streamlit/streamlit)
- lib/tests/streamlit/elements/audio_test.py:78:38: error: Argument 1 to "_calculate_file_id" has incompatible type "Union[str, Path, bytes, BytesIO, RawIOBase, BufferedReader, Any, None]"; expected "bytes" [arg-type]
+ lib/tests/streamlit/elements/audio_test.py:78:38: error: Argument 1 to "_calculate_file_id" has incompatible type "Union[str, Path, bytes, BytesIO, RawIOBase, BufferedReader[_BufferedReaderStream], Any, None]"; expected "bytes" [arg-type]
werkzeug (https://github.com/pallets/werkzeug)
- tests/test_wsgi.py:158: error: Incompatible types in assignment (expression has type "TextIOWrapper[BufferedReader]", variable has type "LimitedStream") [assignment]
+ tests/test_wsgi.py:158: error: Incompatible types in assignment (expression has type "TextIOWrapper[BufferedReader[LimitedStream]]", variable has type "LimitedStream") [assignment]
+ tests/test_wsgi.py:158: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "LimitedStream" [type-var]
urllib3 (https://github.com/urllib3/urllib3)
+ test/test_response.py:770: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_response.py:770: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var]
+ test/test_response.py:770: note: Error code "type-var" not covered by "type: ignore" comment
+ test/test_response.py:782: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_response.py:782: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var]
+ test/test_response.py:782: note: Error code "type-var" not covered by "type: ignore" comment
+ test/test_response.py:787: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_response.py:787: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var]
+ test/test_response.py:787: note: Error code "type-var" not covered by "type: ignore" comment
+ test/test_response.py:800: error: Unused "type: ignore" comment [unused-ignore]
+ test/test_response.py:800: error: Value of type variable "_BufferedReaderStreamT" of "BufferedReader" cannot be "HTTPResponse" [type-var]
+ test/test_response.py:800: note: Error code "type-var" not covered by "type: ignore" comment
materialize (https://github.com/MaterializeInc/materialize)
- misc/python/materialize/mzbuild.py:828: error: Incompatible types in assignment (expression has type "BufferedRandom", variable has type "BufferedReader") [assignment]
+ misc/python/materialize/mzbuild.py:828: error: Incompatible types in assignment (expression has type "BufferedRandom", variable has type "BufferedReader[_BufferedReaderStream]") [assignment]
|
Looking at the primer hits: Both |
Works towards #13495