stdlib: correct many pos-or-kw arg names in dunder methods (#7451)

This commit is contained in:
Alex Waygood
2022-03-07 15:40:03 +00:00
committed by GitHub
parent 626ccdaee2
commit f4ae363b56
27 changed files with 153 additions and 162 deletions

View File

@@ -240,7 +240,7 @@ class StreamWriter(Codec):
def writelines(self, list: Iterable[str]) -> None: ...
def reset(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
class StreamReader(Codec, Iterator[str]):
@@ -251,7 +251,7 @@ class StreamReader(Codec, Iterator[str]):
def readlines(self, sizehint: int | None = ..., keepends: bool = ...) -> list[str]: ...
def reset(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __iter__(self: Self) -> Self: ...
def __next__(self) -> str: ...
def __getattr__(self, name: str, getattr: Callable[[str], Any] = ...) -> Any: ...
@@ -270,7 +270,7 @@ class StreamReaderWriter(TextIO):
def reset(self) -> None: ...
def seek(self, offset: int, whence: int = ...) -> None: ... # type: ignore[override]
def __enter__(self: Self) -> Self: ...
def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __exit__(self, type: type[BaseException] | None, value: BaseException | None, tb: types.TracebackType | None) -> None: ...
def __getattr__(self, name: str) -> Any: ...
# These methods don't actually exist directly, but they are needed to satisfy the TextIO
# interface. At runtime, they are delegated through __getattr__.

View File

@@ -95,9 +95,9 @@ class UserList(MutableSequence[_T]):
@overload
def __getitem__(self: Self, i: slice) -> Self: ...
@overload
def __setitem__(self, i: SupportsIndex, o: _T) -> None: ...
def __setitem__(self, i: SupportsIndex, item: _T) -> None: ...
@overload
def __setitem__(self, i: slice, o: Iterable[_T]) -> None: ...
def __setitem__(self, i: slice, item: Iterable[_T]) -> None: ...
def __delitem__(self, i: SupportsIndex | slice) -> None: ...
def __add__(self: Self, other: Iterable[_T]) -> Self: ...
def __radd__(self: Self, other: Iterable[_T]) -> Self: ...
@@ -137,7 +137,7 @@ class UserString(Sequence[UserString]):
def __eq__(self, string: object) -> bool: ...
def __contains__(self, char: object) -> bool: ...
def __len__(self) -> int: ...
def __getitem__(self: Self, i: SupportsIndex | slice) -> Self: ...
def __getitem__(self: Self, index: SupportsIndex | slice) -> Self: ...
def __iter__(self: Self) -> Iterator[Self]: ...
def __reversed__(self: Self) -> Iterator[Self]: ...
def __add__(self: Self, other: object) -> Self: ...
@@ -373,9 +373,9 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
def new_child(self: Self, m: MutableMapping[_KT, _VT] | None = ...) -> Self: ...
@property
def parents(self: Self) -> Self: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, key: _KT, value: _VT) -> None: ...
def __delitem__(self, key: _KT) -> None: ...
def __getitem__(self, key: _KT) -> _VT: ...
def __iter__(self) -> Iterator[_KT]: ...
def __len__(self) -> int: ...
def __contains__(self, key: object) -> bool: ...

View File

@@ -100,9 +100,9 @@ class RawConfigParser(_parser):
converters: _converters = ...,
) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, section: str) -> SectionProxy: ...
def __setitem__(self, section: str, options: _section) -> None: ...
def __delitem__(self, section: str) -> None: ...
def __getitem__(self, key: str) -> SectionProxy: ...
def __setitem__(self, key: str, value: _section) -> None: ...
def __delitem__(self, key: str) -> None: ...
def __iter__(self) -> Iterator[str]: ...
def __contains__(self, key: object) -> bool: ...
def defaults(self) -> _section: ...

View File

