Remove some pytype workarounds from stdlib (#14470)

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Sebastian Rittau
2025-07-27 12:56:26 +02:00
committed by GitHub
parent 1a256d8211
commit 7e16c80989
8 changed files with 10 additions and 40 deletions
+1 -9
View File
@@ -59,6 +59,7 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039,UP035
TypeVar as _TypeVar,
Union as Union,
_Alias,
_SpecialForm,
cast as cast,
no_type_check as no_type_check,
no_type_check_decorator as no_type_check_decorator,
@@ -204,15 +205,6 @@ _TC = _TypeVar("_TC", bound=type[object])
_T_co = _TypeVar("_T_co", covariant=True) # Any type covariant containers.
_T_contra = _TypeVar("_T_contra", contravariant=True)
class _Final: ... # This should be imported from typing but that breaks pytype
# unfortunately we have to duplicate this class definition from typing.pyi or we break pytype
class _SpecialForm(_Final):
def __getitem__(self, parameters: Any) -> object: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
# Do not import (and re-export) Protocol or runtime_checkable from
# typing module because type checkers need to be able to distinguish
# typing.Protocol and typing_extensions.Protocol so they can properly