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
+2 -12
View File
@@ -2,18 +2,16 @@ import logging
import sys
import unittest.result
from _typeshed import SupportsDunderGE, SupportsDunderGT, SupportsDunderLE, SupportsDunderLT, SupportsRSub, SupportsSub
from builtins import _ClassInfo
from collections.abc import Callable, Container, Iterable, Mapping, Sequence, Set as AbstractSet
from contextlib import AbstractContextManager
from re import Pattern
from types import GenericAlias, TracebackType
from typing import Any, AnyStr, Final, Generic, NoReturn, Protocol, SupportsAbs, SupportsRound, TypeVar, overload
from typing_extensions import Never, ParamSpec, Self, TypeAlias
from typing_extensions import Never, ParamSpec, Self
from unittest._log import _AssertLogsContext, _LoggingWatcher
from warnings import WarningMessage
if sys.version_info >= (3, 10):
from types import UnionType
_T = TypeVar("_T")
_S = TypeVar("_S", bound=SupportsSub[Any, Any])
_E = TypeVar("_E", bound=BaseException)
@@ -60,14 +58,6 @@ class SkipTest(Exception):
class _SupportsAbsAndDunderGE(SupportsDunderGE[Any], SupportsAbs[Any], Protocol): ...
# Keep this alias in sync with builtins._ClassInfo
# We can't import it from builtins or pytype crashes,
# due to the fact that pytype uses a custom builtins stub rather than typeshed's builtins stub
if sys.version_info >= (3, 10):
_ClassInfo: TypeAlias = type | UnionType | tuple[_ClassInfo, ...]
else:
_ClassInfo: TypeAlias = type | tuple[_ClassInfo, ...]
class TestCase:
failureException: type[BaseException]
longMessage: bool