@@ -49,7 +49,7 @@ class CDLL:
) -> None: ...
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
def __getitem__(self, name: str) -> _NamedFuncPointer: ...
def __getitem__(self, name_or_ordinal: str) -> _NamedFuncPointer: ...
if sys.platform == "win32":
class OleDLL(CDLL): ...

View File

@@ -15,7 +15,7 @@ class _Database(MutableMapping[_KeyType, bytes]):
def iterkeys(self) -> Iterator[bytes]: ... # undocumented
def close(self) -> None: ...
def __getitem__(self, key: _KeyType) -> bytes: ...
def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
def __setitem__(self, key: _KeyType, val: _ValueType) -> None: ...
def __delitem__(self, key: _KeyType) -> None: ...
def __iter__(self) -> Iterator[bytes]: ...
def __len__(self) -> int: ...

View File

@@ -89,7 +89,7 @@ class EnumMeta(ABCMeta):
def __iter__(self: type[_EnumMemberT]) -> Iterator[_EnumMemberT]: ...
def __reversed__(self: type[_EnumMemberT]) -> Iterator[_EnumMemberT]: ...
def __contains__(self: type[Any], member: object) -> bool: ...
def __contains__(self: type[Any], obj: object) -> bool: ...
def __getitem__(self: type[_EnumMemberT], name: str) -> _EnumMemberT: ...
@_builtins_property
def __members__(self: type[_EnumMemberT]) -> types.MappingProxyType[str, _EnumMemberT]: ...
@@ -205,9 +205,9 @@ class IntFlag(int, Flag):
def __or__(self: Self, other: int) -> Self: ...
def __and__(self: Self, other: int) -> Self: ...
def __xor__(self: Self, other: int) -> Self: ...
def __ror__(self: Self, n: int) -> Self: ...
def __rand__(self: Self, n: int) -> Self: ...
def __rxor__(self: Self, n: int) -> Self: ...
def __ror__(self: Self, other: int) -> Self: ...
def __rand__(self: Self, other: int) -> Self: ...
def __rxor__(self: Self, other: int) -> Self: ...
if sys.version_info >= (3, 11):
class StrEnum(str, ReprEnum):

View File

@@ -40,87 +40,87 @@ class Fraction(Rational):
@property
def denominator(self) -> int: ...
@overload
def __add__(self, other: int | Fraction) -> Fraction: ...
def __add__(self, b: int | Fraction) -> Fraction: ...
@overload
def __add__(self, other: float) -> float: ...
def __add__(self, b: float) -> float: ...
@overload
def __add__(self, other: complex) -> complex: ...
def __add__(self, b: complex) -> complex: ...
@overload
def __radd__(self, other: int | Fraction) -> Fraction: ...
def __radd__(self, a: int | Fraction) -> Fraction: ...
@overload
def __radd__(self, other: float) -> float: ...
def __radd__(self, a: float) -> float: ...
@overload
def __radd__(self, other: complex) -> complex: ...
def __radd__(self, a: complex) -> complex: ...
@overload
def __sub__(self, other: int | Fraction) -> Fraction: ...
def __sub__(self, b: int | Fraction) -> Fraction: ...
@overload
def __sub__(self, other: float) -> float: ...
def __sub__(self, b: float) -> float: ...
@overload
def __sub__(self, other: complex) -> complex: ...
def __sub__(self, b: complex) -> complex: ...
@overload
def __rsub__(self, other: int | Fraction) -> Fraction: ...
def __rsub__(self, a: int | Fraction) -> Fraction: ...
@overload
def __rsub__(self, other: float) -> float: ...
def __rsub__(self, a: float) -> float: ...
@overload
def __rsub__(self, other: complex) -> complex: ...
def __rsub__(self, a: complex) -> complex: ...
@overload
def __mul__(self, other: int | Fraction) -> Fraction: ...
def __mul__(self, b: int | Fraction) -> Fraction: ...
@overload
def __mul__(self, other: float) -> float: ...
def __mul__(self, b: float) -> float: ...
@overload
def __mul__(self, other: complex) -> complex: ...
def __mul__(self, b: complex) -> complex: ...
@overload
def __rmul__(self, other: int | Fraction) -> Fraction: ...
def __rmul__(self, a: int | Fraction) -> Fraction: ...
@overload
def __rmul__(self, other: float) -> float: ...
def __rmul__(self, a: float) -> float: ...
@overload
def __rmul__(self, other: complex) -> complex: ...
def __rmul__(self, a: complex) -> complex: ...
@overload
def __truediv__(self, other: int | Fraction) -> Fraction: ...
def __truediv__(self, b: int | Fraction) -> Fraction: ...
@overload
def __truediv__(self, other: float) -> float: ...
def __truediv__(self, b: float) -> float: ...
@overload
def __truediv__(self, other: complex) -> complex: ...
def __truediv__(self, b: complex) -> complex: ...
@overload
def __rtruediv__(self, other: int | Fraction) -> Fraction: ...
def __rtruediv__(self, a: int | Fraction) -> Fraction: ...
@overload
def __rtruediv__(self, other: float) -> float: ...
def __rtruediv__(self, a: float) -> float: ...
@overload
def __rtruediv__(self, other: complex) -> complex: ...
def __rtruediv__(self, a: complex) -> complex: ...
@overload
def __floordiv__(self, other: int | Fraction) -> int: ...
def __floordiv__(self, b: int | Fraction) -> int: ...
@overload
def __floordiv__(self, other: float) -> float: ...
def __floordiv__(self, b: float) -> float: ...
@overload
def __rfloordiv__(self, other: int | Fraction) -> int: ...
def __rfloordiv__(self, a: int | Fraction) -> int: ...
@overload
def __rfloordiv__(self, other: float) -> float: ...
def __rfloordiv__(self, a: float) -> float: ...
@overload
def __mod__(self, other: int | Fraction) -> Fraction: ...
def __mod__(self, b: int | Fraction) -> Fraction: ...
@overload
def __mod__(self, other: float) -> float: ...
def __mod__(self, b: float) -> float: ...
@overload
def __rmod__(self, other: int | Fraction) -> Fraction: ...
def __rmod__(self, a: int | Fraction) -> Fraction: ...
@overload
def __rmod__(self, other: float) -> float: ...
def __rmod__(self, a: float) -> float: ...
@overload
def __divmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
def __divmod__(self, b: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __divmod__(self, other: float) -> tuple[float, Fraction]: ...
def __divmod__(self, b: float) -> tuple[float, Fraction]: ...
@overload
def __rdivmod__(self, other: int | Fraction) -> tuple[int, Fraction]: ...
def __rdivmod__(self, a: int | Fraction) -> tuple[int, Fraction]: ...
@overload
def __rdivmod__(self, other: float) -> tuple[float, Fraction]: ...
def __rdivmod__(self, a: float) -> tuple[float, Fraction]: ...
@overload
def __pow__(self, other: int) -> Fraction: ...
def __pow__(self, b: int) -> Fraction: ...
@overload
def __pow__(self, other: float | Fraction) -> float: ...
def __pow__(self, b: float | Fraction) -> float: ...
@overload
def __pow__(self, other: complex) -> complex: ...
def __pow__(self, b: complex) -> complex: ...
@overload
def __rpow__(self, other: int | float | Fraction) -> float: ...
def __rpow__(self, a: int | float | Fraction) -> float: ...
@overload
def __rpow__(self, other: complex) -> complex: ...
def __rpow__(self, a: complex) -> complex: ...
def __pos__(self) -> Fraction: ...
def __neg__(self) -> Fraction: ...
def __abs__(self) -> Fraction: ...
@@ -132,11 +132,11 @@ class Fraction(Rational):
@overload
def __round__(self, ndigits: int) -> Fraction: ...
def __hash__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self, other: _ComparableNum) -> bool: ...
def __gt__(self, other: _ComparableNum) -> bool: ...
def __le__(self, other: _ComparableNum) -> bool: ...
def __ge__(self, other: _ComparableNum) -> bool: ...
def __eq__(self, b: object) -> bool: ...
def __lt__(self, b: _ComparableNum) -> bool: ...
def __gt__(self, b: _ComparableNum) -> bool: ...
def __le__(self, b: _ComparableNum) -> bool: ...
def __ge__(self, b: _ComparableNum) -> bool: ...
def __bool__(self) -> bool: ...
def __copy__(self: Self) -> Self: ...
def __deepcopy__(self: Self, memo: Any) -> Self: ...

