Enable flake8-pyi's Y034 check in stdlib/typing.pyi (#8530)

This commit is contained in:
Alex Waygood
2022-08-11 09:57:31 +01:00
committed by GitHub
parent 5a24bf8e1f
commit 556f6a10f6
2 changed files with 12 additions and 14 deletions

View File

@@ -1,6 +1,7 @@
import _typeshed
import collections # Needed by aliases like DefaultDict, see mypy issue 2986
import sys
from _typeshed import IdentityFunction, Incomplete, Self as TypeshedSelf, SupportsKeysAndGetItem
from _typeshed import IdentityFunction, Incomplete, SupportsKeysAndGetItem
from abc import ABCMeta, abstractmethod
from contextlib import AbstractAsyncContextManager, AbstractContextManager
from re import Match as Match, Pattern as Pattern
@@ -496,7 +497,7 @@ class MutableSequence(Sequence[_T], Generic[_T]):
def reverse(self) -> None: ...
def pop(self, index: int = ...) -> _T: ...
def remove(self, value: _T) -> None: ...
def __iadd__(self: TypeshedSelf, values: Iterable[_T]) -> TypeshedSelf: ...
def __iadd__(self: _typeshed.Self, values: Iterable[_T]) -> _typeshed.Self: ...
class AbstractSet(Collection[_T_co], Generic[_T_co]):
@abstractmethod
@@ -522,10 +523,10 @@ class MutableSet(AbstractSet[_T], Generic[_T]):
def clear(self) -> None: ...
def pop(self) -> _T: ...
def remove(self, value: _T) -> None: ...
def __ior__(self: TypeshedSelf, it: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __iand__(self: TypeshedSelf, it: AbstractSet[Any]) -> TypeshedSelf: ...
def __ixor__(self: TypeshedSelf, it: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __isub__(self: TypeshedSelf, it: AbstractSet[Any]) -> TypeshedSelf: ...
def __ior__(self: _typeshed.Self, it: AbstractSet[_T]) -> _typeshed.Self: ... # type: ignore[override,misc]
def __iand__(self: _typeshed.Self, it: AbstractSet[Any]) -> _typeshed.Self: ...
def __ixor__(self: _typeshed.Self, it: AbstractSet[_T]) -> _typeshed.Self: ... # type: ignore[override,misc]
def __isub__(self: _typeshed.Self, it: AbstractSet[Any]) -> _typeshed.Self: ...
class MappingView(Sized):
def __init__(self, mapping: Mapping[Any, Any]) -> None: ... # undocumented
@@ -778,7 +779,7 @@ class NamedTuple(tuple[Any, ...]):
else:
def _asdict(self) -> collections.OrderedDict[str, Any]: ...
def _replace(self: TypeshedSelf, **kwargs: Any) -> TypeshedSelf: ...
def _replace(self: _typeshed.Self, **kwargs: Any) -> _typeshed.Self: ...
# Internal mypy fallback type for all typed dicts (does not exist at runtime)
# N.B. Keep this mostly in sync with typing_extensions._TypedDict/mypy_extensions._TypedDict
@@ -788,7 +789,7 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
if sys.version_info >= (3, 9):
__required_keys__: ClassVar[frozenset[str]]
__optional_keys__: ClassVar[frozenset[str]]
def copy(self: TypeshedSelf) -> TypeshedSelf: ...
def copy(self: _typeshed.Self) -> _typeshed.Self: ...
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
# can go through.
def setdefault(self, k: NoReturn, default: object) -> object: ...
@@ -800,8 +801,8 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
def keys(self) -> KeysView[str]: ...
def values(self) -> ValuesView[object]: ...
if sys.version_info >= (3, 9):
def __or__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
def __ior__(self: TypeshedSelf, __value: TypeshedSelf) -> TypeshedSelf: ...
def __or__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ...
def __ior__(self: _typeshed.Self, __value: _typeshed.Self) -> _typeshed.Self: ...
@_final
class ForwardRef: