Skip to content

Commit 6dc4f77

Browse files
committed
Updated typeshed to the latest version.
1 parent 390f1da commit 6dc4f77

File tree

616 files changed

+15891
-3799
lines changed

Some content is hidden

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

616 files changed

+15891
-3799
lines changed

packages/pyright-internal/typeshed-fallback/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ Typeshed supports Python versions 3.9 to 3.14.
2525

2626
## Using
2727

28-
If you're just using a type checker ([mypy](https://github.com/python/mypy/),
29-
[pyright](https://github.com/microsoft/pyright),
30-
[pytype](https://github.com/google/pytype/), PyCharm, ...), as opposed to
28+
If you're just using a type checker (e.g. [mypy](https://github.com/python/mypy/),
29+
[pyright](https://github.com/microsoft/pyright), or PyCharm's built-in type
30+
checker), as opposed to
3131
developing it, you don't need to interact with the typeshed repo at
3232
all: a copy of standard library part of typeshed is bundled with type checkers.
3333
And type stubs for third party packages and modules you are using can
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
07a59e924fd19fa6de45636498b8ca90649b996e
1+
6cae34647c8fa41060cd9de5a7de3ce6239b6b19

packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ compileall: 3.0-
124124
compression: 3.14-
125125
concurrent: 3.2-
126126
concurrent.futures.interpreter: 3.14-
127+
concurrent.interpreters: 3.14-
127128
configparser: 3.0-
128129
contextlib: 3.0-
129130
contextvars: 3.7-

packages/pyright-internal/typeshed-fallback/stdlib/_compression.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
from _typeshed import Incomplete, WriteableBuffer
44
from collections.abc import Callable
55
from io import DEFAULT_BUFFER_SIZE, BufferedIOBase, RawIOBase
6-
from typing import Any, Protocol
6+
from typing import Any, Protocol, type_check_only
77

88
BUFFER_SIZE = DEFAULT_BUFFER_SIZE
99

10+
@type_check_only
1011
class _Reader(Protocol):
1112
def read(self, n: int, /) -> bytes: ...
1213
def seekable(self) -> bool: ...

packages/pyright-internal/typeshed-fallback/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: ...

packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ class _SimpleCData(_CData, Generic[_T], metaclass=_PyCSimpleType):
103103
def __init__(self, value: _T = ...) -> None: ... # pyright: ignore[reportInvalidTypeVarUse]
104104
def __ctypes_from_outparam__(self, /) -> _T: ... # type: ignore[override]
105105

106+
@type_check_only
106107
class _CanCastTo(_CData): ...
108+
109+
@type_check_only
107110
class _PointerLike(_CanCastTo): ...
108111

109112
# This type is not exposed. It calls itself _ctypes.PyCPointerType.
@@ -114,7 +117,7 @@ class _PyCPointerType(_CTypeBaseType):
114117
def from_buffer_copy(self: type[_typeshed.Self], buffer: ReadableBuffer, offset: int = 0, /) -> _typeshed.Self: ...
115118
def from_param(self: type[_typeshed.Self], value: Any, /) -> _typeshed.Self | _CArgObject: ...
116119
def in_dll(self: type[_typeshed.Self], dll: CDLL, name: str, /) -> _typeshed.Self: ...
117-
def set_type(self, type: Any, /) -> None: ...
120+
def set_type(self, type: _CTypeBaseType, /) -> None: ...
118121
if sys.version_info < (3, 13):
119122
# Inherited from CType_Type starting on 3.13
120123
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]

packages/pyright-internal/typeshed-fallback/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

packages/pyright-internal/typeshed-fallback/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):

packages/pyright-internal/typeshed-fallback/stdlib/_gdbm.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import sys
22
from _typeshed import ReadOnlyBuffer, StrOrBytesPath
33
from types import TracebackType
4-
from typing import TypeVar, overload
4+
from typing import TypeVar, overload, type_check_only
55
from typing_extensions import Self, TypeAlias
66

77
if sys.platform != "win32":
@@ -13,6 +13,7 @@ if sys.platform != "win32":
1313

1414
class error(OSError): ...
1515
# Actual typename gdbm, not exposed by the implementation
16+
@type_check_only
1617
class _gdbm:
1718
def firstkey(self) -> bytes | None: ...
1819
def nextkey(self, key: _KeyType) -> bytes | None: ...

packages/pyright-internal/typeshed-fallback/stdlib/_heapq.pyi

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
import sys
2-
from typing import Any, Final, TypeVar
3-
4-
_T = TypeVar("_T") # list items must be comparable
2+
from _typeshed import SupportsRichComparisonT as _T # All type variable use in this module requires comparability.
3+
from typing import Final
54

65
__about__: Final[str]
76

8-
def heapify(heap: list[Any], /) -> None: ... # list items must be comparable
7+
def heapify(heap: list[_T], /) -> None: ...
98
def heappop(heap: list[_T], /) -> _T: ...
109
def heappush(heap: list[_T], item: _T, /) -> None: ...
1110
def heappushpop(heap: list[_T], item: _T, /) -> _T: ...
1211
def heapreplace(heap: list[_T], item: _T, /) -> _T: ...
1312

1413
if sys.version_info >= (3, 14):
15-
def heapify_max(heap: list[Any], /) -> None: ... # list items must be comparable
14+
def heapify_max(heap: list[_T], /) -> None: ...
1615
def heappop_max(heap: list[_T], /) -> _T: ...
1716
def heappush_max(heap: list[_T], item: _T, /) -> None: ...
1817
def heappushpop_max(heap: list[_T], item: _T, /) -> _T: ...

0 commit comments

Comments
 (0)