Experiment: remove bytearray -> bytes promotion
Help gauge the impact of #12657
Diff from mypy_primer, showing the effect of this PR on open source code:
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/adapt.py:78: error: Unsupported operand types for + ("bytes" and "memoryview") [operator]
+ psycopg/psycopg/adapt.py:89: error: Unsupported operand types for + ("bytes" and "memoryview") [operator]
+ psycopg/psycopg/adapt.py:90: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\']") [comparison-overlap]
+ psycopg/psycopg/sql.py:395: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:146: error: Argument 1 to "parse_row" of "Formatter" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:320: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:325: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:423: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:428: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:484: error: Return type "Union[bytes, bytearray, memoryview]" of "write" incompatible with return type "bytes" in supertype "Formatter" [override]
+ psycopg/psycopg/copy.py:497: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:503: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:537: error: Return type "Union[bytes, bytearray, memoryview]" of "write" incompatible with return type "bytes" in supertype "Formatter" [override]
+ psycopg/psycopg/copy.py:554: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:575: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:602: error: Argument 2 to "sub" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/cursor.py:442: error: Argument 2 to "send_query_params" of "PGconn" has incompatible type "Optional[Sequence[Union[bytes, bytearray, memoryview, None]]]"; expected "Optional[Sequence[Optional[bytes]]]" [arg-type]
+ psycopg/psycopg/cursor.py:584: error: Argument 2 to "send_query_prepared" of "PGconn" has incompatible type "Optional[Sequence[Union[bytes, bytearray, memoryview, None]]]"; expected "Optional[Sequence[Optional[bytes]]]" [arg-type]
+ psycopg/psycopg/types/string.py:86: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "Union[bytes, str]") [return-value]
+ psycopg/psycopg/types/string.py:120: error: Unsupported operand types for + ("bytes" and "bytearray") [operator]
+ psycopg/psycopg/types/string.py:120: error: Unsupported operand types for + ("bytes" and "memoryview") [operator]
+ psycopg/psycopg/types/string.py:120: note: Right operand is of type "Union[bytes, bytearray, memoryview]"
+ psycopg/psycopg/types/string.py:126: error: Unsupported operand types for + ("bytes" and "bytearray") [operator]
+ psycopg/psycopg/types/string.py:126: error: Unsupported operand types for + ("bytes" and "memoryview") [operator]
+ psycopg/psycopg/types/string.py:126: note: Right operand is of type "Union[bytes, bytearray, memoryview]"
+ psycopg/psycopg/types/string.py:127: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\000']") [comparison-overlap]
+ psycopg/psycopg/types/string.py:151: error: Incompatible return value type (got "memoryview", expected "bytes") [return-value]
+ psycopg/psycopg/types/string.py:151: error: Argument 1 to "unescape_bytea" of "Escaping" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/string.py:159: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
+ psycopg/psycopg/types/range.py:338: error: Argument 1 to "search" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:339: error: Argument 2 to "sub" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:344: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:349: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:432: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:191: error: Return type "Union[bytes, bytearray, memoryview]" of "dump" incompatible with return type "bytes" in supertype "_IntDumper" [override]
+ psycopg/psycopg/types/numeric.py:216: error: Argument 1 to "int" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "Union[str, bytes, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
+ psycopg/psycopg/types/numeric.py:224: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:232: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:240: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:248: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:254: error: Argument 1 to "float" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "Union[SupportsFloat, SupportsIndex, str, bytes, bytearray]" [arg-type]
+ psycopg/psycopg/types/numeric.py:262: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:270: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:331: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/json.py:158: error: Incompatible types in assignment (expression has type "Callable[[Union[str, bytes], DefaultNamedArg(Optional[Type[JSONDecoder]], 'cls'), DefaultNamedArg(Optional[Callable[[Dict[Any, Any]], Any]], 'object_hook'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_float'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_int'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_constant'), DefaultNamedArg(Optional[Callable[[List[Tuple[Any, Any]]], Any]], 'object_pairs_hook'), KwArg(Any)], Any]", variable has type "Callable[[Union[str, bytes, bytearray]], Any]") [assignment]
+ psycopg/psycopg/types/enum.py:40: error: Unused "type: ignore" comment
+ psycopg/psycopg/types/datetime.py:259: error: Argument 1 to "int" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "Union[str, bytes, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
+ psycopg/psycopg/types/datetime.py:272: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:287: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:314: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:336: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:371: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:431: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:478: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:511: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:577: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:626: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:670: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:46: error: Argument 1 to "search" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:47: error: Argument 2 to "sub" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:49: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:137: error: Argument 1 to "_parse_record" of "BaseCompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:148: error: Argument 1 to "_config_types" of "RecordBinaryLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:153: error: Generator has incompatible item type "Union[bytes, bytearray, memoryview, None]"; expected "Optional[bytes]" [misc]
+ psycopg/psycopg/types/composite.py:154: error: Argument 1 to "_walk_record" of "RecordBinaryLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:182: error: Argument 1 to "_config_types" of "CompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:189: error: Argument 1 to "_parse_record" of "BaseCompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:153: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:157: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:285: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview, Any]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:336: error: Argument 1 to "finditer" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:393: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:400: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/dbapi20.py:71: error: Argument 1 to "dump" of "BytesDumper" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/multirange.py:229: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/multirange.py:250: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ tests/test_sql.py:53: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\']") [comparison-overlap]
+ tests/test_sql.py:55: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\000']") [comparison-overlap]
+ tests/test_sql.py:59: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\\\\\']") [comparison-overlap]
+ tests/test_sql.py:61: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\\\\\000']") [comparison-overlap]
+ tests/types/test_json.py:120: error: Argument 1 to "set_json_loads" has incompatible type "Callable[[Union[str, bytes], DefaultNamedArg(Optional[Type[JSONDecoder]], 'cls'), DefaultNamedArg(Optional[Callable[[Dict[Any, Any]], Any]], 'object_hook'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_float'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_int'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_constant'), DefaultNamedArg(Optional[Callable[[List[Tuple[Any, Any]]], Any]], 'object_pairs_hook'), KwArg(Any)], Any]"; expected "Callable[[Union[str, bytes, bytearray]], Any]" [arg-type]
+ tests/pq/test_escaping.py:32: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:71: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:110: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:127: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:153: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:174: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ psycopg/psycopg/types/hstore.py:73: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
anyio (https://github.com/agronholm/anyio)
+ src/anyio/_core/_sockets.py:417: error: Incompatible types in assignment (expression has type "Union[bytearray, bytes]", variable has type "bytes") [assignment]
- src/anyio/_backends/_asyncio.py:1571: error: Unused "type: ignore" comment
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:86: error: Incompatible return value type (got "bytearray", expected "bytes")
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:934: error: Item "memoryview" of "Union[bytes, memoryview]" has no attribute "split" [union-attr]
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, memoryview]"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
- aioredis/client.py:4114: error: Incompatible types in assignment (expression has type "Dict[Union[bytes, str], Optional[Any]]", variable has type "Dict[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]") [assignment]
+ aioredis/client.py:4114: error: Incompatible types in assignment (expression has type "Dict[Union[bytes, str, memoryview], Optional[Any]]", variable has type "Dict[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]") [assignment]
- aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Union[bytes, str], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
+ aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Union[bytes, str, memoryview], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:359: error: Unsupported operand types for + ("bytes" and "bytearray")
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:144: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/_internal.py:342: error: Unsupported operand types for + ("bytes" and "bytearray") [operator]
+ src/werkzeug/sansio/multipart.py:144: error: Argument 1 to "search" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:155: error: Argument 1 to "search" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:157: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:190: error: Argument 1 to "search" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/routing.py:1209: error: Argument 1 has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
- tests/test_wrappers.py:1044: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1044: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1072: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1072: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1078: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1078: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1084: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1084: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1109: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1109: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ tests/test_wrappers.py:1044: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:121: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ src/urllib3/connection.py:350: error: Argument 1 to "send" of "HTTPConnection" has incompatible type "bytearray"; expected "Union[bytes, IO[Any], Iterable[bytes], str]" [arg-type]
+ src/urllib3/connection.py:350: note: Following member(s) of "bytearray" have conflicts:
+ src/urllib3/connection.py:350: note: Expected:
+ src/urllib3/connection.py:350: note: def __iter__(self) -> Iterator[bytes]
+ src/urllib3/connection.py:350: note: Got:
+ src/urllib3/connection.py:350: note: def __iter__(self) -> Iterator[int]
+ test/test_ssltransport.py:59: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "Union[str, bytes]") [comparison-overlap]
+ test/test_ssltransport.py:540: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ test/with_dummyserver/test_chunked_transfer.py:200: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:229: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:259: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes")
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes")
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes")
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes")
bokeh (https://github.com/bokeh/bokeh)
+ bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ bokeh/core/serialization.py:589:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
yarl (https://github.com/aio-libs/yarl)
+ yarl/_quoting_py.py:63: error: Argument 1 to "match" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:636: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:637: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
optuna (https://github.com/optuna/optuna)
+ optuna/integration/pytorch_distributed.py:278: error: Argument 1 to "loads" has incompatible type "bytearray"; expected "bytes"
core (https://github.com/home-assistant/core)
+ homeassistant/components/rfxtrx/__init__.py:364: error: Argument 1 to "hexlify" has incompatible type "bytearray"; expected "bytes" [arg-type]
manticore (https://github.com/trailofbits/manticore)
+ tests/native/test_armv7unicorn.py:181: error: Argument 1 to "hexlify" has incompatible type "bytearray"; expected "bytes"
+ tests/native/test_armv7cpu.py:277: error: Argument 1 to "hexlify" has incompatible type "bytearray"; expected "bytes"
+ tests/native/test_aarch64cpu.py:38: error: Argument 1 to "hexlify" has incompatible type "bytearray"; expected "bytes"
Quick notes:
- A few of these are fixable in typeshed. For example, I already changed
bytes.__add__recently to reflect thatbytes() + bytearray()works at runtime. Looks likebinascii.hexlifyneeds similar changes. - We'll probably need to change the overlapping equality check to continue to special case bytearray and memoryview.
anyio one is an incorrect annotation, fixed in https://github.com/agronholm/anyio/pull/434
Diff from mypy_primer, showing the effect of this PR on open source code:
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/adapt.py:90: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\']") [comparison-overlap]
+ psycopg/psycopg/sql.py:395: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:146: error: Argument 1 to "parse_row" of "Formatter" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:320: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:325: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:423: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:428: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:484: error: Return type "Union[bytes, bytearray, memoryview]" of "write" incompatible with return type "bytes" in supertype "Formatter" [override]
+ psycopg/psycopg/copy.py:497: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:503: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:537: error: Return type "Union[bytes, bytearray, memoryview]" of "write" incompatible with return type "bytes" in supertype "Formatter" [override]
+ psycopg/psycopg/copy.py:554: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:575: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:602: error: Argument 2 to "sub" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/cursor.py:442: error: Argument 2 to "send_query_params" of "PGconn" has incompatible type "Optional[Sequence[Union[bytes, bytearray, memoryview, None]]]"; expected "Optional[Sequence[Optional[bytes]]]" [arg-type]
+ psycopg/psycopg/cursor.py:584: error: Argument 2 to "send_query_prepared" of "PGconn" has incompatible type "Optional[Sequence[Union[bytes, bytearray, memoryview, None]]]"; expected "Optional[Sequence[Optional[bytes]]]" [arg-type]
+ psycopg/psycopg/types/string.py:86: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "Union[bytes, str]") [return-value]
+ psycopg/psycopg/types/string.py:127: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\000']") [comparison-overlap]
+ psycopg/psycopg/types/string.py:151: error: Incompatible return value type (got "memoryview", expected "bytes") [return-value]
+ psycopg/psycopg/types/string.py:151: error: Argument 1 to "unescape_bytea" of "Escaping" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/string.py:159: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
+ psycopg/psycopg/types/range.py:338: error: Argument 1 to "search" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:339: error: Argument 2 to "sub" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:344: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:349: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:432: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:191: error: Return type "Union[bytes, bytearray, memoryview]" of "dump" incompatible with return type "bytes" in supertype "_IntDumper" [override]
+ psycopg/psycopg/types/numeric.py:224: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:232: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:240: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:248: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:262: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:270: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:331: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/json.py:158: error: Incompatible types in assignment (expression has type "Callable[[Union[str, bytes], DefaultNamedArg(Optional[Type[JSONDecoder]], 'cls'), DefaultNamedArg(Optional[Callable[[Dict[Any, Any]], Any]], 'object_hook'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_float'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_int'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_constant'), DefaultNamedArg(Optional[Callable[[List[Tuple[Any, Any]]], Any]], 'object_pairs_hook'), KwArg(Any)], Any]", variable has type "Callable[[Union[str, bytes, bytearray]], Any]") [assignment]
+ psycopg/psycopg/types/enum.py:40: error: Unused "type: ignore" comment
+ psycopg/psycopg/types/datetime.py:272: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:287: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:314: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:336: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:371: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:431: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:478: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:511: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:577: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:626: error: Argument 1 to "match" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:670: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:46: error: Argument 1 to "search" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:47: error: Argument 2 to "sub" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:49: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:137: error: Argument 1 to "_parse_record" of "BaseCompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:148: error: Argument 1 to "_config_types" of "RecordBinaryLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:153: error: Generator has incompatible item type "Union[bytes, bytearray, memoryview, None]"; expected "Optional[bytes]" [misc]
+ psycopg/psycopg/types/composite.py:154: error: Argument 1 to "_walk_record" of "RecordBinaryLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:182: error: Argument 1 to "_config_types" of "CompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:189: error: Argument 1 to "_parse_record" of "BaseCompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:153: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:157: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:285: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview, Any]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:336: error: Argument 1 to "finditer" of "Pattern" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:393: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:400: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/dbapi20.py:71: error: Argument 1 to "dump" of "BytesDumper" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/multirange.py:229: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/multirange.py:250: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ tests/test_sql.py:53: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\']") [comparison-overlap]
+ tests/test_sql.py:55: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\000']") [comparison-overlap]
+ tests/test_sql.py:59: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\\\\\']") [comparison-overlap]
+ tests/test_sql.py:61: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\\\\\000']") [comparison-overlap]
+ tests/types/test_json.py:120: error: Argument 1 to "set_json_loads" has incompatible type "Callable[[Union[str, bytes], DefaultNamedArg(Optional[Type[JSONDecoder]], 'cls'), DefaultNamedArg(Optional[Callable[[Dict[Any, Any]], Any]], 'object_hook'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_float'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_int'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_constant'), DefaultNamedArg(Optional[Callable[[List[Tuple[Any, Any]]], Any]], 'object_pairs_hook'), KwArg(Any)], Any]"; expected "Callable[[Union[str, bytes, bytearray]], Any]" [arg-type]
+ tests/pq/test_escaping.py:32: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:71: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:110: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:127: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:153: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:174: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ psycopg/psycopg/types/hstore.py:73: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:86: error: Incompatible return value type (got "bytearray", expected "bytes")
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:934: error: Item "memoryview" of "Union[bytes, memoryview]" has no attribute "split" [union-attr]
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, memoryview]"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
- aioredis/client.py:4114: error: Incompatible types in assignment (expression has type "Dict[Union[bytes, str], Optional[Any]]", variable has type "Dict[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]") [assignment]
+ aioredis/client.py:4114: error: Incompatible types in assignment (expression has type "Dict[Union[bytes, str, memoryview], Optional[Any]]", variable has type "Dict[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]") [assignment]
- aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Union[bytes, str], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
+ aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "Dict[Union[bytes, str, memoryview], Optional[Any]]"; expected "SupportsKeysAndGetItem[Union[bytes, str, memoryview], Callable[[Dict[str, str]], Awaitable[None]]]" [arg-type]
anyio (https://github.com/agronholm/anyio)
+ src/anyio/_core/_sockets.py:417: error: Incompatible types in assignment (expression has type "Union[bytearray, bytes]", variable has type "bytes") [assignment]
- src/anyio/_backends/_asyncio.py:1571: error: Unused "type: ignore" comment
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:144: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:144: error: Argument 1 to "search" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:155: error: Argument 1 to "search" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:157: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:190: error: Argument 1 to "search" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/routing.py:1209: error: Argument 1 has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
- tests/test_wrappers.py:1044: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1072: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1072: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1078: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1078: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1084: error: Function is missing a return type annotation [no-untyped-def]
- tests/test_wrappers.py:1084: note: Use "-> None" if function does not return a value
- tests/test_wrappers.py:1109: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
+ tests/test_wrappers.py:1044: note: (Skipping most remaining errors due to unresolved imports or missing stubs; fix these first)
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:121: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ src/urllib3/connection.py:350: error: Argument 1 to "send" of "HTTPConnection" has incompatible type "bytearray"; expected "Union[bytes, IO[Any], Iterable[bytes], str]" [arg-type]
+ src/urllib3/connection.py:350: note: Following member(s) of "bytearray" have conflicts:
+ src/urllib3/connection.py:350: note: Expected:
+ src/urllib3/connection.py:350: note: def __iter__(self) -> Iterator[bytes]
+ src/urllib3/connection.py:350: note: Got:
+ src/urllib3/connection.py:350: note: def __iter__(self) -> Iterator[int]
+ test/test_ssltransport.py:59: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "Union[str, bytes]") [comparison-overlap]
+ test/test_ssltransport.py:540: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ test/with_dummyserver/test_chunked_transfer.py:200: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:229: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:259: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes")
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes")
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes")
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes")
bokeh (https://github.com/bokeh/bokeh)
+ bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ bokeh/core/serialization.py:589:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:636: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:637: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
yarl (https://github.com/aio-libs/yarl)
+ yarl/_quoting_py.py:63: error: Argument 1 to "match" of "Pattern" has incompatible type "bytearray"; expected "bytes" [arg-type]
core (https://github.com/home-assistant/core)
- homeassistant/components/sonos/media.py:138: error: Argument 1 to "int" has incompatible type "Optional[Any]"; expected "Union[str, bytes, array[Any], mmap, _CData, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
+ homeassistant/components/sonos/media.py:138: error: Argument 1 to "int" has incompatible type "Optional[Any]"; expected "Union[str, bytes, bytearray, memoryview, array[Any], mmap, _CData, SupportsInt, SupportsIndex, SupportsTrunc]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2597: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2613: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2617: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2621: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2628: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/adapt.py:90: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\']") [comparison-overlap]
+ psycopg/psycopg/sql.py:398: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:175: error: Argument 1 to "parse_row" of "Formatter" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:362: error: Argument 2 to "copy_to" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:368: error: Argument 2 to "copy_to" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:431: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:436: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:464: error: Argument 1 to "write" of "IO" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:569: error: Argument 2 to "copy_to" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:575: error: Argument 2 to "copy_to" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:625: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:630: error: Argument 1 to "put" of "Queue" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/copy.py:685: error: Return type "Union[bytes, bytearray, memoryview]" of "write" incompatible with return type "bytes" in supertype "Formatter" [override]
+ psycopg/psycopg/copy.py:698: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:704: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:738: error: Return type "Union[bytes, bytearray, memoryview]" of "write" incompatible with return type "bytes" in supertype "Formatter" [override]
+ psycopg/psycopg/copy.py:755: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/copy.py:776: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ psycopg/psycopg/cursor.py:455: error: Argument 2 to "send_query_params" of "PGconn" has incompatible type "Optional[Sequence[Union[bytes, bytearray, memoryview, None]]]"; expected "Optional[Sequence[Optional[bytes]]]" [arg-type]
+ psycopg/psycopg/cursor.py:594: error: Argument 2 to "send_query_prepared" of "PGconn" has incompatible type "Optional[Sequence[Union[bytes, bytearray, memoryview, None]]]"; expected "Optional[Sequence[Optional[bytes]]]" [arg-type]
+ psycopg/psycopg/types/string.py:86: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "Union[bytes, str]") [return-value]
+ psycopg/psycopg/types/string.py:127: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\000']") [comparison-overlap]
+ psycopg/psycopg/types/string.py:151: error: Argument 1 to "unescape_bytea" of "Escaping" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/string.py:159: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
+ psycopg/psycopg/types/range.py:344: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/range.py:349: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:198: error: Return type "Union[bytes, bytearray, memoryview]" of "dump" incompatible with return type "bytes" in supertype "_IntDumper" [override]
+ psycopg/psycopg/types/numeric.py:231: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:239: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:247: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:255: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:269: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:277: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/numeric.py:338: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/json.py:165: error: Incompatible types in assignment (expression has type "Callable[[Union[str, bytes], DefaultNamedArg(Optional[Type[JSONDecoder]], 'cls'), DefaultNamedArg(Optional[Callable[[Dict[Any, Any]], Any]], 'object_hook'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_float'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_int'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_constant'), DefaultNamedArg(Optional[Callable[[List[Tuple[Any, Any]]], Any]], 'object_pairs_hook'), KwArg(Any)], Any]", variable has type "Callable[[Union[str, bytes, bytearray]], Any]") [assignment]
+ psycopg/psycopg/types/datetime.py:277: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:319: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:376: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:479: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:574: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/datetime.py:667: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:50: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:142: error: Argument 1 to "_parse_record" of "BaseCompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:156: error: Argument 1 to "_config_types" of "RecordBinaryLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:161: error: Generator has incompatible item type "Union[bytes, bytearray, memoryview, None]"; expected "Optional[bytes]" [misc]
+ psycopg/psycopg/types/composite.py:162: error: Argument 1 to "_walk_record" of "RecordBinaryLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:190: error: Argument 1 to "_config_types" of "CompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/composite.py:197: error: Argument 1 to "_parse_record" of "BaseCompositeLoader" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:174: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:276: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview, Any]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:373: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/array.py:380: error: Argument 1 has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/dbapi20.py:71: error: Argument 1 to "dump" of "BytesDumper" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/multirange.py:229: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ psycopg/psycopg/types/multirange.py:250: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
+ tests/types/test_json.py:152: error: Argument 1 to "set_json_loads" has incompatible type "Callable[[Union[str, bytes], DefaultNamedArg(Optional[Type[JSONDecoder]], 'cls'), DefaultNamedArg(Optional[Callable[[Dict[Any, Any]], Any]], 'object_hook'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_float'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_int'), DefaultNamedArg(Optional[Callable[[str], Any]], 'parse_constant'), DefaultNamedArg(Optional[Callable[[List[Tuple[Any, Any]]], Any]], 'object_pairs_hook'), KwArg(Any)], Any]"; expected "Callable[[Union[str, bytes, bytearray]], Any]" [arg-type]
+ psycopg/psycopg/types/hstore.py:73: error: Incompatible return value type (got "Union[bytes, bytearray, memoryview]", expected "bytes") [return-value]
+ tests/test_sql.py:57: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\']") [comparison-overlap]
+ tests/test_sql.py:59: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\000']") [comparison-overlap]
+ tests/test_sql.py:63: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\\\\\']") [comparison-overlap]
+ tests/test_sql.py:65: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "Literal[b'\\\\\\\\000']") [comparison-overlap]
+ tests/pq/test_escaping.py:34: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:73: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:112: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:129: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:155: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
+ tests/pq/test_escaping.py:176: error: Non-overlapping equality check (left operand type: "memoryview", right operand type: "bytes") [comparison-overlap]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:121: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:59: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "Union[str, bytes]") [comparison-overlap]
+ test/test_ssltransport.py:540: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ test/with_dummyserver/test_chunked_transfer.py:200: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:229: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:259: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/gateway.py:493: error: Argument 1 to "decompress" of "_Decompress" has incompatible type "bytearray"; expected "bytes" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:423:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:227:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:144: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:170: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/routing/converters.py:32: error: Argument 1 has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:403: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/namespace.py:1126: error: Argument 1 to "BytesIO" has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, memoryview]"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Incompatible types in assignment (expression has type "List[Union[Sequence[int], str, int, float]]", variable has type "List[Union[Union[bytes, memoryview], Union[str, int, float]]]") [assignment]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/message.py: note: In member "_batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:995: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:596:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:636: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:637: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2597: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2613: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2617: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2621: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2628: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
psycopg (https://github.com/psycopg/psycopg)
+ psycopg/psycopg/copy.py:464: error: Argument 1 to "write" of "IO" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:121: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:59: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "Union[str, bytes]") [comparison-overlap]
+ test/test_ssltransport.py:540: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ test/with_dummyserver/test_chunked_transfer.py:200: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:229: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:259: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
discord.py (https://github.com/Rapptz/discord.py)
+ discord/gateway.py:493: error: Argument 1 to "decompress" of "_Decompress" has incompatible type "bytearray"; expected "bytes" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:418:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:224:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:144: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:170: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/routing/converters.py:32: error: Argument 1 has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:403: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
spark (https://github.com/apache/spark)
+ python/pyspark/pandas/namespace.py:1130: error: Argument 1 to "BytesIO" has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, memoryview]"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Incompatible types in assignment (expression has type "List[Union[Sequence[int], str, int, float]]", variable has type "List[Union[Union[bytes, memoryview], Union[str, int, float]]]") [assignment]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:636: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:637: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/message.py: note: In member "_batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:995: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:596:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
psycopg (https://github.com/psycopg/psycopg) + psycopg/psycopg/copy.py:464: error: Argument 1 to "write" of "IO" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "bytes" [arg-type]
As you can see, we have already done some cleanup thanks to this work :wink:
Waiting for python/typeshed#9082 to clean things completely.
Thanks @dvarrazzo, this is great!
Looks like the discord one is fixed by python/typeshed#9036, and the pyspark one by python/typeshed#8995.
Diff from mypy_primer, showing the effect of this PR on open source code:
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, memoryview]"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Incompatible types in assignment (expression has type "List[Union[Sequence[int], str, bytes, memoryview, int, float]]", variable has type "List[Union[Union[bytes, memoryview], Union[str, int, float]]]") [assignment]
Auto-Split (https://github.com/Avasam/Auto-Split)
+ src/AutoSplit.py:924: error: No overload variant of "QImage" matches argument types "memoryview", "int", "int", "int", "Format" [call-overload]
+ src/AutoSplit.py:924: note: Possible overload variants:
+ src/AutoSplit.py:924: note: def __init__(self) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, size: QSize, format: Format) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, width: int, height: int, format: Format) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, data: bytes, width: int, height: int, format: Format, cleanupFunction: Optional[Callable[..., None]] = ..., cleanupInfo: Optional[Any] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, data: bytes, width: int, height: int, bytesPerLine: int, format: Format, cleanupFunction: Optional[Callable[..., None]] = ..., cleanupInfo: Optional[Any] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, xpm: List[str]) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, fileName: str, format: Optional[str] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, a0: QImage) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, variant: Any) -> QImage
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:403: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:144: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:170: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/routing/converters.py:32: error: Argument 1 has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ chess/engine.py:945: error: Argument 1 of "write" is incompatible with supertype "WriteTransport"; supertype defines the argument type as "Union[bytes, bytearray, memoryview]" [override]
+ chess/engine.py:945: note: This violates the Liskov substitution principle
+ chess/engine.py:945: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2511: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2527: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2531: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2535: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2542: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/app.py:280: error: Argument 1 to "verify_signature" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ steam/gateway.py:546: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:549: error: Argument 1 to "parse" of "ProtobufMessage" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:551: error: Argument 1 to "parse" of "Message" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:687: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:640: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:641: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:595:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/message.py: note: In member "_batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:995: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:418:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:224:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:110: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:61: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "Union[str, bytes]") [comparison-overlap]
+ test/test_ssltransport.py:548: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ test/with_dummyserver/test_chunked_transfer.py:198: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:227: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:257: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
Diff from mypy_primer, showing the effect of this PR on open source code:
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, memoryview]"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Incompatible types in assignment (expression has type "List[Union[Sequence[int], str, bytes, memoryview, int, float]]", variable has type "List[Union[Union[bytes, memoryview], Union[str, int, float]]]") [assignment]
Auto-Split (https://github.com/Avasam/Auto-Split)
+ src/AutoSplit.py:924: error: No overload variant of "QImage" matches argument types "memoryview", "int", "int", "int", "Format" [call-overload]
+ src/AutoSplit.py:924: note: Possible overload variants:
+ src/AutoSplit.py:924: note: def __init__(self) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, size: QSize, format: Format) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, width: int, height: int, format: Format) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, data: bytes, width: int, height: int, format: Format, cleanupFunction: Optional[Callable[..., None]] = ..., cleanupInfo: Optional[Any] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, data: bytes, width: int, height: int, bytesPerLine: int, format: Format, cleanupFunction: Optional[Callable[..., None]] = ..., cleanupInfo: Optional[Any] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, xpm: List[str]) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, fileName: str, format: Optional[str] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, a0: QImage) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, variant: Any) -> QImage
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:403: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:144: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:170: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/routing/converters.py:32: error: Argument 1 has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ chess/engine.py:945: error: Argument 1 of "write" is incompatible with supertype "WriteTransport"; supertype defines the argument type as "Union[bytes, bytearray, memoryview]" [override]
+ chess/engine.py:945: note: This violates the Liskov substitution principle
+ chess/engine.py:945: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:640: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:641: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/app.py:280: error: Argument 1 to "verify_signature" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ steam/gateway.py:546: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:549: error: Argument 1 to "parse" of "ProtobufMessage" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:551: error: Argument 1 to "parse" of "Message" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:687: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2511: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2527: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2531: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2535: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2542: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:595:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:418:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:224:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/message.py: note: In member "_batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:995: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:110: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:61: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "Union[str, bytes]") [comparison-overlap]
+ test/test_ssltransport.py:548: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ test/with_dummyserver/test_chunked_transfer.py:198: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:227: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:257: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
Diff from mypy_primer, showing the effect of this PR on open source code:
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "Union[bytes, memoryview]"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Union[Sequence[int], str]" [type-var]
+ aioredis/client.py:3190: error: Incompatible types in assignment (expression has type "List[Union[Sequence[int], str, bytes, memoryview, int, float]]", variable has type "List[Union[Union[bytes, memoryview], Union[str, int, float]]]") [assignment]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:392: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:144: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:170: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/routing/converters.py:44: error: Argument 1 has incompatible type "Union[bytes, bytearray]"; expected "bytes" [arg-type]
Auto-Split (https://github.com/Avasam/Auto-Split)
+ src/AutoSplit.py:924: error: No overload variant of "QImage" matches argument types "memoryview", "int", "int", "int", "Format" [call-overload]
+ src/AutoSplit.py:924: note: Possible overload variants:
+ src/AutoSplit.py:924: note: def __init__(self) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, size: QSize, format: Format) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, width: int, height: int, format: Format) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, data: bytes, width: int, height: int, format: Format, cleanupFunction: Optional[Callable[..., None]] = ..., cleanupInfo: Optional[Any] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, data: bytes, width: int, height: int, bytesPerLine: int, format: Format, cleanupFunction: Optional[Callable[..., None]] = ..., cleanupInfo: Optional[Any] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, xpm: List[str]) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, fileName: str, format: Optional[str] = ...) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, a0: QImage) -> QImage
+ src/AutoSplit.py:924: note: def __init__(self, variant: Any) -> QImage
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ chess/engine.py:947: error: Argument 1 of "write" is incompatible with supertype "WriteTransport"; supertype defines the argument type as "Union[bytes, bytearray, memoryview]" [override]
+ chess/engine.py:947: note: This violates the Liskov substitution principle
+ chess/engine.py:947: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:640: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:641: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2519: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2535: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2539: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2543: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2550: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/app.py:280: error: Argument 1 to "verify_signature" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ steam/gateway.py:551: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:692: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:595:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:418:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:225:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/message.py: note: In member "_batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:995: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:109: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:61: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "Union[str, bytes]") [comparison-overlap]
+ test/test_ssltransport.py:544: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ test/with_dummyserver/test_chunked_transfer.py:198: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:227: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
+ test/with_dummyserver/test_chunked_transfer.py:257: error: Non-overlapping container check (element type: "bytes", container item type: "bytearray") [comparison-overlap]
Diff from mypy_primer, showing the effect of this PR on open source code:
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/dns.py:296: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:334: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:340: error: Argument 5 to "ResourceRecord" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:545: error: Argument 1 to "dtls_parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:547: error: Argument 1 to "parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:111: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:172: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:211: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:218: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ chess/engine.py:956: error: Argument 1 of "write" is incompatible with supertype "WriteTransport"; supertype defines the argument type as "bytes | bytearray | memoryview" [override]
+ chess/engine.py:956: note: This violates the Liskov substitution principle
+ chess/engine.py:956: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "bytes | memoryview"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3190: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3190: error: Incompatible types in assignment (expression has type "list[Sequence[int] | str | bytes | memoryview | int | float]", variable has type "list[bytes | memoryview | str | int | float]") [assignment]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:393: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
Auto-Split (https://github.com/Avasam/Auto-Split)
+ src/AutoSplit.py:935: error: No overload variant of "QImage" matches argument types "memoryview", "int", "int", "int", "Format" [call-overload]
+ src/AutoSplit.py:935: note: Possible overload variants:
+ src/AutoSplit.py:935: note: def __init__(self) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, size: QSize, format: Format) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, width: int, height: int, format: Format) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, data: bytes, width: int, height: int, format: Format, cleanupFunction: Callable[..., None] | None = ..., cleanupInfo: Any | None = ...) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, data: bytes, width: int, height: int, bytesPerLine: int, format: Format, cleanupFunction: Callable[..., None] | None = ..., cleanupInfo: Any | None = ...) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, xpm: list[str]) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, fileName: str, format: str | None = ...) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, a0: QImage) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, variant: Any) -> QImage
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:382: error: Argument 1 to "decompress_sync" of "ZLibDecompressor" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ aiohttp/http_websocket.py:642: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:643: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2524: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2540: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2544: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2548: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2555: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/app.py:239: error: Argument 1 to "verify_signature" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ steam/gateway.py:557: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/gateway.py:698: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:606:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/message.py: note: In member "_batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:995: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:418:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:227:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:109: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:61: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "str | bytes") [comparison-overlap]
+ test/test_ssltransport.py:547: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/dns.py:296: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:334: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:340: error: Argument 5 to "ResourceRecord" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:545: error: Argument 1 to "dtls_parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:547: error: Argument 1 to "parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/_internal.py:111: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "Union[str, bytes, None]") [return-value]
+ src/werkzeug/sansio/multipart.py:172: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:211: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:218: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1855: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ chess/engine.py:956: error: Argument 1 of "write" is incompatible with supertype "WriteTransport"; supertype defines the argument type as "bytes | bytearray | memoryview" [override]
+ chess/engine.py:956: note: This violates the Liskov substitution principle
+ chess/engine.py:956: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "bytes | memoryview"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3190: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3190: error: Incompatible types in assignment (expression has type "list[Sequence[int] | str | bytes | memoryview | int | float]", variable has type "list[bytes | memoryview | str | int | float]") [assignment]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:406: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
Auto-Split (https://github.com/Avasam/Auto-Split)
+ src/AutoSplit.py:935: error: No overload variant of "QImage" matches argument types "memoryview", "int", "int", "int", "Format" [call-overload]
+ src/AutoSplit.py:935: note: Possible overload variants:
+ src/AutoSplit.py:935: note: def __init__(self) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, size: QSize, format: Format) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, width: int, height: int, format: Format) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, data: bytes, width: int, height: int, format: Format, cleanupFunction: Callable[..., None] | None = ..., cleanupInfo: Any | None = ...) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, data: bytes, width: int, height: int, bytesPerLine: int, format: Format, cleanupFunction: Callable[..., None] | None = ..., cleanupInfo: Any | None = ...) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, xpm: list[str]) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, fileName: str, format: str | None = ...) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, a0: QImage) -> QImage
+ src/AutoSplit.py:935: note: def __init__(self, variant: Any) -> QImage
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2524: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2540: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2544: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2548: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2555: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/app.py:239: error: Argument 1 to "verify_signature" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ steam/gateway.py:632: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ steam/state.py:1060: error: Argument 1 to "READ_U32" has incompatible type "bytearray"; expected "bytes" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:394: error: Argument 1 to "decompress_sync" of "ZLibDecompressor" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ aiohttp/http_websocket.py:654: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:655: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:605:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:109: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:61: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "str | bytes") [comparison-overlap]
+ test/test_ssltransport.py:547: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/message.py: note: In member "_batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:995: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:418:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:227:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
For the QImage error: PySide6 is fairly quick to resolve type issues (less than a week everytime I openned or commented on one). I haven't fully followed the whole bytes promotion and Buffer Protocol lately, so I don't know if I'm the best to propose changes. But as a C-extension python binding I think they'll want to use the newly exposed Buffer Protocol.
Edit: Opened issue on Qt/PySide6's Jira: https://bugreports.qt.io/browse/PYSIDE-2476
(linking to #15313 so it's easier for me to find and reference this experiment in the future)
Diff from mypy_primer, showing the effect of this PR on open source code:
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "bytes | memoryview"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: would have incompatible method signatures [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:406: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
operator (https://github.com/canonical/operator)
+ ops/pebble.py:2714: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2730: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2734: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2738: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:2745: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:393:29: error: Argument 1 to "decompress_sync" of "ZLibDecompressor" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ aiohttp/http_websocket.py:653:23: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:654:35: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:615:16: error: Incompatible return value type (got "Union[bytes, memoryview]", expected "bytes") [return-value]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/network.py: note: In function "receive_message":
+ pymongo/network.py:275: error: Argument 1 to "decompress" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ pymongo/network.py:277: error: Incompatible types in assignment (expression has type "memoryview", variable has type "bytes") [assignment]
+ pymongo/message.py: note: In member "__batch_command" of class "_EncryptedBulkWriteContext":
+ pymongo/message.py:1139: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/dns.py:296: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:334: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:340: error: Argument 5 to "ResourceRecord" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:545: error: Argument 1 to "dtls_parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:547: error: Argument 1 to "parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/sansio/multipart.py:172: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:211: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:218: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1838: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ chess/engine.py:847: error: Argument 1 of "write" is incompatible with supertype "WriteTransport"; supertype defines the argument type as "bytes | bytearray | memoryview" [override]
+ chess/engine.py:847: note: This violates the Liskov substitution principle
+ chess/engine.py:847: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:418:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:344:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:109: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:61: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "str | bytes") [comparison-overlap]
+ test/test_ssltransport.py:547: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
Can this PR be refreshed for a new run of the mypy_primer?
Diff from mypy_primer, showing the effect of this PR on open source code:
python-chess (https://github.com/niklasf/python-chess)
+ chess/gaviota.py:1835: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ chess/engine.py:860: error: Argument 1 of "write" is incompatible with supertype "WriteTransport"; supertype defines the argument type as "bytes | bytearray | memoryview" [override]
+ chess/engine.py:860: note: This violates the Liskov substitution principle
+ chess/engine.py:860: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/dns.py:296: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:334: error: Argument 1 to "unpack_from_with_compression" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/dns.py:340: error: Argument 5 to "ResourceRecord" has incompatible type "bytes | bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:551: error: Argument 1 to "dtls_parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ mitmproxy/proxy/layers/tls.py:553: error: Argument 1 to "parse_client_hello" has incompatible type "bytearray"; expected "bytes" [arg-type]
steam.py (https://github.com/Gobot1234/steam.py)
+ steam/app.py:246: error: Argument 1 to "verify_signature" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ steam/state.py:2996: error: Argument 1 to "receive" of "SteamWebSocket" has incompatible type "bytearray"; expected "bytes" [arg-type]
websockets (https://github.com/aaugustin/websockets)
+ src/websockets/streams.py:52: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:75: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/websockets/streams.py:97: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
git-revise (https://github.com/mystor/git-revise)
+ gitrevise/utils.py:85: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
aioredis (https://github.com/aio-libs/aioredis)
+ aioredis/connection.py:952: error: Argument 1 to "append" of "list" has incompatible type "bytes | memoryview"; expected "bytes" [arg-type]
+ aioredis/connection.py:981: error: Subclass of "bytes" and "memoryview" cannot exist: "memoryview" is final [unreachable]
+ aioredis/connection.py:987: error: Subclass of "bytes" and "memoryview" cannot exist: "memoryview" is final [unreachable]
+ aioredis/client.py:1921: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2160: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2173: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2608: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2616: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2621: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2629: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2666: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:2674: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
+ aioredis/client.py:3176: error: Value of type variable "_KeyT" of "list_or_args" cannot be "Sequence[int] | str" [type-var]
boostedblob (https://github.com/hauntsaninja/boostedblob)
+ boostedblob/write.py:67: error: Argument "data" to "Request" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "Union[Dict[str, Any], bytes, None]" [arg-type]
+ boostedblob/write.py:88: error: Argument "data" to "Request" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "Union[Dict[str, Any], bytes, None]" [arg-type]
+ boostedblob/write.py:405: error: Argument "data" to "Request" has incompatible type "Union[bytes, bytearray, memoryview]"; expected "Union[Dict[str, Any], bytes, None]" [arg-type]
dulwich (https://github.com/dulwich/dulwich)
+ dulwich/config.py:388: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
mongo-python-driver (https://github.com/mongodb/mongo-python-driver)
+ pymongo/network.py:335: error: Argument 1 to "decompress" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ pymongo/network.py:337: error: Incompatible types in assignment (expression has type "memoryview", variable has type "bytes") [assignment]
+ pymongo/message.py:1238: error: Argument 1 to "_inflate_bson" has incompatible type "memoryview"; expected "bytes" [arg-type]
operator (https://github.com/canonical/operator)
+ ops/pebble.py:3021: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:3037: error: Argument 1 has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:3041: error: Argument 1 to "_next_part_boundary" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:3045: error: Argument 1 to "__call__" of "_BodyHandler" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ ops/pebble.py:3052: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
trio (https://github.com/python-trio/trio)
+ src/trio/_unix_pipes.py:130: error: Argument 1 of "send_all" is incompatible with supertype "SendStream"; supertype defines the argument type as "Union[bytes, bytearray, memoryview]" [override]
+ src/trio/_unix_pipes.py:130: note: This violates the Liskov substitution principle
+ src/trio/_unix_pipes.py:130: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ src/trio/_highlevel_generic.py:122: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ src/trio/_tests/test_testing.py:421: error: Incompatible return value type (got "bytearray", expected "bytes") [return-value]
+ src/trio/_tests/test_ssl.py:274: error: Argument 1 of "send_all" is incompatible with supertype "SendStream"; supertype defines the argument type as "Union[bytes, bytearray, memoryview]" [override]
+ src/trio/_tests/test_ssl.py:274: note: This violates the Liskov substitution principle
+ src/trio/_tests/test_ssl.py:274: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ src/trio/_tests/test_dtls.py:456: error: No overload variant of "sendto" of "SocketType" matches argument types "Sequence[int]", "Tuple[str, int]" [call-overload]
+ src/trio/_tests/test_dtls.py:456: note: Possible overload variants:
+ src/trio/_tests/test_dtls.py:456: note: def sendto(self, Buffer, Union[Tuple[object, ...], str, Buffer], /) -> Coroutine[Any, Any, int]
+ src/trio/_tests/test_dtls.py:456: note: def sendto(self, Buffer, int, Union[Tuple[object, ...], str, Buffer], /) -> Coroutine[Any, Any, int]
+ src/trio/_tests/test_dtls.py:488: error: Argument "payload" to "evolve" of "UDPPacket" has incompatible type "bytearray"; expected "bytes" [arg-type]
aiohttp (https://github.com/aio-libs/aiohttp)
+ aiohttp/http_websocket.py:402:29: error: Argument 1 to "decompress_sync" of "ZLibDecompressor" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ aiohttp/http_websocket.py:664:23: error: Incompatible types in assignment (expression has type "bytearray", variable has type "bytes") [assignment]
+ aiohttp/http_websocket.py:665:35: error: Argument 2 has incompatible type "bytes"; expected "bytearray" [arg-type]
werkzeug (https://github.com/pallets/werkzeug)
+ src/werkzeug/sansio/multipart.py:172: error: Argument 1 to "_parse_headers" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:211: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ src/werkzeug/sansio/multipart.py:218: error: Argument 1 to "_parse_data" of "MultipartDecoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
urllib3 (https://github.com/urllib3/urllib3)
+ src/urllib3/util/ssltransport.py:108: error: Argument 1 to "send" of "SSLTransport" has incompatible type "memoryview"; expected "bytes" [arg-type]
+ test/test_ssltransport.py:58: error: Non-overlapping equality check (left operand type: "bytearray", right operand type: "str | bytes") [comparison-overlap]
+ test/test_ssltransport.py:543: error: Argument 1 to "sendall" of "SSLTransport" has incompatible type "bytearray"; expected "bytes" [arg-type]
streamlit (https://github.com/streamlit/streamlit)
+ lib/streamlit/string_util.py: note: In function "is_binary_string":
+ lib/streamlit/string_util.py:116:37: error: Argument 2 to "translate" of "bytes" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ lib/streamlit/runtime/legacy_caching/hashing.py: note: In member "_to_bytes" of class "_CodeHasher":
+ lib/streamlit/runtime/legacy_caching/hashing.py:422:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
+ lib/streamlit/runtime/caching/hashing.py: note: In member "_to_bytes" of class "_CacheFuncHasher":
+ lib/streamlit/runtime/caching/hashing.py:361:20: error: Incompatible return value type (got "Union[bytes, bytearray]", expected "bytes") [return-value]
pwndbg (https://github.com/pwndbg/pwndbg)
+ pwndbg/gdblib/memory.py: note: In function "read":
+ pwndbg/gdblib/memory.py:68: error: Incompatible return value type (got "bytes", expected "bytearray") [return-value]
+ pwndbg/gdblib/kernel/__init__.py: note: In function "load_kconfig":
+ pwndbg/gdblib/kernel/__init__.py:93: error: Argument 1 to "Kconfig" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ pwndbg/commands/spray.py: note: In function "spray":
+ pwndbg/commands/spray.py:71: error: Argument 1 to "unpack" of "Arch" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ pwndbg/commands/sigreturn.py: note: In function "sigreturn":
+ pwndbg/commands/sigreturn.py:87: error: Argument 1 to "unpack" of "Arch" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ pwndbg/commands/probeleak.py: note: In function "probeleak":
+ pwndbg/commands/probeleak.py:123: error: Argument 1 to "unpack" of "Arch" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ pwndbg/commands/heap.py: note: In function "find_fake_fast":
+ pwndbg/commands/heap.py:827: error: Argument 1 to "unpack_size" of "Arch" has incompatible type "bytearray"; expected "bytes" [arg-type]
+ pwndbg/commands/heap.py: note: In function "vis_heap_chunks":
+ pwndbg/commands/heap.py:1015: error: Argument 1 to "unpack" of "Arch" has incompatible type "bytearray"; expected "bytes" [arg-type]
aiortc (https://github.com/aiortc/aiortc)
+ src/aiortc/codecs/vpx.py:352: error: Argument 1 to "_packetize" of "Vp8Encoder" has incompatible type "bytearray"; expected "bytes" [arg-type]
bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/core/serialization.py: note: In member "_decode_bytes" of class "Deserializer":
+ src/bokeh/core/serialization.py:618:16: error: Incompatible return value type (got "bytes | memoryview", expected "bytes") [return-value]