diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 88767316f22a..b02b17d1a4cd 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -324,6 +324,7 @@ class Namespace(_AttributeHolder): def __getattr__(self, name: str) -> Any: ... def __setattr__(self, __name: str, __value: Any) -> None: ... def __contains__(self, key: str) -> bool: ... + def __eq__(self, other: object) -> bool: ... class FileType: # undocumented diff --git a/stdlib/asyncio/events.pyi b/stdlib/asyncio/events.pyi index c86c0a99182e..ef46902bace3 100644 --- a/stdlib/asyncio/events.pyi +++ b/stdlib/asyncio/events.pyi @@ -59,6 +59,7 @@ class TimerHandle(Handle): def __le__(self, other: TimerHandle) -> bool: ... def __gt__(self, other: TimerHandle) -> bool: ... def __ge__(self, other: TimerHandle) -> bool: ... + def __eq__(self, other: object) -> bool: ... class AbstractServer: @abstractmethod diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 8c6191e6870e..0c110f0753b4 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -82,6 +82,7 @@ class UserList(MutableSequence[_T]): def __le__(self, other: list[_T] | UserList[_T]) -> bool: ... def __gt__(self, other: list[_T] | UserList[_T]) -> bool: ... def __ge__(self, other: list[_T] | UserList[_T]) -> bool: ... + def __eq__(self, other: object) -> bool: ... def __contains__(self, item: object) -> bool: ... def __len__(self) -> int: ... @overload @@ -125,6 +126,7 @@ class UserString(Sequence[UserString]): def __le__(self, string: str | UserString) -> bool: ... def __gt__(self, string: str | UserString) -> bool: ... def __ge__(self, string: str | UserString) -> bool: ... + def __eq__(self, string: object) -> bool: ... def __contains__(self, char: object) -> bool: ... def __len__(self) -> int: ... def __getitem__(self: Self, i: SupportsIndex | slice) -> Self: ... @@ -267,6 +269,9 @@ class Counter(dict[_T, int], Generic[_T]): def update(self, __m: Iterable[_T] | Iterable[tuple[_T, int]], **kwargs: int) -> None: ... @overload def update(self, __m: None = ..., **kwargs: int) -> None: ... + def __delitem__(self, elem: object) -> None: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... def __add__(self, other: Counter[_T]) -> Counter[_T]: ... def __sub__(self, other: Counter[_T]) -> Counter[_T]: ... def __and__(self, other: Counter[_T]) -> Counter[_T]: ... @@ -362,6 +367,7 @@ class ChainMap(MutableMapping[_KT, _VT], Generic[_KT, _VT]): def __getitem__(self, k: _KT) -> _VT: ... def __iter__(self) -> Iterator[_KT]: ... def __len__(self) -> int: ... + def __contains__(self, key: object) -> bool: ... def __missing__(self, key: _KT) -> _VT: ... # undocumented def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... @overload diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index 7dfbe77c725f..b812abe995a7 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -80,6 +80,7 @@ class RawConfigParser(_parser): def __setitem__(self, section: str, options: _section) -> None: ... def __delitem__(self, section: str) -> None: ... def __iter__(self) -> Iterator[str]: ... + def __contains__(self, key: object) -> bool: ... def defaults(self) -> _section: ... def sections(self) -> list[str]: ... def add_section(self, section: str) -> None: ... diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 2ebf225f55f5..8be3d3a2c073 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -46,6 +46,9 @@ class _GeneratorContextManager(AbstractContextManager[_T_co], ContextDecorator, func: Callable[..., Generator[_T_co, Any, Any]] args: tuple[Any, ...] kwds: dict[str, Any] + def __exit__( + self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> bool | None: ... def contextmanager(func: Callable[_P, Iterator[_T_co]]) -> Callable[_P, _GeneratorContextManager[_T_co]]: ... @@ -63,6 +66,9 @@ if sys.version_info >= (3, 10): func: Callable[..., AsyncGenerator[_T_co, Any]] args: tuple[Any, ...] kwds: dict[str, Any] + async def __aexit__( + self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> bool | None: ... elif sys.version_info >= (3, 7): class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co], Generic[_T_co]): diff --git a/stdlib/doctest.pyi b/stdlib/doctest.pyi index 31765ae4f80a..55303a025fd9 100644 --- a/stdlib/doctest.pyi +++ b/stdlib/doctest.pyi @@ -47,6 +47,7 @@ class Example: options: dict[int, bool] | None = ..., ) -> None: ... def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... class DocTest: examples: list[Example] @@ -66,6 +67,7 @@ class DocTest: ) -> None: ... def __hash__(self) -> int: ... def __lt__(self, other: DocTest) -> bool: ... + def __eq__(self, other: object) -> bool: ... class DocTestParser: def parse(self, string: str, name: str = ...) -> list[str | Example]: ... @@ -172,6 +174,7 @@ class DocTestCase(unittest.TestCase): def debug(self) -> None: ... def id(self) -> str: ... def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... def shortDescription(self) -> str: ... class SkipDocTestCase(DocTestCase): diff --git a/stdlib/email/headerregistry.pyi b/stdlib/email/headerregistry.pyi index 39fe82a186da..7f1d86b985a1 100644 --- a/stdlib/email/headerregistry.pyi +++ b/stdlib/email/headerregistry.pyi @@ -161,6 +161,7 @@ class Address: def __init__( self, display_name: str = ..., username: str | None = ..., domain: str | None = ..., addr_spec: str | None = ... ) -> None: ... + def __eq__(self, other: object) -> bool: ... class Group: @property @@ -168,3 +169,4 @@ class Group: @property def addresses(self) -> tuple[Address, ...]: ... def __init__(self, display_name: str | None = ..., addresses: Iterable[Address] | None = ...) -> None: ... + def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 437c2ebdc7b6..7e0918c32b9a 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -25,6 +25,7 @@ _EnumNames = Union[str, Iterable[str], Iterable[Iterable[Union[str, Any]]], Mapp class _EnumDict(dict[str, Any]): def __init__(self) -> None: ... + def __setitem__(self, key: str, value: Any) -> None: ... # Note: EnumMeta actually subclasses type directly, not ABCMeta. # This is a temporary workaround to allow multiple creation of enums with builtins @@ -56,6 +57,8 @@ class EnumMeta(ABCMeta): def __members__(self: type[_T]) -> types.MappingProxyType[str, _T]: ... def __len__(self) -> int: ... def __bool__(self) -> Literal[True]: ... + def __setattr__(self, name: str, value: Any) -> None: ... + def __delattr__(self, name: str) -> None: ... if sys.version_info >= (3, 11): # Simple value lookup @overload # type: ignore[override] diff --git a/stdlib/http/cookies.pyi b/stdlib/http/cookies.pyi index 95a4716a8ab0..740a41a819ed 100644 --- a/stdlib/http/cookies.pyi +++ b/stdlib/http/cookies.pyi @@ -38,6 +38,8 @@ class Morsel(dict[str, Any], Generic[_T]): def output(self, attrs: list[str] | None = ..., header: str = ...) -> str: ... def js_output(self, attrs: list[str] | None = ...) -> str: ... def OutputString(self, attrs: list[str] | None = ...) -> str: ... + def __eq__(self, morsel: object) -> bool: ... + def __setitem__(self, K: str, V: Any) -> None: ... if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any) -> GenericAlias: ... diff --git a/stdlib/importlib/machinery.pyi b/stdlib/importlib/machinery.pyi index 1d7c21444852..6a531c8cb414 100644 --- a/stdlib/importlib/machinery.pyi +++ b/stdlib/importlib/machinery.pyi @@ -24,6 +24,7 @@ class ModuleSpec: cached: str | None parent: str | None has_location: bool + def __eq__(self, other: object) -> bool: ... class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder @@ -144,3 +145,4 @@ class ExtensionFileLoader(importlib.abc.ExecutionLoader): def exec_module(self, module: types.ModuleType) -> None: ... def is_package(self, fullname: str) -> bool: ... def get_code(self, fullname: str) -> None: ... + def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index f270ad574562..7729dc7482df 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -189,6 +189,8 @@ class Signature: @classmethod def from_callable(cls: type[Self], obj: Callable[..., Any], *, follow_wrapped: bool = ...) -> Self: ... + def __eq__(self, other: object) -> bool: ... + if sys.version_info >= (3, 10): def get_annotations( obj: Callable[..., Any] | type[Any] | ModuleType, @@ -235,6 +237,7 @@ class Parameter: default: Any = ..., annotation: Any = ..., ) -> Self: ... + def __eq__(self, other: object) -> bool: ... class BoundArguments: arguments: OrderedDict[str, Any] @@ -243,6 +246,7 @@ class BoundArguments: signature: Signature def __init__(self, signature: Signature, arguments: OrderedDict[str, Any]) -> None: ... def apply_defaults(self) -> None: ... + def __eq__(self, other: object) -> bool: ... # # Classes and functions diff --git a/stdlib/multiprocessing/managers.pyi b/stdlib/multiprocessing/managers.pyi index b9959b41ab07..fd91e49d9a9b 100644 --- a/stdlib/multiprocessing/managers.pyi +++ b/stdlib/multiprocessing/managers.pyi @@ -1,7 +1,8 @@ import queue import sys import threading -from contextlib import AbstractContextManager +from _typeshed import Self +from types import TracebackType from typing import Any, AnyStr, Callable, Generic, Iterable, Mapping, Sequence, TypeVar from .connection import Connection @@ -69,7 +70,7 @@ class Server: def serve_forever(self) -> None: ... def accept_connection(self, c: Connection, name: str) -> None: ... -class BaseManager(AbstractContextManager[BaseManager]): +class BaseManager: def __init__( self, address: Any | None = ..., authkey: bytes | None = ..., serializer: str = ..., ctx: BaseContext | None = ... ) -> None: ... @@ -90,12 +91,14 @@ class BaseManager(AbstractContextManager[BaseManager]): method_to_typeid: Mapping[str, str] | None = ..., create_method: bool = ..., ) -> None: ... + def __enter__(self: Self) -> Self: ... + def __exit__(self, exc_type: type[BaseException], exc_val: BaseException, exc_tb: TracebackType) -> None: ... # Conflicts with method names _dict = dict _list = list -class SyncManager(BaseManager, AbstractContextManager[SyncManager]): +class SyncManager(BaseManager): def BoundedSemaphore(self, value: Any = ...) -> threading.BoundedSemaphore: ... def Condition(self, lock: Any = ...) -> threading.Condition: ... def Event(self) -> threading.Event: ... diff --git a/stdlib/multiprocessing/pool.pyi b/stdlib/multiprocessing/pool.pyi index 55bdd940ee25..f79348e9d520 100644 --- a/stdlib/multiprocessing/pool.pyi +++ b/stdlib/multiprocessing/pool.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import Self -from contextlib import AbstractContextManager +from types import TracebackType from typing import Any, Callable, Generic, Iterable, Iterator, Mapping, TypeVar from typing_extensions import Literal @@ -67,7 +67,7 @@ class IMapIterator(Iterator[_T]): class IMapUnorderedIterator(IMapIterator[_T]): ... -class Pool(AbstractContextManager[Pool]): +class Pool: def __init__( self, processes: int | None = ..., @@ -111,8 +111,9 @@ class Pool(AbstractContextManager[Pool]): def terminate(self) -> None: ... def join(self) -> None: ... def __enter__(self: Self) -> Self: ... + def __exit__(self, exc_type: type[BaseException], exc_val: BaseException, exc_tb: TracebackType) -> None: ... -class ThreadPool(Pool, AbstractContextManager[ThreadPool]): +class ThreadPool(Pool): def __init__( self, processes: int | None = ..., initializer: Callable[..., Any] | None = ..., initargs: Iterable[Any] = ... ) -> None: ... diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 725866757657..965438215e4f 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -161,6 +161,7 @@ class Values: def read_module(self, modname: str, mode: str = ...) -> None: ... def __getattr__(self, name: str) -> Any: ... def __setattr__(self, __name: str, __value: Any) -> None: ... + def __eq__(self, other: object) -> bool: ... class OptionParser(OptionContainer): allow_interspersed_args: bool diff --git a/stdlib/pathlib.pyi b/stdlib/pathlib.pyi index 95e3586f60ca..98a53340a7f8 100644 --- a/stdlib/pathlib.pyi +++ b/stdlib/pathlib.pyi @@ -28,6 +28,7 @@ class PurePath(PathLike[str]): stem: str def __new__(cls: type[Self], *args: StrPath) -> Self: ... def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... def __lt__(self, other: PurePath) -> bool: ... def __le__(self, other: PurePath) -> bool: ... def __gt__(self, other: PurePath) -> bool: ... diff --git a/stdlib/plistlib.pyi b/stdlib/plistlib.pyi index 64c55afa058a..59325104d76b 100644 --- a/stdlib/plistlib.pyi +++ b/stdlib/plistlib.pyi @@ -71,6 +71,7 @@ if sys.version_info >= (3, 8): def __index__(self) -> int: ... def __reduce__(self: Self) -> tuple[type[Self], tuple[int]]: ... def __hash__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... class InvalidFileException(ValueError): def __init__(self, message: str = ...) -> None: ... diff --git a/stdlib/shelve.pyi b/stdlib/shelve.pyi index 40d8d4585bd1..b9df3cbba27d 100644 --- a/stdlib/shelve.pyi +++ b/stdlib/shelve.pyi @@ -20,6 +20,7 @@ class Shelf(MutableMapping[str, _VT]): def __getitem__(self, key: str) -> _VT: ... def __setitem__(self, key: str, value: _VT) -> None: ... def __delitem__(self, key: str) -> None: ... + def __contains__(self, key: str) -> bool: ... # type: ignore[override] def __enter__(self: Self) -> Self: ... def __exit__( self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None diff --git a/stdlib/statistics.pyi b/stdlib/statistics.pyi index 912995fdd25c..cdc6b6044e67 100644 --- a/stdlib/statistics.pyi +++ b/stdlib/statistics.pyi @@ -67,6 +67,7 @@ if sys.version_info >= (3, 8): if sys.version_info >= (3, 9): def zscore(self, x: float) -> float: ... + def __eq__(self, x2: object) -> bool: ... def __add__(self, x2: float | NormalDist) -> NormalDist: ... def __sub__(self, x2: float | NormalDist) -> NormalDist: ... def __mul__(self, x2: float) -> NormalDist: ... diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 0cb2b20af170..687768e3afa4 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -142,6 +142,7 @@ class Variable: def trace_vdelete(self, mode, cbname) -> None: ... # deprecated def trace_vinfo(self): ... # deprecated trace = trace_variable # deprecated + def __eq__(self, other: object) -> bool: ... class StringVar(Variable): def __init__(self, master: Misc | None = ..., value: str | None = ..., name: str | None = ...) -> None: ... diff --git a/stdlib/tkinter/font.pyi b/stdlib/tkinter/font.pyi index 211e8ec9a0be..e5f8e5ed2acb 100644 --- a/stdlib/tkinter/font.pyi +++ b/stdlib/tkinter/font.pyi @@ -101,6 +101,7 @@ class Font: @overload def metrics(self, *, displayof: tkinter.Misc | None = ...) -> _MetricsDict: ... def measure(self, text: str, displayof: tkinter.Misc | None = ...) -> int: ... + def __eq__(self, other: object) -> bool: ... def families(root: tkinter.Misc | None = ..., displayof: tkinter.Misc | None = ...) -> tuple[str, ...]: ... def names(root: tkinter.Misc | None = ...) -> tuple[str, ...]: ... diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index ee6c0772edde..557e7c5f2ca6 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -124,6 +124,7 @@ class TracebackException: cls: type[Self], exc: BaseException, *, limit: int | None = ..., lookup_lines: bool = ..., capture_locals: bool = ... ) -> Self: ... + def __eq__(self, other: object) -> bool: ... def format(self, *, chain: bool = ...) -> Generator[str, None, None]: ... def format_exception_only(self) -> Generator[str, None, None]: ... @@ -173,6 +174,7 @@ class FrameSummary(Iterable[Any]): @overload def __getitem__(self, i: int) -> Any: ... def __iter__(self) -> Iterator[Any]: ... + def __eq__(self, other: object) -> bool: ... if sys.version_info >= (3, 8): def __len__(self) -> Literal[4]: ... diff --git a/stdlib/tracemalloc.pyi b/stdlib/tracemalloc.pyi index 3b6e7f676d90..b377df1eca40 100644 --- a/stdlib/tracemalloc.pyi +++ b/stdlib/tracemalloc.pyi @@ -26,6 +26,7 @@ class Statistic: size: int traceback: Traceback def __init__(self, traceback: Traceback, size: int, count: int) -> None: ... + def __eq__(self, other: object) -> bool: ... class StatisticDiff: count: int @@ -34,6 +35,7 @@ class StatisticDiff: size_diff: int traceback: Traceback def __init__(self, traceback: Traceback, size: int, size_diff: int, count: int, count_diff: int) -> None: ... + def __eq__(self, other: object) -> bool: ... _FrameTupleT = tuple[str, int] @@ -61,6 +63,7 @@ class Trace: size: int traceback: Traceback def __init__(self, trace: _TraceTupleT) -> None: ... + def __eq__(self, other: object) -> bool: ... class Traceback(Sequence[Frame]): if sys.version_info >= (3, 9): @@ -78,6 +81,7 @@ class Traceback(Sequence[Frame]): @overload def __getitem__(self, s: slice) -> Sequence[Frame]: ... def __len__(self) -> int: ... + def __eq__(self, other: object) -> bool: ... def __lt__(self, other: Traceback) -> bool: ... if sys.version_info >= (3, 11): def __gt__(self, other: Traceback) -> bool: ... diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index 64fd00dea0f4..28b5a07aabf6 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -82,6 +82,7 @@ class TestCase: # undocumented _testMethodDoc: str def __init__(self, methodName: str = ...) -> None: ... + def __eq__(self, other: object) -> bool: ... def setUp(self) -> None: ... def tearDown(self) -> None: ... @classmethod diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index a3be1b780dde..664da1a34a8c 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -128,6 +128,8 @@ class NonCallableMock(Base, Any): **kwargs: Any, ) -> None: ... def __getattr__(self, name: str) -> Any: ... + def __delattr__(self, name: str) -> None: ... + def __setattr__(self, name: str, value: Any) -> None: ... if sys.version_info >= (3, 8): def _calls_repr(self, prefix: str = ...) -> str: ... def assert_called_with(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/stdlib/unittest/suite.pyi b/stdlib/unittest/suite.pyi index 396b46eadf5a..f1e168a674a7 100644 --- a/stdlib/unittest/suite.pyi +++ b/stdlib/unittest/suite.pyi @@ -15,6 +15,7 @@ class BaseTestSuite(Iterable[_TestType]): def debug(self) -> None: ... def countTestCases(self) -> int: ... def __iter__(self) -> Iterator[_TestType]: ... + def __eq__(self, other: object) -> bool: ... class TestSuite(BaseTestSuite): def run(self, result: unittest.result.TestResult, debug: bool = ...) -> unittest.result.TestResult: ... diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index ee22cddd9aa0..761016905a09 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -27,6 +27,8 @@ ProxyTypes: tuple[type[Any], ...] class WeakMethod(ref[_CallableT], Generic[_CallableT]): def __new__(cls: type[Self], meth: _CallableT, callback: Callable[[_CallableT], object] | None = ...) -> Self: ... def __call__(self) -> _CallableT | None: ... + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... class WeakValueDictionary(MutableMapping[_KT, _VT]): @overload diff --git a/stdlib/xml/etree/ElementTree.pyi b/stdlib/xml/etree/ElementTree.pyi index c2b5370c58dd..1f845389089e 100644 --- a/stdlib/xml/etree/ElementTree.pyi +++ b/stdlib/xml/etree/ElementTree.pyi @@ -115,6 +115,7 @@ class QName: def __le__(self, other: QName | str) -> bool: ... def __gt__(self, other: QName | str) -> bool: ... def __ge__(self, other: QName | str) -> bool: ... + def __eq__(self, other: object) -> bool: ... class ElementTree: def __init__(self, element: Element | None = ..., file: _File | None = ...) -> None: ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 5aac530a9d9a..0f9c21b75836 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -83,6 +83,7 @@ class Binary: def __init__(self, data: bytes | None = ...) -> None: ... def decode(self, data: bytes) -> None: ... def encode(self, out: SupportsWrite[str]) -> None: ... + def __eq__(self, other: object) -> bool: ... def _binary(data: bytes) -> Binary: ... # undocumented