Skip to content

Commit 63a19a5

Browse files
committed
Sync typeshed
Source commit: python/typeshed@554701e
1 parent f290350 commit 63a19a5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1239
-965
lines changed

mypy/typeshed/stdlib/_asyncio.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from asyncio.events import AbstractEventLoop
3-
from collections.abc import Awaitable, Callable, Coroutine, Generator, Iterable
3+
from collections.abc import Awaitable, Callable, Coroutine, Generator
44
from contextvars import Context
55
from types import FrameType, GenericAlias
66
from typing import Any, Literal, TextIO, TypeVar
@@ -10,7 +10,7 @@ _T = TypeVar("_T")
1010
_T_co = TypeVar("_T_co", covariant=True)
1111
_TaskYieldType: TypeAlias = Future[object] | None
1212

13-
class Future(Awaitable[_T], Iterable[_T]):
13+
class Future(Awaitable[_T]):
1414
_state: str
1515
@property
1616
def _exception(self) -> BaseException | None: ...

mypy/typeshed/stdlib/_contextvars.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Token(Generic[_T]):
3939
if sys.version_info >= (3, 14):
4040
def __enter__(self) -> Self: ...
4141
def __exit__(
42-
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None
42+
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
4343
) -> None: ...
4444

4545
def copy_context() -> Context: ...

mypy/typeshed/stdlib/_ctypes.pyi

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,11 @@ class Array(_CData, Generic[_CT], metaclass=_PyCArrayType):
294294
def _type_(self) -> type[_CT]: ...
295295
@_type_.setter
296296
def _type_(self, value: type[_CT]) -> None: ...
297-
raw: bytes # Note: only available if _CT == c_char
297+
# Note: only available if _CT == c_char
298+
@property
299+
def raw(self) -> bytes: ...
300+
@raw.setter
301+
def raw(self, value: ReadableBuffer) -> None: ...
298302
value: Any # Note: bytes if _CT == c_char, str if _CT == c_wchar, unavailable otherwise
299303
# TODO: These methods cannot be annotated correctly at the moment.
300304
# All of these "Any"s stand for the array's element type, but it's not possible to use _CT

mypy/typeshed/stdlib/_frozen_importlib.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ from _typeshed.importlib import LoaderProtocol
66
from collections.abc import Mapping, Sequence
77
from types import ModuleType
88
from typing import Any, ClassVar
9+
from typing_extensions import deprecated
910

1011
# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
1112
def __import__(
@@ -49,6 +50,7 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
4950
# MetaPathFinder
5051
if sys.version_info < (3, 12):
5152
@classmethod
53+
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
5254
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
5355

5456
@classmethod
@@ -67,6 +69,10 @@ class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader)
6769
# Loader
6870
if sys.version_info < (3, 12):
6971
@staticmethod
72+
@deprecated(
73+
"Deprecated since Python 3.4; removed in Python 3.12. "
74+
"The module spec is now used by the import machinery to generate a module repr."
75+
)
7076
def module_repr(module: types.ModuleType) -> str: ...
7177
if sys.version_info >= (3, 10):
7278
@staticmethod
@@ -83,6 +89,7 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
8389
# MetaPathFinder
8490
if sys.version_info < (3, 12):
8591
@classmethod
92+
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
8693
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
8794

8895
@classmethod
@@ -101,6 +108,10 @@ class FrozenImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader):
101108
# Loader
102109
if sys.version_info < (3, 12):
103110
@staticmethod
111+
@deprecated(
112+
"Deprecated since Python 3.4; removed in Python 3.12. "
113+
"The module spec is now used by the import machinery to generate a module repr."
114+
)
104115
def module_repr(m: types.ModuleType) -> str: ...
105116
if sys.version_info >= (3, 10):
106117
@staticmethod

mypy/typeshed/stdlib/_frozen_importlib_external.pyi

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ def spec_from_file_location(
4343
class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
4444
if sys.version_info < (3, 12):
4545
@classmethod
46+
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
4647
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
4748

4849
@classmethod
@@ -70,6 +71,7 @@ class PathFinder(importlib.abc.MetaPathFinder):
7071
) -> ModuleSpec | None: ...
7172
if sys.version_info < (3, 12):
7273
@classmethod
74+
@deprecated("Deprecated since Python 3.4; removed in Python 3.12. Use `find_spec()` instead.")
7375
def find_module(cls, fullname: str, path: Sequence[str] | None = None) -> importlib.abc.Loader | None: ...
7476

7577
SOURCE_SUFFIXES: list[str]
@@ -158,7 +160,10 @@ if sys.version_info >= (3, 11):
158160
def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
159161
if sys.version_info < (3, 12):
160162
@staticmethod
161-
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
163+
@deprecated(
164+
"Deprecated since Python 3.4; removed in Python 3.12. "
165+
"The module spec is now used by the import machinery to generate a module repr."
166+
)
162167
def module_repr(module: types.ModuleType) -> str: ...
163168

164169
_NamespaceLoader = NamespaceLoader
@@ -176,12 +181,18 @@ else:
176181
def load_module(self, fullname: str) -> types.ModuleType: ...
177182
if sys.version_info >= (3, 10):
178183
@staticmethod
179-
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
184+
@deprecated(
185+
"Deprecated since Python 3.4; removed in Python 3.12. "
186+
"The module spec is now used by the import machinery to generate a module repr."
187+
)
180188
def module_repr(module: types.ModuleType) -> str: ...
181189
def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
182190
else:
183191
@classmethod
184-
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
192+
@deprecated(
193+
"Deprecated since Python 3.4; removed in Python 3.12. "
194+
"The module spec is now used by the import machinery to generate a module repr."
195+
)
185196
def module_repr(cls, module: types.ModuleType) -> str: ...
186197

187198
if sys.version_info >= (3, 13):

mypy/typeshed/stdlib/_interpchannels.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ class ChannelID:
1717
def send(self) -> Self: ...
1818
@property
1919
def recv(self) -> Self: ...
20-
def __eq__(self, other: object) -> bool: ...
21-
def __ge__(self, other: ChannelID) -> bool: ...
22-
def __gt__(self, other: ChannelID) -> bool: ...
20+
def __eq__(self, other: object, /) -> bool: ...
21+
def __ge__(self, other: ChannelID, /) -> bool: ...
22+
def __gt__(self, other: ChannelID, /) -> bool: ...
2323
def __hash__(self) -> int: ...
2424
def __index__(self) -> int: ...
2525
def __int__(self) -> int: ...
26-
def __le__(self, other: ChannelID) -> bool: ...
27-
def __lt__(self, other: ChannelID) -> bool: ...
28-
def __ne__(self, other: object) -> bool: ...
26+
def __le__(self, other: ChannelID, /) -> bool: ...
27+
def __lt__(self, other: ChannelID, /) -> bool: ...
28+
def __ne__(self, other: object, /) -> bool: ...
2929

3030
@final
3131
class ChannelInfo(structseq[int], tuple[bool, bool, bool, int, int, int, int, int]):

mypy/typeshed/stdlib/_interpreters.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def exec(
3434
def call(
3535
id: SupportsIndex,
3636
callable: Callable[..., _R],
37-
args: tuple[object, ...] | None = None,
38-
kwargs: dict[str, object] | None = None,
37+
args: tuple[Any, ...] | None = None,
38+
kwargs: dict[str, Any] | None = None,
3939
*,
4040
restrict: bool = False,
4141
) -> tuple[_R, types.SimpleNamespace]: ...

0 commit comments

Comments
 (0)