View File

@@ -169,7 +169,7 @@ if sys.version_info >= (3, 9):
@property
def name(self) -> str: ...
@abstractmethod
def __truediv__(self, key: StrPath) -> Traversable: ...
def __truediv__(self, child: StrPath) -> Traversable: ...
@abstractmethod
def read_bytes(self) -> bytes: ...
@abstractmethod

View File

@@ -77,7 +77,7 @@ class EntryPoint(_EntryPointBase):
if sys.version_info >= (3, 10):
class EntryPoints(list[EntryPoint]): # use as list is deprecated since 3.10
# int argument is deprecated since 3.10
def __getitem__(self, item: int | str) -> EntryPoint: ... # type: ignore[override]
def __getitem__(self, name: int | str) -> EntryPoint: ... # type: ignore[override]
def select(
self,
*,

View File

@@ -18,7 +18,7 @@ class Connection:
send_bytes: Any
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def __init__(self, _in: Any, _out: Any) -> None: ...
def close(self) -> None: ...
@@ -30,7 +30,7 @@ class Listener:
def address(self) -> Queue[Any] | None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def __init__(self, address: _Address | None = ..., family: int | None = ..., backlog: int = ...) -> None: ...
def accept(self) -> Connection: ...

View File

@@ -90,7 +90,7 @@ class Synchronized(SynchronizedBase[_SimpleCData[_T]], Generic[_T]):
class SynchronizedArray(SynchronizedBase[ctypes.Array[_CT]], Generic[_CT]):
def __len__(self) -> int: ...
def __getitem__(self, i: int) -> _CT: ...
def __setitem__(self, i: int, o: _CT) -> None: ...
def __setitem__(self, i: int, value: _CT) -> None: ...
def __getslice__(self, start: int, stop: int) -> list[_CT]: ...
def __setslice__(self, start: int, stop: int, values: Iterable[_CT]) -> None: ...

View File

@@ -250,15 +250,15 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
def __iter__(self) -> Iterator[AnyStr]: ...
def __len__(self) -> int: ...
if sys.version_info >= (3, 9):
def __or__(self, value: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ...
def __ror__(self, value: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ...
def __or__(self, other: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ...
def __ror__(self, other: Mapping[_T1, _T2]) -> dict[AnyStr | _T1, AnyStr | _T2]: ...
# We use @overload instead of a Union for reasons similar to those given for
# overloading MutableMapping.update in stdlib/typing.pyi
# The type: ignore is needed due to incompatible __or__/__ior__ signatures
@overload # type: ignore[misc]
def __ior__(self: Self, value: Mapping[AnyStr, AnyStr]) -> Self: ...
def __ior__(self: Self, other: Mapping[AnyStr, AnyStr]) -> Self: ...
@overload
def __ior__(self: Self, value: Iterable[tuple[AnyStr, AnyStr]]) -> Self: ...
def __ior__(self: Self, other: Iterable[tuple[AnyStr, AnyStr]]) -> Self: ...
environ: _Environ[str]
if sys.platform != "win32":

View File

@@ -75,9 +75,7 @@ class PureWindowsPath(PurePath): ...
class Path(PurePath):
def __new__(cls: type[Self], *args: StrPath, **kwargs: Any) -> Self: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
@classmethod
def cwd(cls: type[Self]) -> Self: ...
if sys.version_info >= (3, 10):

View File

@@ -1090,7 +1090,7 @@ class Popen(Generic[AnyStr]):
def kill(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
self, exc_type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@@ -145,7 +145,7 @@ class TarFile:
) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def __iter__(self) -> Iterator[TarInfo]: ...
@classmethod

View File

@@ -309,9 +309,7 @@ class SpooledTemporaryFile(IO[AnyStr]):
def rollover(self) -> None: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
# These methods are copied from the abstract methods of IO, because
# SpooledTemporaryFile implements IO.
# See also https://github.com/python/typeshed/pull/2452#issuecomment-420657918.
@@ -363,9 +361,7 @@ class TemporaryDirectory(Generic[AnyStr]):
def cleanup(self) -> None: ...
def __enter__(self) -> AnyStr: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def __exit__(self, exc: type[BaseException] | None, value: BaseException | None, tb: TracebackType | None) -> None: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

View File

@@ -169,9 +169,7 @@ class _RLock:
def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ...
def release(self) -> None: ...
__enter__ = acquire
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
RLock = _RLock
@@ -191,9 +189,7 @@ class Condition:
class Semaphore:
def __init__(self, value: int = ...) -> None: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
) -> None: ...
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
def acquire(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
def __enter__(self, blocking: bool = ..., timeout: float | None = ...) -> bool: ...
if sys.version_info >= (3, 9):

View File

@@ -186,15 +186,15 @@ class FrameSummary(Iterable[Any]):
@property
def line(self) -> str | None: ...
@overload
def __getitem__(self, i: Literal[0]) -> str: ...
def __getitem__(self, pos: Literal[0]) -> str: ...
@overload
def __getitem__(self, i: Literal[1]) -> int: ...
def __getitem__(self, pos: Literal[1]) -> int: ...
@overload
def __getitem__(self, i: Literal[2]) -> str: ...
def __getitem__(self, pos: Literal[2]) -> str: ...
@overload
def __getitem__(self, i: Literal[3]) -> str | None: ...
def __getitem__(self, pos: Literal[3]) -> str | None: ...
@overload
def __getitem__(self, i: int) -> Any: ...
def __getitem__(self, pos: int) -> Any: ...
def __iter__(self) -> Iterator[Any]: ...
def __eq__(self, other: object) -> bool: ...
if sys.version_info >= (3, 8):

View File

@@ -88,9 +88,10 @@ class Traceback(Sequence[Frame]):
def format(self, limit: int | None = ...) -> list[str]: ...
@overload
def __getitem__(self, i: SupportsIndex) -> Frame: ...
def __getitem__(self, index: SupportsIndex) -> Frame: ...
@overload
def __getitem__(self, s: slice) -> Sequence[Frame]: ...
def __getitem__(self, index: slice) -> Sequence[Frame]: ...
def __contains__(self, frame: Frame) -> bool: ... # type: ignore[override]
def __len__(self) -> int: ...
def __eq__(self, other: object) -> bool: ...
def __lt__(self, other: Traceback) -> bool: ...

View File

@@ -477,8 +477,8 @@ class TypeVar:
self, name: str, *constraints: Any, bound: Any | None = ..., covariant: bool = ..., contravariant: bool = ...
) -> None: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
# Used for an undocumented mypy feature. Does not exist at runtime.
_promote = object()
@@ -486,7 +486,7 @@ _promote = object()
# N.B. Keep this definition in sync with typing_extensions._SpecialForm
@_final
class _SpecialForm:
def __getitem__(self, typeargs: Any) -> object: ...
def __getitem__(self, parameters: Any) -> object: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
@@ -547,8 +547,8 @@ if sys.version_info >= (3, 10):
def args(self) -> ParamSpecArgs: ...
@property
def kwargs(self) -> ParamSpecKwargs: ...
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...
def __or__(self, right: Any) -> _SpecialForm: ...
def __ror__(self, left: Any) -> _SpecialForm: ...
Concatenate: _SpecialForm
TypeAlias: _SpecialForm
TypeGuard: _SpecialForm
@@ -786,14 +786,14 @@ class Collection(Iterable[_T_co], Container[_T_co], Protocol[_T_co]):
class Sequence(Collection[_T_co], Reversible[_T_co], Generic[_T_co]):
@overload
@abstractmethod
def __getitem__(self, i: int) -> _T_co: ...
def __getitem__(self, index: int) -> _T_co: ...
@overload
@abstractmethod
def __getitem__(self, s: slice) -> Sequence[_T_co]: ...
def __getitem__(self, index: slice) -> Sequence[_T_co]: ...
# Mixin methods
def index(self, value: Any, start: int = ..., stop: int = ...) -> int: ...
def count(self, value: Any) -> int: ...
def __contains__(self, x: object) -> bool: ...
def __contains__(self, value: object) -> bool: ...
def __iter__(self) -> Iterator[_T_co]: ...
def __reversed__(self) -> Iterator[_T_co]: ...
@@ -802,22 +802,22 @@ class MutableSequence(Sequence[_T], Generic[_T]):
def insert(self, index: int, value: _T) -> None: ...
@overload
@abstractmethod
def __getitem__(self, i: int) -> _T: ...
def __getitem__(self, index: int) -> _T: ...
@overload
@abstractmethod
def __getitem__(self, s: slice) -> MutableSequence[_T]: ...
def __getitem__(self, index: slice) -> MutableSequence[_T]: ...
@overload
@abstractmethod
def __setitem__(self, i: int, o: _T) -> None: ...
def __setitem__(self, index: int, value: _T) -> None: ...
@overload
@abstractmethod
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
def __setitem__(self, index: slice, value: Iterable[_T]) -> None: ...
@overload
@abstractmethod
def __delitem__(self, i: int) -> None: ...
def __delitem__(self, index: int) -> None: ...
@overload
@abstractmethod
def __delitem__(self, i: slice) -> None: ...
def __delitem__(self, index: slice) -> None: ...
# Mixin methods
def append(self, value: _T) -> None: ...
def clear(self) -> None: ...
@@ -825,21 +825,21 @@ 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, x: Iterable[_T]) -> TypeshedSelf: ...
def __iadd__(self: TypeshedSelf, values: Iterable[_T]) -> TypeshedSelf: ...
class AbstractSet(Collection[_T_co], Generic[_T_co]):
@abstractmethod
def __contains__(self, x: object) -> bool: ...
def _hash(self) -> int: ...
# Mixin methods
def __le__(self, s: AbstractSet[Any]) -> bool: ...
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
def __gt__(self, s: AbstractSet[Any]) -> bool: ...
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
def __and__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
def __or__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ...
def __sub__(self, s: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
def __xor__(self, s: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ...
def __le__(self, other: AbstractSet[Any]) -> bool: ...
def __lt__(self, other: AbstractSet[Any]) -> bool: ...
def __gt__(self, other: AbstractSet[Any]) -> bool: ...
def __ge__(self, other: AbstractSet[Any]) -> bool: ...
def __and__(self, other: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
def __or__(self, other: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ...
def __sub__(self, other: AbstractSet[Any]) -> AbstractSet[_T_co]: ...
def __xor__(self, other: AbstractSet[_T]) -> AbstractSet[_T_co | _T]: ...
def isdisjoint(self, other: Iterable[Any]) -> bool: ...
class MutableSet(AbstractSet[_T], Generic[_T]):
@@ -851,10 +851,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, s: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __iand__(self: TypeshedSelf, s: AbstractSet[Any]) -> TypeshedSelf: ...
def __ixor__(self: TypeshedSelf, s: AbstractSet[_T]) -> TypeshedSelf: ... # type: ignore[override,misc]
def __isub__(self: TypeshedSelf, s: AbstractSet[Any]) -> TypeshedSelf: ...
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: ...
class MappingView(Sized):
def __init__(self, mapping: Mapping[Any, Any]) -> None: ... # undocumented
@@ -862,39 +862,39 @@ class MappingView(Sized):
class ItemsView(MappingView, AbstractSet[tuple[_KT_co, _VT_co]], Generic[_KT_co, _VT_co]):
def __init__(self, mapping: Mapping[_KT_co, _VT_co]) -> None: ... # undocumented
def __and__(self, o: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
def __rand__(self, o: Iterable[_T]) -> set[_T]: ...
def __contains__(self, o: object) -> bool: ...
def __and__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
def __rand__(self, other: Iterable[_T]) -> set[_T]: ...
def __contains__(self, item: object) -> bool: ...
def __iter__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...
def __or__(self, o: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __ror__(self, o: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __sub__(self, o: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
def __rsub__(self, o: Iterable[_T]) -> set[_T]: ...
def __xor__(self, o: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __rxor__(self, o: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __or__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __ror__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __sub__(self, other: Iterable[Any]) -> set[tuple[_KT_co, _VT_co]]: ...
def __rsub__(self, other: Iterable[_T]) -> set[_T]: ...
def __xor__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
def __rxor__(self, other: Iterable[_T]) -> set[tuple[_KT_co, _VT_co] | _T]: ...
class KeysView(MappingView, AbstractSet[_KT_co], Generic[_KT_co]):
def __init__(self, mapping: Mapping[_KT_co, Any]) -> None: ... # undocumented
def __and__(self, o: Iterable[Any]) -> set[_KT_co]: ...
def __rand__(self, o: Iterable[_T]) -> set[_T]: ...
def __contains__(self, o: object) -> bool: ...
def __and__(self, other: Iterable[Any]) -> set[_KT_co]: ...
def __rand__(self, other: Iterable[_T]) -> set[_T]: ...
def __contains__(self, key: object) -> bool: ...
def __iter__(self) -> Iterator[_KT_co]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_KT_co]: ...
def __or__(self, o: Iterable[_T]) -> set[_KT_co | _T]: ...
def __ror__(self, o: Iterable[_T]) -> set[_KT_co | _T]: ...
def __sub__(self, o: Iterable[Any]) -> set[_KT_co]: ...
def __rsub__(self, o: Iterable[_T]) -> set[_T]: ...
def __xor__(self, o: Iterable[_T]) -> set[_KT_co | _T]: ...
def __rxor__(self, o: Iterable[_T]) -> set[_KT_co | _T]: ...
def __or__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ...
def __ror__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ...
def __sub__(self, other: Iterable[Any]) -> set[_KT_co]: ...
def __rsub__(self, other: Iterable[_T]) -> set[_T]: ...
def __xor__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ...
def __rxor__(self, other: Iterable[_T]) -> set[_KT_co | _T]: ...
class ValuesView(MappingView, Iterable[_VT_co], Generic[_VT_co]):
def __init__(self, mapping: Mapping[Any, _VT_co]) -> None: ... # undocumented
def __contains__(self, o: object) -> bool: ...
def __contains__(self, value: object) -> bool: ...
def __iter__(self) -> Iterator[_VT_co]: ...
if sys.version_info >= (3, 8):
def __reversed__(self) -> Iterator[_VT_co]: ...

View File

@@ -36,7 +36,7 @@ _TC = TypeVar("_TC", bound=Type[object])
# unfortunately we have to duplicate this class definition from typing.pyi or we break pytype
class _SpecialForm:
def __getitem__(self, typeargs: Any) -> object: ...
def __getitem__(self, parameters: Any) -> object: ...
if sys.version_info >= (3, 10):
def __or__(self, other: Any) -> _SpecialForm: ...
def __ror__(self, other: Any) -> _SpecialForm: ...

View File

@@ -24,5 +24,5 @@ class _AssertLogsContext(Generic[_L]):
def __enter__(self) -> _L: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None
) -> bool | None: ...

View File

@@ -295,7 +295,7 @@ class _AssertRaisesContext(Generic[_E]):
exception: _E
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None
) -> bool: ...
if sys.version_info >= (3, 9):
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
@@ -307,5 +307,5 @@ class _AssertWarnsContext:
warnings: list[WarningMessage]
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, tb: TracebackType | None
) -> None: ...

View File

@@ -56,10 +56,10 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
self: WeakValueDictionary[str, _VT], __other: Mapping[str, _VT] | Iterable[tuple[str, _VT]] = ..., **kwargs: _VT
) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __contains__(self, o: object) -> bool: ...
def __getitem__(self, key: _KT) -> _VT: ...
def __setitem__(self, key: _KT, value: _VT) -> None: ...
def __delitem__(self, key: _KT) -> None: ...
def __contains__(self, key: object) -> bool: ...
def __iter__(self) -> Iterator[_KT]: ...
def copy(self) -> WeakValueDictionary[_KT, _VT]: ...
__copy__ = copy
@@ -80,9 +80,9 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
def __ror__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ...
# WeakValueDictionary.__ior__ should be kept roughly in line with MutableMapping.update()
@overload # type: ignore[misc]
def __ior__(self: Self, value: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
def __ior__(self: Self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
@overload
def __ior__(self: Self, value: Iterable[tuple[_KT, _VT]]) -> Self: ...
def __ior__(self: Self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
class KeyedRef(ref[_T], Generic[_KT, _T]):
key: _KT
@@ -96,10 +96,10 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
@overload
def __init__(self, dict: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]]) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, k: _KT) -> _VT: ...
def __setitem__(self, k: _KT, v: _VT) -> None: ...
def __delitem__(self, v: _KT) -> None: ...
def __contains__(self, o: object) -> bool: ...
def __getitem__(self, key: _KT) -> _VT: ...
def __setitem__(self, key: _KT, value: _VT) -> None: ...
def __delitem__(self, key: _KT) -> None: ...
def __contains__(self, key: object) -> bool: ...
def __iter__(self) -> Iterator[_KT]: ...
def copy(self) -> WeakKeyDictionary[_KT, _VT]: ...
__copy__ = copy
@@ -119,9 +119,9 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
def __ror__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ...
# WeakKeyDictionary.__ior__ should be kept roughly in line with MutableMapping.update()
@overload # type: ignore[misc]
def __ior__(self: Self, value: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
def __ior__(self: Self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
@overload
def __ior__(self: Self, value: Iterable[tuple[_KT, _VT]]) -> Self: ...
def __ior__(self: Self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
class finalize: # TODO: This is a good candidate for to be a `Generic[_P, _T]` class
def __init__(self, __obj: object, __func: Callable[_P, Any], *args: _P.args, **kwargs: _P.kwargs) -> None: ...

View File

@@ -95,7 +95,7 @@ if sys.platform == "win32":
def __int__(self) -> int: ...
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
) -> bool | None: ...
def Close(self) -> None: ...
def Detach(self) -> int: ...

View File

@@ -177,7 +177,7 @@ class MultiCall:
__server: ServerProxy
__call_list: list[tuple[str, tuple[_Marshallable, ...]]]
def __init__(self, server: ServerProxy) -> None: ...
def __getattr__(self, item: str) -> _MultiCallMethod: ...
def __getattr__(self, name: str) -> _MultiCallMethod: ...
def __call__(self) -> MultiCallIterator: ...
# A little white lie

View File

@@ -184,7 +184,7 @@ class ZipFile:
def __enter__(self: Self) -> Self: ...
def __exit__(
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None
) -> None: ...
def close(self) -> None: ...
def getinfo(self, name: str) -> ZipInfo: ...