diff --git a/requirements-tests.txt b/requirements-tests.txt index aeb0fd6696df..3a9afb64cbb7 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,6 +1,6 @@ # Type checkers that we test our stubs against. These should always # be pinned to a specific version to make failure reproducible. -mypy==1.20.0 +mypy==2.0.0 pyright==1.1.409 # Libraries used by our various scripts. diff --git a/stubs/fpdf2/fpdf/encryption.pyi b/stubs/fpdf2/fpdf/encryption.pyi index a41ecbc93b4d..542c931e0de1 100644 --- a/stubs/fpdf2/fpdf/encryption.pyi +++ b/stubs/fpdf2/fpdf/encryption.pyi @@ -87,10 +87,10 @@ class StandardSecurityHandler: @overload def encrypt(self, text: str, obj_id: int) -> str: ... def encrypt_string(self, string: str, obj_id: int) -> str: ... - def encrypt_stream(self, stream: bytes, obj_id: int) -> bytes: ... + def encrypt_stream(self, stream: bytes | bytearray, obj_id: int) -> bytes: ... def is_aes_algorithm(self) -> bool: ... - def encrypt_bytes(self, data: bytes, obj_id: int) -> list[int]: ... - def encrypt_AES_cryptography(self, key: bytes, data: bytes) -> bytes: ... + def encrypt_bytes(self, data: bytes | bytearray, obj_id: int) -> list[int]: ... + def encrypt_AES_cryptography(self, key: bytes, data: bytes | bytearray) -> bytes: ... @classmethod def get_random_bytes(cls, size: int) -> bytes: ... @classmethod @@ -99,7 +99,7 @@ class StandardSecurityHandler: def generate_owner_password(self) -> str: ... def generate_user_password(self) -> str: ... @classmethod - def compute_hash(cls, input_password: bytes, salt: bytes, user_key: bytes = ...) -> bytes: ... + def compute_hash(cls, input_password: bytes | bytearray, salt: bytes, user_key: bytes | bytearray = ...) -> bytes: ... def generate_user_password_rev6(self) -> None: ... def generate_owner_password_rev6(self) -> None: ... def generate_perms_rev6(self) -> None: ... diff --git a/stubs/lupa/lupa/lua51.pyi b/stubs/lupa/lupa/lua51.pyi index 768251730bff..7604148b370b 100644 --- a/stubs/lupa/lupa/lua51.pyi +++ b/stubs/lupa/lupa/lua51.pyi @@ -66,7 +66,7 @@ _bint = TypeVar("_bint", bool, int) class FastRLock(Generic[_bint]): # @classmethod # def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ... - def acquire(self, blocking: _bint = True) -> _bint: ... + def acquire(self, blocking: _bint = ...) -> _bint: ... def release(self) -> None: ... def __enter__(self) -> _bint: ... def __exit__(self, t: object, v: object, tb: object) -> None: ... diff --git a/stubs/lupa/lupa/lua52.pyi b/stubs/lupa/lupa/lua52.pyi index 768251730bff..7604148b370b 100644 --- a/stubs/lupa/lupa/lua52.pyi +++ b/stubs/lupa/lupa/lua52.pyi @@ -66,7 +66,7 @@ _bint = TypeVar("_bint", bool, int) class FastRLock(Generic[_bint]): # @classmethod # def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ... - def acquire(self, blocking: _bint = True) -> _bint: ... + def acquire(self, blocking: _bint = ...) -> _bint: ... def release(self) -> None: ... def __enter__(self) -> _bint: ... def __exit__(self, t: object, v: object, tb: object) -> None: ... diff --git a/stubs/lupa/lupa/lua53.pyi b/stubs/lupa/lupa/lua53.pyi index 768251730bff..7604148b370b 100644 --- a/stubs/lupa/lupa/lua53.pyi +++ b/stubs/lupa/lupa/lua53.pyi @@ -66,7 +66,7 @@ _bint = TypeVar("_bint", bool, int) class FastRLock(Generic[_bint]): # @classmethod # def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ... - def acquire(self, blocking: _bint = True) -> _bint: ... + def acquire(self, blocking: _bint = ...) -> _bint: ... def release(self) -> None: ... def __enter__(self) -> _bint: ... def __exit__(self, t: object, v: object, tb: object) -> None: ... diff --git a/stubs/lupa/lupa/lua54.pyi b/stubs/lupa/lupa/lua54.pyi index 768251730bff..7604148b370b 100644 --- a/stubs/lupa/lupa/lua54.pyi +++ b/stubs/lupa/lupa/lua54.pyi @@ -66,7 +66,7 @@ _bint = TypeVar("_bint", bool, int) class FastRLock(Generic[_bint]): # @classmethod # def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ... - def acquire(self, blocking: _bint = True) -> _bint: ... + def acquire(self, blocking: _bint = ...) -> _bint: ... def release(self) -> None: ... def __enter__(self) -> _bint: ... def __exit__(self, t: object, v: object, tb: object) -> None: ... diff --git a/stubs/lupa/lupa/luajit20.pyi b/stubs/lupa/lupa/luajit20.pyi index 5e5009bb287f..fdf3fe3d448e 100644 --- a/stubs/lupa/lupa/luajit20.pyi +++ b/stubs/lupa/lupa/luajit20.pyi @@ -59,7 +59,7 @@ _bint = TypeVar("_bint", bool, int) class FastRLock(Generic[_bint]): # @classmethod # def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ... - def acquire(self, blocking: _bint = True) -> _bint: ... + def acquire(self, blocking: _bint = ...) -> _bint: ... def release(self) -> None: ... def __enter__(self) -> _bint: ... def __exit__(self, t: object, v: object, tb: object) -> None: ... diff --git a/stubs/lupa/lupa/luajit21.pyi b/stubs/lupa/lupa/luajit21.pyi index 5e5009bb287f..fdf3fe3d448e 100644 --- a/stubs/lupa/lupa/luajit21.pyi +++ b/stubs/lupa/lupa/luajit21.pyi @@ -59,7 +59,7 @@ _bint = TypeVar("_bint", bool, int) class FastRLock(Generic[_bint]): # @classmethod # def __init__(cls, /, *args: Any, **kwargs: Any) -> None: ... - def acquire(self, blocking: _bint = True) -> _bint: ... + def acquire(self, blocking: _bint = ...) -> _bint: ... def release(self) -> None: ... def __enter__(self) -> _bint: ... def __exit__(self, t: object, v: object, tb: object) -> None: ... diff --git a/tests/regr_test.py b/tests/regr_test.py index 196176b14576..4013600e879f 100755 --- a/tests/regr_test.py +++ b/tests/regr_test.py @@ -176,7 +176,7 @@ def run_testcases( else: configurations = mypy_configuration_from_distribution(package.name) - with temporary_mypy_config_file(configurations) as temp: + with temporary_mypy_config_file(configurations) as temp_config: # "--enable-error-code ignore-without-code" is purposefully omitted. # See https://github.com/python/typeshed/pull/8083 @@ -190,7 +190,7 @@ def run_testcases( "--strict", "--pretty", "--config-file", - temp.name, + temp_config.name, # Avoid race conditions when using the cache # https://github.com/python/mypy/issues/13916 "--no-incremental", diff --git a/tests/typecheck_typeshed.py b/tests/typecheck_typeshed.py index cbb16b1b9e9e..92400ac35cb5 100755 --- a/tests/typecheck_typeshed.py +++ b/tests/typecheck_typeshed.py @@ -55,16 +55,13 @@ def run_mypy_as_subprocess(directory: str, platform: str, version: str) -> Retur "--python-version", version, "--strict", - "--strict-bytes", - "--local-partial-types", "--pretty", "--show-traceback", "--no-error-summary", "--enable-error-code", "ignore-without-code", - # https://github.com/python/mypy/issues/14309 - # "--enable-error-code", - # "possibly-undefined", + "--enable-error-code", + "possibly-undefined", "--enable-error-code", "redundant-expr", "--enable-error-code",