diff --git a/stdlib/_collections_abc.pyi b/stdlib/_collections_abc.pyi index bf7f2991f9a4..8bac0ce1dca3 100644 --- a/stdlib/_collections_abc.pyi +++ b/stdlib/_collections_abc.pyi @@ -8,6 +8,7 @@ from typing import ( # noqa: Y022,Y038 AsyncIterator as AsyncIterator, Awaitable as Awaitable, Callable as Callable, + ClassVar, Collection as Collection, Container as Container, Coroutine as Coroutine, @@ -74,6 +75,7 @@ _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented def __eq__(self, value: object, /) -> bool: ... def __reversed__(self) -> Iterator[_KT_co]: ... + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 13): def isdisjoint(self, other: Iterable[_KT_co], /) -> bool: ... if sys.version_info >= (3, 10): @@ -91,6 +93,7 @@ class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented def __eq__(self, value: object, /) -> bool: ... def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 13): def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool: ... if sys.version_info >= (3, 10): diff --git a/stdlib/_contextvars.pyi b/stdlib/_contextvars.pyi index f84a758d6e09..c7d0814b3cb4 100644 --- a/stdlib/_contextvars.pyi +++ b/stdlib/_contextvars.pyi @@ -37,6 +37,7 @@ class Token(Generic[_T]): @property def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express MISSING: ClassVar[object] + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @@ -55,6 +56,7 @@ class Context(Mapping[ContextVar[Any], Any]): def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ... def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... def copy(self) -> Context: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __getitem__(self, key: ContextVar[_T], /) -> _T: ... def __iter__(self) -> Iterator[ContextVar[Any]]: ... def __len__(self) -> int: ... diff --git a/stdlib/_frozen_importlib.pyi b/stdlib/_frozen_importlib.pyi index b6d7a1842048..3dbc8c6b52f0 100644 --- a/stdlib/_frozen_importlib.pyi +++ b/stdlib/_frozen_importlib.pyi @@ -5,7 +5,7 @@ import types from _typeshed.importlib import LoaderProtocol from collections.abc import Mapping, Sequence from types import ModuleType -from typing import Any +from typing import Any, ClassVar # Signature of `builtins.__import__` should be kept identical to `importlib.__import__` def __import__( @@ -43,6 +43,7 @@ class ModuleSpec: def parent(self) -> str | None: ... has_location: bool def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder diff --git a/stdlib/_ssl.pyi b/stdlib/_ssl.pyi index 938135eb1192..1a068b997539 100644 --- a/stdlib/_ssl.pyi +++ b/stdlib/_ssl.pyi @@ -12,7 +12,7 @@ from ssl import ( SSLWantWriteError as SSLWantWriteError, SSLZeroReturnError as SSLZeroReturnError, ) -from typing import Any, Literal, TypedDict, final, overload +from typing import Any, ClassVar, Literal, TypedDict, final, overload from typing_extensions import NotRequired, Self, TypeAlias _PasswordType: TypeAlias = Callable[[], str | bytes | bytearray] | str | bytes | bytearray @@ -119,6 +119,7 @@ class MemoryBIO: @final class SSLSession: + __hash__: ClassVar[None] # type: ignore[assignment] @property def has_ticket(self) -> bool: ... @property diff --git a/stdlib/_weakrefset.pyi b/stdlib/_weakrefset.pyi index 2a4e682f64ed..b55318528208 100644 --- a/stdlib/_weakrefset.pyi +++ b/stdlib/_weakrefset.pyi @@ -1,6 +1,6 @@ import sys from collections.abc import Iterable, Iterator, MutableSet -from typing import Any, TypeVar, overload +from typing import Any, ClassVar, TypeVar, overload from typing_extensions import Self if sys.version_info >= (3, 9): @@ -21,6 +21,7 @@ class WeakSet(MutableSet[_T]): def copy(self) -> Self: ... def remove(self, item: _T) -> None: ... def update(self, other: Iterable[_T]) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __contains__(self, item: object) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 365617077f09..7ed10d07ff36 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import sentinel from collections.abc import Callable, Generator, Iterable, Sequence from re import Pattern -from typing import IO, Any, Final, Generic, NewType, NoReturn, Protocol, TypeVar, overload +from typing import IO, Any, ClassVar, Final, Generic, NewType, NoReturn, Protocol, TypeVar, overload from typing_extensions import Self, TypeAlias, deprecated __all__ = [ @@ -456,6 +456,7 @@ class Namespace(_AttributeHolder): def __setattr__(self, name: str, value: Any, /) -> None: ... def __contains__(self, key: str) -> bool: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] class FileType: # undocumented diff --git a/stdlib/array.pyi b/stdlib/array.pyi index 0cdd651f9ad5..19ec8c1e78f9 100644 --- a/stdlib/array.pyi +++ b/stdlib/array.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite from collections.abc import Iterable # pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence -from typing import Any, Literal, MutableSequence, SupportsIndex, TypeVar, overload # noqa: Y022 +from typing import Any, ClassVar, Literal, MutableSequence, SupportsIndex, TypeVar, overload # noqa: Y022 from typing_extensions import Self, TypeAlias if sys.version_info >= (3, 12): @@ -64,6 +64,7 @@ class array(MutableSequence[_T]): def fromstring(self, buffer: str | ReadableBuffer, /) -> None: ... def tostring(self) -> bytes: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __len__(self) -> int: ... @overload def __getitem__(self, key: SupportsIndex, /) -> _T: ... diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 2d136318813c..0f99b5c3c67e 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -1,7 +1,7 @@ import sys from _collections_abc import dict_items, dict_keys, dict_values from _typeshed import SupportsItems, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT -from typing import Any, Generic, NoReturn, SupportsIndex, TypeVar, final, overload +from typing import Any, ClassVar, Generic, NoReturn, SupportsIndex, TypeVar, final, overload from typing_extensions import Self if sys.version_info >= (3, 9): @@ -119,6 +119,7 @@ class UserList(MutableSequence[_T]): def __init__(self, initlist: None = None) -> None: ... @overload def __init__(self, initlist: Iterable[_T]) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ... def __le__(self, other: list[_T] | UserList[_T]) -> bool: ... def __gt__(self, other: list[_T] | UserList[_T]) -> bool: ... @@ -254,6 +255,7 @@ class deque(MutableSequence[_T]): def rotate(self, n: int = 1, /) -> None: ... def __copy__(self) -> Self: ... def __len__(self) -> int: ... + __hash__: ClassVar[None] # type: ignore[assignment] # These methods of deque don't take slices, unlike MutableSequence, hence the type: ignores def __getitem__(self, key: SupportsIndex, /) -> _T: ... # type: ignore[override] def __setitem__(self, key: SupportsIndex, value: _T, /) -> None: ... # type: ignore[override] diff --git a/stdlib/email/charset.pyi b/stdlib/email/charset.pyi index 2939192c9526..683daa468cf3 100644 --- a/stdlib/email/charset.pyi +++ b/stdlib/email/charset.pyi @@ -1,6 +1,6 @@ from collections.abc import Callable, Iterator from email.message import Message -from typing import Final, overload +from typing import ClassVar, Final, overload __all__ = ["Charset", "add_alias", "add_charset", "add_codec"] @@ -24,6 +24,7 @@ class Charset: def body_encode(self, string: None) -> None: ... @overload def body_encode(self, string: str | bytes) -> str: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... def __ne__(self, value: object, /) -> bool: ... diff --git a/stdlib/email/header.pyi b/stdlib/email/header.pyi index 212132c6be18..a26bbb516e09 100644 --- a/stdlib/email/header.pyi +++ b/stdlib/email/header.pyi @@ -1,6 +1,6 @@ from collections.abc import Iterable from email.charset import Charset -from typing import Any +from typing import Any, ClassVar __all__ = ["Header", "decode_header", "make_header"] @@ -16,6 +16,7 @@ class Header: ) -> None: ... def append(self, s: bytes | bytearray | str, charset: Charset | str | None = None, errors: str = "strict") -> None: ... def encode(self, splitchars: str = ";, \t", maxlinelen: int | None = None, linesep: str = "\n") -> str: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... def __ne__(self, value: object, /) -> bool: ... diff --git a/stdlib/email/headerregistry.pyi b/stdlib/email/headerregistry.pyi index 2ffdca9b2f22..dc641c8c952b 100644 --- a/stdlib/email/headerregistry.pyi +++ b/stdlib/email/headerregistry.pyi @@ -167,6 +167,7 @@ class Address: def __init__( self, display_name: str = "", username: str | None = "", domain: str | None = "", addr_spec: str | None = None ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... class Group: @@ -175,4 +176,5 @@ class Group: @property def addresses(self) -> tuple[Address, ...]: ... def __init__(self, display_name: str | None = None, addresses: Iterable[Address] | None = None) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... diff --git a/stdlib/fractions.pyi b/stdlib/fractions.pyi index 33bc766df15d..aaa3a22087fc 100644 --- a/stdlib/fractions.pyi +++ b/stdlib/fractions.pyi @@ -138,7 +138,7 @@ class Fraction(Rational): def __round__(self, ndigits: None = None) -> int: ... @overload def __round__(self, ndigits: int) -> Fraction: ... - def __hash__(self) -> int: ... + def __hash__(self) -> int: ... # type: ignore[override] def __eq__(a, b: object) -> bool: ... def __lt__(a, b: _ComparableNum) -> bool: ... def __gt__(a, b: _ComparableNum) -> bool: ... diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index 8b408e8426cc..c6836c837eaa 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -416,6 +416,7 @@ class BoundArguments: def __init__(self, signature: Signature, arguments: OrderedDict[str, Any]) -> None: ... def apply_defaults(self) -> None: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] # # Classes and functions diff --git a/stdlib/lib2to3/pgen2/pgen.pyi b/stdlib/lib2to3/pgen2/pgen.pyi index 6d9f776c61ae..5776d100d1da 100644 --- a/stdlib/lib2to3/pgen2/pgen.pyi +++ b/stdlib/lib2to3/pgen2/pgen.pyi @@ -1,6 +1,6 @@ from _typeshed import Incomplete, StrPath from collections.abc import Iterable, Iterator -from typing import IO, NoReturn, overload +from typing import IO, ClassVar, NoReturn, overload from . import grammar from .tokenize import _TokenInfo @@ -46,5 +46,6 @@ class DFAState: def addarc(self, next: DFAState, label: str) -> None: ... def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override] + __hash__: ClassVar[None] # type: ignore[assignment] def generate_grammar(filename: StrPath = "Grammar.txt") -> PgenGrammar: ... diff --git a/stdlib/lib2to3/pytree.pyi b/stdlib/lib2to3/pytree.pyi index 138333bd58af..51bdbc75e142 100644 --- a/stdlib/lib2to3/pytree.pyi +++ b/stdlib/lib2to3/pytree.pyi @@ -1,7 +1,7 @@ from _typeshed import Incomplete, SupportsGetItem, SupportsLenAndGetItem, Unused from abc import abstractmethod from collections.abc import Iterable, Iterator, MutableSequence -from typing import Final +from typing import ClassVar, Final from typing_extensions import Self, TypeAlias from .fixer_base import BaseFix @@ -24,6 +24,7 @@ class Base: was_changed: bool was_checked: bool def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] @abstractmethod def _eq(self, other: Base) -> bool: ... @abstractmethod diff --git a/stdlib/numbers.pyi b/stdlib/numbers.pyi index e129de2cdc67..f2bca4e58bc5 100644 --- a/stdlib/numbers.pyi +++ b/stdlib/numbers.pyi @@ -9,7 +9,7 @@ from _typeshed import Incomplete from abc import ABCMeta, abstractmethod -from typing import Literal, Protocol, overload +from typing import ClassVar, Literal, Protocol, overload __all__ = ["Number", "Complex", "Real", "Rational", "Integral"] @@ -102,6 +102,7 @@ class Complex(Number, _ComplexLike): def conjugate(self) -> _ComplexLike: ... @abstractmethod def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] # See comment at the top of the file # for why some of these return types are purposefully vague diff --git a/stdlib/optparse.pyi b/stdlib/optparse.pyi index 1aa17c5c3674..5c70548f9d49 100644 --- a/stdlib/optparse.pyi +++ b/stdlib/optparse.pyi @@ -2,7 +2,7 @@ import builtins from _typeshed import Incomplete, MaybeNone from abc import abstractmethod from collections.abc import Callable, Iterable, Mapping, Sequence -from typing import IO, Any, AnyStr, Literal, NoReturn, overload +from typing import IO, Any, AnyStr, ClassVar, Literal, NoReturn, overload from typing_extensions import Self __all__ = [ @@ -216,6 +216,7 @@ class Values: def ensure_value(self, attr: str, value): ... def read_file(self, filename: str, mode: str = "careful") -> None: ... def read_module(self, modname: str, mode: str = "careful") -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] # __getattr__ doesn't exist, but anything passed as a default to __init__ # is set on the instance. def __getattr__(self, name: str): ... diff --git a/stdlib/parser.pyi b/stdlib/parser.pyi index bafc8015fed9..26140c76248a 100644 --- a/stdlib/parser.pyi +++ b/stdlib/parser.pyi @@ -1,7 +1,7 @@ from _typeshed import StrOrBytesPath from collections.abc import Sequence from types import CodeType -from typing import Any, final +from typing import Any, ClassVar, final def expr(source: str) -> STType: ... def suite(source: str) -> STType: ... @@ -17,6 +17,7 @@ class ParserError(Exception): ... @final class STType: + __hash__: ClassVar[None] # type: ignore[assignment] def compile(self, filename: StrOrBytesPath = ...) -> CodeType: ... def isexpr(self) -> bool: ... def issuite(self) -> bool: ... diff --git a/stdlib/plistlib.pyi b/stdlib/plistlib.pyi index 09637673ce21..72b5398f0a52 100644 --- a/stdlib/plistlib.pyi +++ b/stdlib/plistlib.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer from collections.abc import Mapping, MutableMapping from datetime import datetime from enum import Enum -from typing import IO, Any +from typing import IO, Any, ClassVar from typing_extensions import Self __all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"] @@ -100,6 +100,7 @@ if sys.version_info < (3, 9): class Data: data: bytes def __init__(self, data: bytes) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] class UID: data: int diff --git a/stdlib/sched.pyi b/stdlib/sched.pyi index ace501430847..52f87ab68ff5 100644 --- a/stdlib/sched.pyi +++ b/stdlib/sched.pyi @@ -1,6 +1,6 @@ import sys from collections.abc import Callable -from typing import Any, NamedTuple, type_check_only +from typing import Any, ClassVar, NamedTuple, type_check_only from typing_extensions import TypeAlias __all__ = ["scheduler"] @@ -25,7 +25,8 @@ else: argument: tuple[Any, ...] kwargs: dict[str, Any] - class Event(_EventBase): ... + class Event(_EventBase): + __hash__: ClassVar[None] # type: ignore[assignment] class scheduler: timefunc: Callable[[], float] diff --git a/stdlib/select.pyi b/stdlib/select.pyi index 67203905ab66..aad6d951ff44 100644 --- a/stdlib/select.pyi +++ b/stdlib/select.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import FileDescriptorLike from collections.abc import Iterable from types import TracebackType -from typing import Any, final +from typing import Any, ClassVar, final from typing_extensions import Self if sys.platform != "win32": @@ -53,6 +53,7 @@ if sys.platform != "linux" and sys.platform != "win32": data: Any = ..., udata: Any = ..., ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] # BSD only @final diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index a9ec97c45b40..1550f0ac81fe 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -5,7 +5,7 @@ from collections.abc import Callable, Iterable, Mapping, Sequence from tkinter.constants import * from tkinter.font import _FontDescription from types import TracebackType -from typing import Any, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only +from typing import Any, ClassVar, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated if sys.version_info >= (3, 11): @@ -330,6 +330,7 @@ class Variable: def trace_vinfo(self): ... def __eq__(self, other: object) -> bool: ... def __del__(self) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] class StringVar(Variable): def __init__(self, master: Misc | None = None, value: str | None = None, name: str | None = None) -> None: ... diff --git a/stdlib/tkinter/font.pyi b/stdlib/tkinter/font.pyi index 303d65bdc704..3b73f982c4ca 100644 --- a/stdlib/tkinter/font.pyi +++ b/stdlib/tkinter/font.pyi @@ -58,6 +58,7 @@ class Font: underline: bool = ..., overstrike: bool = ..., ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __setitem__(self, key: str, value: Any) -> None: ... @overload def cget(self, option: Literal["family"]) -> str: ... diff --git a/stdlib/traceback.pyi b/stdlib/traceback.pyi index 53028a2d8510..4f132d51c617 100644 --- a/stdlib/traceback.pyi +++ b/stdlib/traceback.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import SupportsWrite, Unused from collections.abc import Generator, Iterable, Iterator, Mapping from types import FrameType, TracebackType -from typing import Any, Literal, overload +from typing import Any, ClassVar, Literal, overload from typing_extensions import Self, TypeAlias, deprecated __all__ = [ @@ -229,6 +229,7 @@ class TracebackException: ) -> Self: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 11): def format(self, *, chain: bool = True, _ctx: _ExceptionPrintContext | None = None) -> Generator[str, None, None]: ... else: @@ -292,6 +293,7 @@ class FrameSummary: def __iter__(self) -> Iterator[Any]: ... def __eq__(self, other: object) -> bool: ... def __len__(self) -> Literal[4]: ... + __hash__: ClassVar[None] # type: ignore[assignment] class StackSummary(list[FrameSummary]): @classmethod diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index eb8ac16941a6..0ba6a4ecb022 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -257,6 +257,7 @@ if sys.version_info >= (3, 10): def __init__(self, origin: ParamSpec) -> None: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] @final class ParamSpecKwargs: @@ -268,6 +269,7 @@ if sys.version_info >= (3, 10): def __init__(self, origin: ParamSpec) -> None: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] @final class ParamSpec: diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 193a4123c395..4b32f15095d6 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -2,7 +2,7 @@ import sys from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, Sequence from contextlib import _GeneratorContextManager from types import TracebackType -from typing import Any, Final, Generic, Literal, TypeVar, overload +from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload from typing_extensions import ParamSpec, Self, TypeAlias _T = TypeVar("_T") @@ -85,6 +85,7 @@ class _Call(tuple[Any, ...]): two: bool = False, from_kall: bool = True, ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... def __ne__(self, value: object, /) -> bool: ... def __call__(self, *args: Any, **kwargs: Any) -> _Call: ... @@ -403,6 +404,7 @@ class MagicProxy(Base): class _ANY: def __eq__(self, other: object) -> Literal[True]: ... def __ne__(self, other: object) -> Literal[False]: ... + __hash__: ClassVar[None] # type: ignore[assignment] ANY: Any diff --git a/stdlib/unittest/suite.pyi b/stdlib/unittest/suite.pyi index ff583d0766a0..443396164b6f 100644 --- a/stdlib/unittest/suite.pyi +++ b/stdlib/unittest/suite.pyi @@ -1,6 +1,7 @@ import unittest.case import unittest.result from collections.abc import Iterable, Iterator +from typing import ClassVar from typing_extensions import TypeAlias _TestType: TypeAlias = unittest.case.TestCase | TestSuite @@ -17,6 +18,7 @@ class BaseTestSuite: def countTestCases(self) -> int: ... def __iter__(self) -> Iterator[_TestType]: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] class TestSuite(BaseTestSuite): def run(self, result: unittest.result.TestResult, debug: bool = False) -> unittest.result.TestResult: ... diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index e7dfcf7d7743..05a7b2bcda66 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -3,7 +3,7 @@ from _typeshed import SupportsKeysAndGetItem from _weakref import getweakrefcount as getweakrefcount, getweakrefs as getweakrefs, proxy as proxy from _weakrefset import WeakSet as WeakSet from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping -from typing import Any, Generic, TypeVar, final, overload +from typing import Any, ClassVar, Generic, TypeVar, final, overload from typing_extensions import ParamSpec, Self if sys.version_info >= (3, 9): @@ -47,11 +47,13 @@ class CallableProxyType(Generic[_CallableT]): # "weakcallableproxy" def __eq__(self, value: object, /) -> bool: ... def __getattr__(self, attr: str) -> Any: ... __call__: _CallableT + __hash__: ClassVar[None] # type: ignore[assignment] @final class ProxyType(Generic[_T]): # "weakproxy" def __eq__(self, value: object, /) -> bool: ... def __getattr__(self, attr: str) -> Any: ... + __hash__: ClassVar[None] # type: ignore[assignment] class ReferenceType(Generic[_T]): # "weakref" __callback__: Callable[[Self], Any] diff --git a/stdlib/xml/dom/minidom.pyi b/stdlib/xml/dom/minidom.pyi index fae2c4d98714..4eda3897a00c 100644 --- a/stdlib/xml/dom/minidom.pyi +++ b/stdlib/xml/dom/minidom.pyi @@ -1,7 +1,7 @@ import sys import xml.dom from _typeshed import Incomplete, ReadableBuffer, SupportsRead, SupportsWrite -from typing import Literal, NoReturn, TypeVar, overload +from typing import ClassVar, Literal, NoReturn, TypeVar, overload from typing_extensions import Self from xml.dom.minicompat import NodeList from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS @@ -151,6 +151,7 @@ class NamedNodeMap: def keysNS(self): ... def values(self): ... def get(self, name: str, value: Incomplete | None = None): ... + __hash__: ClassVar[None] # type: ignore[assignment] def __len__(self) -> int: ... def __eq__(self, other: object) -> bool: ... def __ge__(self, other: NamedNodeMap) -> bool: ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 8a306927bb1f..6cc4361f4a09 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -6,7 +6,7 @@ from collections.abc import Callable, Iterable, Mapping from datetime import datetime from io import BytesIO from types import TracebackType -from typing import Any, Final, Literal, Protocol, overload +from typing import Any, ClassVar, Final, Literal, Protocol, overload from typing_extensions import Self, TypeAlias class _SupportsTimeTuple(Protocol): @@ -76,6 +76,7 @@ def _strftime(value: _XMLDate) -> str: ... # undocumented class DateTime: value: str # undocumented def __init__(self, value: int | str | datetime | time.struct_time | tuple[int, ...] = 0) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __lt__(self, other: _DateTimeComparable) -> bool: ... def __le__(self, other: _DateTimeComparable) -> bool: ... def __gt__(self, other: _DateTimeComparable) -> bool: ... @@ -95,6 +96,7 @@ class Binary: def decode(self, data: ReadableBuffer) -> None: ... def encode(self, out: SupportsWrite[str]) -> None: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] def _binary(data: ReadableBuffer) -> Binary: ... # undocumented diff --git a/stdlib/xxlimited.pyi b/stdlib/xxlimited.pyi index 6bae87a8db2a..78a50b85f405 100644 --- a/stdlib/xxlimited.pyi +++ b/stdlib/xxlimited.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, final +from typing import Any, ClassVar, final class Str(str): ... @@ -17,6 +17,8 @@ if sys.version_info >= (3, 10): else: class error(Exception): ... - class Null: ... + + class Null: + __hash__: ClassVar[None] # type: ignore[assignment] def roj(b: Any, /) -> None: ... diff --git a/stubs/openpyxl/openpyxl/styles/cell_style.pyi b/stubs/openpyxl/openpyxl/styles/cell_style.pyi index cc97daf6abdc..c1867a7b356f 100644 --- a/stubs/openpyxl/openpyxl/styles/cell_style.pyi +++ b/stubs/openpyxl/openpyxl/styles/cell_style.pyi @@ -31,7 +31,7 @@ class StyleArray(array[int]): xfId: ArrayDescriptor[int] def __new__(cls, args: bytes | bytearray | Iterable[int] = [0, 0, 0, 0, 0, 0, 0, 0, 0]) -> Self: ... def __init__(self, args: bytes | bytearray | Iterable[int] = [0, 0, 0, 0, 0, 0, 0, 0, 0]) -> None: ... - def __hash__(self) -> int: ... + def __hash__(self) -> int: ... # type: ignore[override] def __copy__(self) -> StyleArray: ... def __deepcopy__(self, memo: Unused) -> StyleArray: ...