Closed erictraut closed 2 months ago
Diff from mypy_primer, showing the effect of this PR on open source code:
anyio (https://github.com/agronholm/anyio)
- /tmp/mypy_primer/projects/anyio/src/anyio/_core/_subprocesses.py
- /tmp/mypy_primer/projects/anyio/src/anyio/_core/_subprocesses.py:131:22 - error: No overloads for "open_process" match the provided arguments (reportCallIssue)
- /tmp/mypy_primer/projects/anyio/src/anyio/_core/_subprocesses.py:132:13 - error: Argument of type "bytearray | memoryview[_I@memoryview] | Sequence[str | bytes]" cannot be assigned to parameter "command" of type "Sequence[str | bytes]" in function "open_process"
- Type "bytearray | memoryview[_I@memoryview] | Sequence[str | bytes]" is not assignable to type "Sequence[str | bytes]"
- "bytearray" is not assignable to "Sequence[str | bytes]"
- Type parameter "_T_co@Sequence" is covariant, but "int" is not a subtype of "str | bytes"
- Type "int" is not assignable to type "str | bytes"
- "int" is not assignable to "str"
- "int" is not assignable to "bytes" (reportArgumentType)
- 31 errors, 1 warning, 0 informations
+ 29 errors, 1 warning, 0 informations
bandersnatch (https://github.com/pypa/bandersnatch)
- /tmp/mypy_primer/projects/bandersnatch/src/bandersnatch/tests/plugins/test_storage_plugins.py:335:29 - error: Argument of type "str | bytearray | memoryview[_I@memoryview]" cannot be assigned to parameter "data" of type "str" in function "write_text"
- Type "str | bytearray | memoryview[_I@memoryview]" is not assignable to type "str"
- "bytearray" is not assignable to "str" (reportArgumentType)
- 113 errors, 1 warning, 0 informations
+ 112 errors, 1 warning, 0 informations
poetry (https://github.com/python-poetry/poetry)
- /tmp/mypy_primer/projects/poetry/src/poetry/utils/_compat.py
- /tmp/mypy_primer/projects/poetry/src/poetry/utils/_compat.py:32:16 - error: Type "bytearray | memoryview[_I@memoryview] | str" is not assignable to return type "str"
- Type "bytearray | memoryview[_I@memoryview] | str" is not assignable to type "str"
- "bytearray" is not assignable to "str" (reportReturnType)
- 1202 errors, 32 warnings, 0 informations
+ 1201 errors, 32 warnings, 0 informations
pycryptodome (https://github.com/Legrandin/pycryptodome)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/Hash/CMAC.py:207:47 - error: Argument of type "bytearray" cannot be assigned to parameter "term2" of type "bytes" in function "strxor"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/Math/_IntegerCustom.py:74:44 - error: Argument of type "bytes | bytearray" cannot be assigned to parameter "s" of type "bytes" in function "bytes_to_long"
+ Type "bytes | bytearray" is not assignable to type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/Math/_IntegerNative.py:90:34 - error: Argument of type "Unknown | bytearray" cannot be assigned to parameter "s" of type "bytes" in function "bytes_to_long"
+ Type "Unknown | bytearray" is not assignable to type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/ECC.py:138:42 - error: Argument of type "bytearray" cannot be assigned to parameter "byte_string" of type "bytes" in function "from_bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/ECC.py:151:42 - error: Argument of type "bytearray" cannot be assigned to parameter "byte_string" of type "bytes" in function "from_bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/ECC.py:161:42 - error: Argument of type "bytearray" cannot be assigned to parameter "byte_string" of type "bytes" in function "from_bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/ECC.py:1051:34 - error: Argument of type "bytearray" cannot be assigned to parameter "byte_string" of type "bytes" in function "from_bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/ECC.py:1093:34 - error: Argument of type "bytearray" cannot be assigned to parameter "byte_string" of type "bytes" in function "from_bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/_openssh.py
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/_openssh.py:118:24 - error: Argument of type "bytearray" cannot be assigned to parameter "term1" of type "bytes" in function "strxor"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/_point.py:263:39 - error: Argument of type "bytearray" cannot be assigned to parameter "s" of type "bytes" in function "bytes_to_long"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/_point.py:263:67 - error: Argument of type "bytearray" cannot be assigned to parameter "s" of type "bytes" in function "bytes_to_long"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/PublicKey/_point.py:441:38 - error: Argument of type "bytearray" cannot be assigned to parameter "s" of type "bytes" in function "bytes_to_long"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Protocol/test_ecdh.py:313:53 - error: Argument of type "bytes | bytearray | memoryview[int]" cannot be assigned to parameter "encoded" of type "bytes" in function "import_x25519_private_key"
+ Type "bytes | bytearray | memoryview[int]" is not assignable to type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Protocol/test_ecdh.py:314:51 - error: Argument of type "bytes | bytearray | memoryview[int]" cannot be assigned to parameter "encoded" of type "bytes" in function "import_x25519_public_key"
+ Type "bytes | bytearray | memoryview[int]" is not assignable to type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_import_RSA.py:461:30 - error: Argument of type "bytearray" cannot be assigned to parameter "extern_key" of type "str | bytes" in function "import_key"
+ Type "bytearray" is not assignable to type "str | bytes"
+ "bytearray" is not assignable to "str"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/PublicKey/test_import_RSA.py:462:30 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "extern_key" of type "str | bytes" in function "import_key"
+ Type "memoryview[int]" is not assignable to type "str | bytes"
+ "memoryview[int]" is not assignable to "str"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Signature/test_eddsa.py:451:28 - error: Argument of type "bytearray" cannot be assigned to parameter "s" of type "bytes" in function "bytes_to_long"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Signature/test_eddsa.py:468:28 - error: Argument of type "bytearray" cannot be assigned to parameter "s" of type "bytes" in function "bytes_to_long"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Util/test_strxor.py
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Util/test_strxor.py:70:33 - error: Argument of type "bytearray" cannot be assigned to parameter "term1" of type "bytes" in function "strxor"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Util/test_strxor.py:78:33 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "term1" of type "bytes" in function "strxor"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Util/test_strxor.py:122:25 - error: Argument of type "bytearray" cannot be assigned to parameter "term1" of type "bytes" in function "strxor"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Util/test_strxor.py:136:25 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "term1" of type "bytes" in function "strxor"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/pycryptodome/lib/Crypto/SelfTest/Util/test_strxor.py:192:35 - error: Argument of type "bytearray" cannot be assigned to parameter "term" of type "bytes" in function "strxor_c"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
... (truncated 11 lines) ...
mypy (https://github.com/python/mypy)
- /tmp/mypy_primer/projects/mypy/mypy/stubutil.py:184:12 - error: No overloads for "sub" match the provided arguments (reportCallIssue)
- /tmp/mypy_primer/projects/mypy/mypy/stubutil.py:184:60 - error: Argument of type "str | bytearray | memoryview[_I@memoryview]" cannot be assigned to parameter "string" of type "str" in function "sub"
- Type "str | bytearray | memoryview[_I@memoryview]" is not assignable to type "str"
- "bytearray" is not assignable to "str" (reportArgumentType)
- /tmp/mypy_primer/projects/mypy/mypyc/irbuild/constant_fold.py
- /tmp/mypy_primer/projects/mypy/mypyc/irbuild/constant_fold.py:74:52 - error: Argument of type "int | float | complex | str | bytearray | memoryview[_I@memoryview]" cannot be assigned to parameter "value" of type "ConstantValue" in function "constant_fold_unary_op" (reportArgumentType)
- /tmp/mypy_primer/projects/mypy/mypyc/irbuild/constant_fold.py:86:44 - error: Argument of type "int | float | complex | str | bytearray | memoryview[_I@memoryview]" cannot be assigned to parameter "left" of type "ConstantValue" in function "constant_fold_binary_op" (reportArgumentType)
- /tmp/mypy_primer/projects/mypy/mypyc/irbuild/constant_fold.py:86:50 - error: Argument of type "int | float | complex | str | bytearray | memoryview[_I@memoryview]" cannot be assigned to parameter "right" of type "ConstantValue" in function "constant_fold_binary_op" (reportArgumentType)
- 1743 errors, 108 warnings, 0 informations
+ 1738 errors, 108 warnings, 0 informations
python-chess (https://github.com/niklasf/python-chess)
+ /tmp/mypy_primer/projects/python-chess/chess/engine.py:872:9 - error: Method "write" overrides class "WriteTransport" in an incompatible manner
+ Parameter 2 type mismatch: base parameter is type "bytes | bytearray | memoryview[int]", override parameter is type "bytes"
+ Type "bytes | bytearray | memoryview[int]" is not assignable to type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportIncompatibleMethodOverride)
- 23 errors, 8 warnings, 0 informations
+ 24 errors, 8 warnings, 0 informations
websockets (https://github.com/aaugustin/websockets)
+ /tmp/mypy_primer/projects/websockets/src/websockets/streams.py
+ /tmp/mypy_primer/projects/websockets/src/websockets/streams.py:52:16 - error: Type "bytearray" is not assignable to return type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportReturnType)
+ /tmp/mypy_primer/projects/websockets/src/websockets/streams.py:75:16 - error: Type "bytearray" is not assignable to return type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportReturnType)
+ /tmp/mypy_primer/projects/websockets/src/websockets/streams.py:97:16 - error: Type "bytearray" is not assignable to return type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportReturnType)
+ /tmp/mypy_primer/projects/websockets/src/websockets/asyncio/connection.py:398:43 - error: Argument of type "bytes | memoryview[Data]" cannot be assigned to parameter "data" of type "bytes" in function "send_binary"
+ Type "bytes | memoryview[Data]" is not assignable to type "bytes"
+ "memoryview[Data]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/src/websockets/asyncio/connection.py:491:29 - error: Argument of type "bytes | bytearray | memoryview[Unknown]" cannot be assigned to parameter "data" of type "bytes" in function "send_binary"
+ Type "bytes | bytearray | memoryview[Unknown]" is not assignable to type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/src/websockets/legacy/protocol.py:639:41 - error: Argument of type "Data | memoryview[Data]" cannot be assigned to parameter "data" of type "Data" in function "prepare_data" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/src/websockets/sync/connection.py
+ /tmp/mypy_primer/projects/websockets/src/websockets/sync/connection.py:303:43 - error: Argument of type "bytes | memoryview[Data]" cannot be assigned to parameter "data" of type "bytes" in function "send_binary"
+ Type "bytes | memoryview[Data]" is not assignable to type "bytes"
+ "memoryview[Data]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:213:13 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:213:17 - error: Argument of type "Frame" cannot be assigned to parameter "object" of type "ReadableBuffer" in function "__new__"
+ "Frame" is incompatible with protocol "Buffer"
+ "__buffer__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:213:32 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "bytes" in function "__init__"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:231:13 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:231:17 - error: Argument of type "Frame" cannot be assigned to parameter "object" of type "ReadableBuffer" in function "__new__"
+ "Frame" is incompatible with protocol "Buffer"
+ "__buffer__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:231:32 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "bytes" in function "__init__"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:251:13 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:251:17 - error: Argument of type "Frame" cannot be assigned to parameter "object" of type "ReadableBuffer" in function "__new__"
+ "Frame" is incompatible with protocol "Buffer"
+ "__buffer__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:251:32 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "bytes" in function "__init__"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:289:13 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:289:17 - error: Argument of type "Frame" cannot be assigned to parameter "object" of type "ReadableBuffer" in function "__new__"
+ "Frame" is incompatible with protocol "Buffer"
+ "__buffer__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:289:34 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "bytes" in function "__init__"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:301:13 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:301:17 - error: Argument of type "Frame" cannot be assigned to parameter "object" of type "ReadableBuffer" in function "__new__"
+ "Frame" is incompatible with protocol "Buffer"
+ "__buffer__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:301:34 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "bytes" in function "__init__"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:314:13 - error: No overloads for "__new__" match the provided arguments (reportCallIssue)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:314:17 - error: Argument of type "Frame" cannot be assigned to parameter "object" of type "ReadableBuffer" in function "__new__"
+ "Frame" is incompatible with protocol "Buffer"
+ "__buffer__" is not present (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/test_frames.py:314:34 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "bytes" in function "__init__"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/legacy/test_framing.py:191:26 - error: Argument of type "bytearray" cannot be assigned to parameter "data" of type "Data" in function "prepare_data"
+ Type "bytearray" is not assignable to type "Data"
+ "bytearray" is not assignable to "str"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/legacy/test_framing.py:197:26 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "Data" in function "prepare_data"
+ Type "memoryview[int]" is not assignable to type "Data"
+ "memoryview[int]" is not assignable to "str"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/legacy/test_framing.py:218:39 - error: Argument of type "bytearray" cannot be assigned to parameter "data" of type "Data" in function "prepare_ctrl"
+ Type "bytearray" is not assignable to type "Data"
+ "bytearray" is not assignable to "str"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
+ /tmp/mypy_primer/projects/websockets/tests/legacy/test_framing.py:221:39 - error: Argument of type "memoryview[int]" cannot be assigned to parameter "data" of type "Data" in function "prepare_ctrl"
+ Type "memoryview[int]" is not assignable to type "Data"
+ "memoryview[int]" is not assignable to "str"
+ "memoryview[int]" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
- 960 errors, 14 warnings, 0 informations
+ 989 errors, 14 warnings, 0 informations
check-jsonschema (https://github.com/python-jsonschema/check-jsonschema)
- /tmp/mypy_primer/projects/check-jsonschema/src/check_jsonschema/parsers/__init__.py:92:29 - error: Argument of type "BytesIO | IO[bytes] | bytearray | memoryview[_I@memoryview]" cannot be assigned to parameter of type "IO[bytes]"
- Type "BytesIO | IO[bytes] | bytearray | memoryview[_I@memoryview]" is not assignable to type "IO[bytes]"
- "bytearray" is not assignable to "IO[bytes]" (reportArgumentType)
- 49 errors, 11 warnings, 0 informations
+ 48 errors, 11 warnings, 0 informations
PyWinCtl (https://github.com/Kalmat/PyWinCtl)
- /tmp/mypy_primer/projects/PyWinCtl/src/pywinctl/_pywinctl_linux.py:815:16 - error: Type "str | Unknown | bytearray | memoryview[_I@memoryview]" is not assignable to return type "str"
- Type "str | Unknown | bytearray | memoryview[_I@memoryview]" is not assignable to type "str"
- "bytearray" is not assignable to "str" (reportReturnType)
- 10 errors, 8 warnings, 0 informations
+ 9 errors, 8 warnings, 0 informations
cloud-init (https://github.com/canonical/cloud-init)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:143:25 - error: Cannot access attribute "rstrip" for class "memoryview[_I@memoryview]"
- Attribute "rstrip" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:143:32 - error: Argument of type "Literal['\n']" cannot be assigned to parameter "bytes" of type "ReadableBuffer | None" in function "rstrip"
- Type "Literal['\n']" is not assignable to type "ReadableBuffer | None"
- "Literal['\n']" is incompatible with protocol "Buffer"
- "__buffer__" is not present
- "Literal['\n']" is not assignable to "None" (reportArgumentType)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:143:46 - error: Argument of type "Literal['\n']" cannot be assigned to parameter "old" of type "ReadableBuffer" in function "replace"
- "Literal['\n']" is incompatible with protocol "Buffer"
- "__buffer__" is not present (reportArgumentType)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:143:52 - error: Argument of type "LiteralString" cannot be assigned to parameter "new" of type "ReadableBuffer" in function "replace"
- "str" is incompatible with protocol "Buffer"
- "__buffer__" is not present (reportArgumentType)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:254:34 - error: Argument of type "bytearray | memoryview[_I@memoryview] | List[str] | List[bytes]" cannot be assigned to parameter "args" of type "List[str] | List[bytes]" in function "raise_on_invalid_command" (reportArgumentType)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:256:46 - error: Cannot access attribute "encode" for class "int"
- Attribute "encode" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:256:46 - error: Cannot access attribute "encode" for class "object*"
- Attribute "encode" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:256:46 - error: Cannot access attribute "encode" for class "bytearray"
- Attribute "encode" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/subp.py:256:46 - error: Cannot access attribute "encode" for class "memoryview[_I@memoryview]"
- Attribute "encode" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/util.py:141:52 - error: Cannot access attribute "decode" for class "memoryview[_I@memoryview]"
- Attribute "decode" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/util.py:146:54 - error: Cannot access attribute "encode" for class "bytearray"
- Attribute "encode" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/cloud-init/cloudinit/util.py:146:54 - error: Cannot access attribute "encode" for class "memoryview[_I@memoryview]"
- Attribute "encode" is unknown (reportAttributeAccessIssue)
- 1511 errors, 99 warnings, 0 informations
+ 1499 errors, 99 warnings, 0 informations
scikit-learn (https://github.com/scikit-learn/scikit-learn)
- Attribute "data" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/multiclass.py:402:45 - error: Cannot access attribute "data" for class "bytearray"
- Attribute "data" is unknown (reportAttributeAccessIssue)
- /tmp/mypy_primer/projects/scikit-learn/sklearn/utils/multiclass.py:402:45 - error: Cannot access attribute "data" for class "memoryview[_I@memoryview]"
- 10318 errors, 59 warnings, 0 informations
+ 10316 errors, 59 warnings, 0 informations
git-revise (https://github.com/mystor/git-revise)
+ /tmp/mypy_primer/projects/git-revise/gitrevise/utils.py
+ /tmp/mypy_primer/projects/git-revise/gitrevise/utils.py:85:20 - error: Type "bytearray" is not assignable to return type "bytes"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportReturnType)
- 1 error, 0 warnings, 0 informations
+ 2 errors, 0 warnings, 0 informations
aiortc (https://github.com/aiortc/aiortc)
+ /tmp/mypy_primer/projects/aiortc/src/aiortc/codecs/vpx.py:352:36 - error: Argument of type "bytearray" cannot be assigned to parameter "buffer" of type "bytes" in function "_packetize"
+ "bytearray" is not assignable to "bytes"
+ Set disableBytesTypePromotions to false to enable type promotion behavior for "bytearray" and "memoryview" (reportArgumentType)
- 246 errors, 9 warnings, 0 informations
... (truncated 779 lines) ...```
… from
false
totrue
. It has been over two years since PEP 688 was accepted, so it's time for us to stop treatingbytes
as an alias forbytes | bytearray | memoryview
. This is a breaking change and may require an update to the pyright configuration for some code bases. This addresses #8834.