Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
From d3dabcf7b7aaf0997b59f0a28bb41d17b6098f2c Mon Sep 17 00:00:00 2001
From b5d1e4c76d8139e1a20f9178e8123f3ee39084d2 Mon Sep 17 00:00:00 2001
From: Marc Mueller <30130371+cdce8p@users.noreply.github.com>
Date: Sat, 21 Dec 2024 22:36:38 +0100
Subject: [PATCH] Revert Remove redundant inheritances from Iterator in
Expand All @@ -15,7 +15,7 @@ Subject: [PATCH] Revert Remove redundant inheritances from Iterator in
7 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/mypy/typeshed/stdlib/_asyncio.pyi b/mypy/typeshed/stdlib/_asyncio.pyi
index 23b690a9c..0ce93a435 100644
index 242093e1e..92bb4e5f4 100644
--- a/mypy/typeshed/stdlib/_asyncio.pyi
+++ b/mypy/typeshed/stdlib/_asyncio.pyi
@@ -1,6 +1,6 @@
Expand All @@ -36,10 +36,10 @@ index 23b690a9c..0ce93a435 100644
@property
def _exception(self) -> BaseException | None: ...
diff --git a/mypy/typeshed/stdlib/builtins.pyi b/mypy/typeshed/stdlib/builtins.pyi
index 1808e28e2..9db6f4fc7 100644
index e63b74214..9ea382dd6 100644
--- a/mypy/typeshed/stdlib/builtins.pyi
+++ b/mypy/typeshed/stdlib/builtins.pyi
@@ -1369,7 +1369,7 @@ class frozenset(AbstractSet[_T_co]):
@@ -1368,7 +1368,7 @@ class frozenset(AbstractSet[_T_co]):
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...

@disjoint_base
Expand All @@ -48,7 +48,7 @@ index 1808e28e2..9db6f4fc7 100644
def __new__(cls, iterable: Iterable[_T], start: int = 0) -> Self: ...
def __iter__(self) -> Self: ...
def __next__(self) -> tuple[int, _T]: ...
@@ -1635,7 +1635,7 @@ else:
@@ -1634,7 +1634,7 @@ else:
exit: _sitebuiltins.Quitter

@disjoint_base
Expand All @@ -57,7 +57,7 @@ index 1808e28e2..9db6f4fc7 100644
@overload
def __new__(cls, function: None, iterable: Iterable[_T | None], /) -> Self: ...
@overload
@@ -1706,7 +1706,7 @@ license: _sitebuiltins._Printer
@@ -1705,7 +1705,7 @@ license: _sitebuiltins._Printer
def locals() -> dict[str, Any]: ...

@disjoint_base
Expand All @@ -66,7 +66,7 @@ index 1808e28e2..9db6f4fc7 100644
# 3.14 adds `strict` argument.
if sys.version_info >= (3, 14):
@overload
@@ -2022,7 +2022,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
@@ -2021,7 +2021,7 @@ def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex
quit: _sitebuiltins.Quitter

@disjoint_base
Expand All @@ -75,7 +75,7 @@ index 1808e28e2..9db6f4fc7 100644
@overload
def __new__(cls, sequence: Reversible[_T], /) -> Iterator[_T]: ... # type: ignore[misc]
@overload
@@ -2100,7 +2100,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
@@ -2101,7 +2101,7 @@ def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
def vars(object: Any = ..., /) -> dict[str, Any]: ...

@disjoint_base
Expand Down Expand Up @@ -131,10 +131,10 @@ index 37783254c..db9c228f5 100644
@overload
def __init__(
diff --git a/mypy/typeshed/stdlib/itertools.pyi b/mypy/typeshed/stdlib/itertools.pyi
index d26a4e1da..9d1cd84da 100644
index 60e79bc2e..fd7daf11e 100644
--- a/mypy/typeshed/stdlib/itertools.pyi
+++ b/mypy/typeshed/stdlib/itertools.pyi
@@ -28,7 +28,7 @@ _Predicate: TypeAlias = Callable[[_T], object]
@@ -28,7 +28,7 @@ _Predicate = Callable[[_T], object]
# Technically count can take anything that implements a number protocol and has an add method
# but we can't enforce the add method
@disjoint_base
Expand Down Expand Up @@ -295,13 +295,13 @@ index d26a4e1da..9d1cd84da 100644
@overload
def __new__(cls, iterable: Iterable[_T], n: Literal[1], *, strict: Literal[True]) -> batched[tuple[_T]]: ...
diff --git a/mypy/typeshed/stdlib/multiprocessing/pool.pyi b/mypy/typeshed/stdlib/multiprocessing/pool.pyi
index b79f9e773..f276372d0 100644
index 5642e50d0..203c5887c 100644
--- a/mypy/typeshed/stdlib/multiprocessing/pool.pyi
+++ b/mypy/typeshed/stdlib/multiprocessing/pool.pyi
@@ -1,4 +1,4 @@
-from collections.abc import Callable, Iterable, Mapping
+from collections.abc import Callable, Iterable, Iterator, Mapping
from multiprocessing.context import DefaultContext, Process
from multiprocessing.context import DefaultContext, Process as _Process
from types import GenericAlias, TracebackType
from typing import Any, Final, Generic, TypeVar
@@ -32,7 +32,7 @@ class MapResult(ApplyResult[list[_T]]):
Expand All @@ -314,10 +314,10 @@ index b79f9e773..f276372d0 100644
def __iter__(self) -> Self: ...
def next(self, timeout: float | None = None) -> _T: ...
diff --git a/mypy/typeshed/stdlib/sqlite3/__init__.pyi b/mypy/typeshed/stdlib/sqlite3/__init__.pyi
index 7c033bdf4..7bf020558 100644
index 80a02079d..d1065a509 100644
--- a/mypy/typeshed/stdlib/sqlite3/__init__.pyi
+++ b/mypy/typeshed/stdlib/sqlite3/__init__.pyi
@@ -426,7 +426,7 @@ class Connection:
@@ -437,7 +437,7 @@ class Connection:
) -> Literal[False]: ...

@disjoint_base
Expand All @@ -327,5 +327,5 @@ index 7c033bdf4..7bf020558 100644
@property
def connection(self) -> Connection: ...
--
2.54.0
2.55.0

2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/_asyncio.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ else:
# since the only reason why `asyncio.Future` is invariant is the `set_result()` method,
# and `asyncio.Task.set_result()` always raises.
@disjoint_base
class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments]
class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-generic-class]
if sys.version_info >= (3, 12):
def __init__(
self,
Expand Down
8 changes: 4 additions & 4 deletions mypy/typeshed/stdlib/_curses_panel.pyi
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from _curses import window
from _curses import window as _window
from typing import Final, final

__version__: Final[str]
Expand All @@ -14,14 +14,14 @@ class panel:
def hidden(self) -> bool: ...
def hide(self) -> None: ...
def move(self, y: int, x: int, /) -> None: ...
def replace(self, win: window, /) -> None: ...
def replace(self, win: _window, /) -> None: ...
def set_userptr(self, obj: object, /) -> None: ...
def show(self) -> None: ...
def top(self) -> None: ...
def userptr(self) -> object: ...
def window(self) -> window: ...
def window(self) -> _window: ...

def bottom_panel() -> panel: ...
def new_panel(win: window, /) -> panel: ...
def new_panel(win: _window, /) -> panel: ...
def top_panel() -> panel: ...
def update_panels() -> panel: ...
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/asyncio/base_events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ from asyncio.transports import BaseTransport, DatagramTransport, ReadTransport,
from collections.abc import Callable, Iterable, Sequence
from concurrent.futures import Executor, ThreadPoolExecutor
from contextvars import Context
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
from socket import AddressFamily, AddressInfo, _Address, _GetAddrInfoResult, _RetAddress, socket
from typing import IO, Any, Literal, TypeAlias, TypeVar, overload
from typing_extensions import TypeVarTuple, Unpack

Expand Down Expand Up @@ -115,7 +115,7 @@ class BaseEventLoop(AbstractEventLoop):
type: int = 0,
proto: int = 0,
flags: int = 0,
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]: ...
) -> _GetAddrInfoResult: ...
async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ...

if sys.version_info >= (3, 12):
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/asyncio/events.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from abc import ABCMeta, abstractmethod
from collections.abc import Callable, Sequence
from concurrent.futures import Executor
from contextvars import Context
from socket import AddressFamily, AddressInfo, SocketKind, _Address, _RetAddress, socket
from socket import AddressFamily, AddressInfo, _Address, _GetAddrInfoResult, _RetAddress, socket
from typing import IO, Any, Literal, Protocol, TypeAlias, TypeVar, overload, type_check_only
from typing_extensions import Self, TypeVarTuple, Unpack, deprecated

Expand Down Expand Up @@ -205,7 +205,7 @@ class AbstractEventLoop:
type: int = 0,
proto: int = 0,
flags: int = 0,
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]: ...
) -> _GetAddrInfoResult: ...
@abstractmethod
async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ...

Expand Down
6 changes: 3 additions & 3 deletions mypy/typeshed/stdlib/collections/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -364,17 +364,17 @@ class _OrderedDictValuesView(ValuesView[_VT_co]):
# pyright doesn't have a specific error code for subclassing error!
@final
@type_check_only
class _odict_keys(dict_keys[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
class _odict_keys(dict_keys[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class]
def __reversed__(self) -> Iterator[_KT_co]: ...

@final
@type_check_only
class _odict_items(dict_items[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
class _odict_items(dict_items[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class]
def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ...

@final
@type_check_only
class _odict_values(dict_values[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
class _odict_values(dict_values[_KT_co, _VT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[subclass-of-final-class]
def __reversed__(self) -> Iterator[_VT_co]: ...

@disjoint_base
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/contextlib.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ _CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any, Any] | _ExitFunc)
# At runtime it inherits from ABC and is not a Protocol, but it is on the
# allowlist for use as a Protocol.
@runtime_checkable
class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol]
__slots__ = ()
def __enter__(self) -> _T_co: ...
@abstractmethod
Expand All @@ -55,7 +55,7 @@ class AbstractContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[m
# At runtime it inherits from ABC and is not a Protocol, but it is on the
# allowlist for use as a Protocol.
@runtime_checkable
class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol]
__slots__ = ()
async def __aenter__(self) -> _T_co: ...
@abstractmethod
Expand Down
12 changes: 8 additions & 4 deletions mypy/typeshed/stdlib/dataclasses.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ def fields(class_or_instance: DataclassInstance | type[DataclassInstance]) -> tu

# HACK: `obj: Never` typing matches if object argument is using `Any` type.
@overload
def is_dataclass(obj: Never) -> TypeIs[DataclassInstance | type[DataclassInstance]]: ... # type: ignore[narrowed-type-not-subtype] # pyright: ignore[reportGeneralTypeIssues]
def is_dataclass(obj: Never) -> TypeIs[DataclassInstance | type[DataclassInstance]]: ... # type: ignore[narrowed-type-not-subtype] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-type-guard-definition]
@overload
def is_dataclass(obj: type) -> TypeIs[type[DataclassInstance]]: ...
@overload
Expand All @@ -308,13 +308,17 @@ class FrozenInstanceError(AttributeError): ...

class InitVar(Generic[_T]):
__slots__ = ("type",)
type: Type[_T]
type: Type[_T] # ty:ignore[unbound-type-variable]
def __init__(self, type: Type[_T]) -> None: ...

@overload
def __class_getitem__(cls, type: Type[_T]) -> InitVar[_T]: ... # pyright: ignore[reportInvalidTypeForm]
def __class_getitem__(
cls, type: Type[_T]
) -> InitVar[_T]: ... # pyright: ignore[reportInvalidTypeForm] # ty:ignore[invalid-type-form]
@overload
def __class_getitem__(cls, type: Any) -> InitVar[Any]: ... # pyright: ignore[reportInvalidTypeForm]
def __class_getitem__(
cls, type: Any
) -> InitVar[Any]: ... # pyright: ignore[reportInvalidTypeForm] # ty:ignore[invalid-type-form]

if sys.version_info >= (3, 14):
def make_dataclass(
Expand Down
5 changes: 3 additions & 2 deletions mypy/typeshed/stdlib/multiprocessing/managers.pyi
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import builtins
import queue
import sys
import threading
Expand Down Expand Up @@ -359,9 +360,9 @@ class SyncManager(BaseManager):
@overload
def dict(self, iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT) -> DictProxy[str, _VT]: ...
@overload
def dict(self, iterable: Iterable[list[str]], /) -> DictProxy[str, str]: ...
def dict(self, iterable: Iterable[builtins.list[str]], /) -> DictProxy[str, str]: ...
@overload
def dict(self, iterable: Iterable[list[bytes]], /) -> DictProxy[bytes, bytes]: ...
def dict(self, iterable: Iterable[builtins.list[bytes]], /) -> DictProxy[bytes, bytes]: ...

# Overloads are copied from builtins.list.__init__
@overload
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/multiprocessing/pool.pyi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Callable, Iterable, Iterator, Mapping
from multiprocessing.context import DefaultContext, Process
from multiprocessing.context import DefaultContext, Process as _Process
from types import GenericAlias, TracebackType
from typing import Any, Final, Generic, TypeVar
from typing_extensions import Self
Expand Down Expand Up @@ -50,7 +50,7 @@ class Pool:
context: Any | None = None,
) -> None: ...
@staticmethod
def Process(ctx: DefaultContext, *args: Any, **kwds: Any) -> Process: ...
def Process(ctx: DefaultContext, *args: Any, **kwds: Any) -> _Process: ...
def apply(self, func: Callable[..., _T], args: Iterable[Any] = (), kwds: Mapping[str, Any] = {}) -> _T: ...
def apply_async(
self,
Expand Down
2 changes: 1 addition & 1 deletion mypy/typeshed/stdlib/os/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -940,7 +940,7 @@ In the future, this property will contain the last metadata change time.""")
# At runtime it inherits from ABC and is not a Protocol, but it will be
# on the allowlist for use as a Protocol starting in 3.14.
@runtime_checkable
class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
class PathLike(ABC, Protocol[AnyStr_co]): # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # ty:ignore[invalid-protocol]
__slots__ = ()
@abstractmethod
def __fspath__(self) -> AnyStr_co: ...
Expand Down
4 changes: 2 additions & 2 deletions mypy/typeshed/stdlib/platform.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ if sys.version_info >= (3, 12):

def __new__(_cls, system: str, node: str, release: str, version: str, machine: str) -> Self: ...
@property
def processor(self) -> str: ...
def processor(self) -> str: ... # ty:ignore[invalid-named-tuple-override]

else:
@disjoint_base
class uname_result(_uname_result_base):
__match_args__ = ("system", "node", "release", "version", "machine") # pyright: ignore[reportAssignmentType]
def __new__(_cls, system: str, node: str, release: str, version: str, machine: str) -> Self: ...
@property
def processor(self) -> str: ...
def processor(self) -> str: ... # ty:ignore[invalid-named-tuple-override]

def uname() -> uname_result: ...
def system() -> str: ...
Expand Down
9 changes: 7 additions & 2 deletions mypy/typeshed/stdlib/socket.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ from _typeshed import ReadableBuffer, Unused, WriteableBuffer
from collections.abc import Iterable
from enum import IntEnum, IntFlag
from io import BufferedReader, BufferedRWPair, BufferedWriter, IOBase, RawIOBase, TextIOWrapper
from typing import Any, Final, Literal, Protocol, SupportsIndex, overload, type_check_only
from typing import Any, Final, Literal, Protocol, SupportsIndex, TypeAlias, overload, type_check_only
from typing_extensions import Self

__all__ = [
Expand Down Expand Up @@ -1576,6 +1576,11 @@ def create_server(
) -> socket: ...

# The 5th tuple item is the socket address, for IP4, IP6, or IP6 if Python is compiled with --disable-ipv6, respectively.
_GetAddrInfoResult: TypeAlias = list[
tuple[Literal[AddressFamily.AF_INET], SocketKind, int, str, tuple[str, int]]
| tuple[Literal[AddressFamily.AF_INET6], SocketKind, int, str, tuple[str, int, int, int] | tuple[int, bytes]]
]

def getaddrinfo(
host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]: ...
) -> _GetAddrInfoResult: ...
31 changes: 21 additions & 10 deletions mypy/typeshed/stdlib/sqlite3/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -269,28 +269,39 @@ class OperationalError(DatabaseError): ...
class ProgrammingError(DatabaseError): ...
class Warning(Exception): ...

_DataError: TypeAlias = DataError
_DatabaseError: TypeAlias = DatabaseError
_Error: TypeAlias = Error
_IntegrityError: TypeAlias = IntegrityError
_InterfaceError: TypeAlias = InterfaceError
_InternalError: TypeAlias = InternalError
_NotSupportedError: TypeAlias = NotSupportedError
_OperationalError: TypeAlias = OperationalError
_ProgrammingError: TypeAlias = ProgrammingError
_Warning: TypeAlias = Warning

@disjoint_base
class Connection:
@property
def DataError(self) -> type[DataError]: ...
def DataError(self) -> type[_DataError]: ...
@property
def DatabaseError(self) -> type[DatabaseError]: ...
def DatabaseError(self) -> type[_DatabaseError]: ...
@property
def Error(self) -> type[Error]: ...
def Error(self) -> type[_Error]: ...
@property
def IntegrityError(self) -> type[IntegrityError]: ...
def IntegrityError(self) -> type[_IntegrityError]: ...
@property
def InterfaceError(self) -> type[InterfaceError]: ...
def InterfaceError(self) -> type[_InterfaceError]: ...
@property
def InternalError(self) -> type[InternalError]: ...
def InternalError(self) -> type[_InternalError]: ...
@property
def NotSupportedError(self) -> type[NotSupportedError]: ...
def NotSupportedError(self) -> type[_NotSupportedError]: ...
@property
def OperationalError(self) -> type[OperationalError]: ...
def OperationalError(self) -> type[_OperationalError]: ...
@property
def ProgrammingError(self) -> type[ProgrammingError]: ...
def ProgrammingError(self) -> type[_ProgrammingError]: ...
@property
def Warning(self) -> type[Warning]: ...
def Warning(self) -> type[_Warning]: ...
@property
def in_transaction(self) -> bool: ...
isolation_level: _IsolationLevel
Expand Down
Loading
Loading