Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 819a69b

Browse files
Sync bundled typeshed and bump version to 2.10.0 (#139)
Co-authored-by: JelleZijlstra <[email protected]>
1 parent 6a444f0 commit 819a69b

24 files changed

Lines changed: 256 additions & 132 deletions

typeshed_client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
)
2222
from .resolver import ImportedInfo, Resolver
2323

24-
__version__ = "2.9.0"
24+
__version__ = "2.10.0"
2525

2626

2727
__all__ = [

typeshed_client/typeshed/_bisect.pyi

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import sys
2-
from _typeshed import SupportsLenAndGetItem, SupportsRichComparisonT
2+
from _typeshed import SupportsGetItem, SupportsLenAndGetItem, SupportsRichComparisonT
33
from collections.abc import Callable, MutableSequence
44
from typing import TypeVar, overload
55

@@ -16,6 +16,14 @@ if sys.version_info >= (3, 10):
1616
key: None = None,
1717
) -> int: ...
1818
@overload
19+
def bisect_left(
20+
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int, *, key: None = None
21+
) -> int: ...
22+
@overload
23+
def bisect_left(
24+
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: None = None
25+
) -> int: ...
26+
@overload
1927
def bisect_left(
2028
a: SupportsLenAndGetItem[_T],
2129
x: SupportsRichComparisonT,
@@ -25,6 +33,19 @@ if sys.version_info >= (3, 10):
2533
key: Callable[[_T], SupportsRichComparisonT],
2634
) -> int: ...
2735
@overload
36+
def bisect_left(
37+
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int, hi: int, *, key: Callable[[_T], SupportsRichComparisonT]
38+
) -> int: ...
39+
@overload
40+
def bisect_left(
41+
a: SupportsGetItem[int, _T],
42+
x: SupportsRichComparisonT,
43+
lo: int = 0,
44+
*,
45+
hi: int,
46+
key: Callable[[_T], SupportsRichComparisonT],
47+
) -> int: ...
48+
@overload
2849
def bisect_right(
2950
a: SupportsLenAndGetItem[SupportsRichComparisonT],
3051
x: SupportsRichComparisonT,
@@ -34,6 +55,14 @@ if sys.version_info >= (3, 10):
3455
key: None = None,
3556
) -> int: ...
3657
@overload
58+
def bisect_right(
59+
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int, *, key: None = None
60+
) -> int: ...
61+
@overload
62+
def bisect_right(
63+
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int, key: None = None
64+
) -> int: ...
65+
@overload
3766
def bisect_right(
3867
a: SupportsLenAndGetItem[_T],
3968
x: SupportsRichComparisonT,
@@ -43,6 +72,19 @@ if sys.version_info >= (3, 10):
4372
key: Callable[[_T], SupportsRichComparisonT],
4473
) -> int: ...
4574
@overload
75+
def bisect_right(
76+
a: SupportsGetItem[int, _T], x: SupportsRichComparisonT, lo: int, hi: int, *, key: Callable[[_T], SupportsRichComparisonT]
77+
) -> int: ...
78+
@overload
79+
def bisect_right(
80+
a: SupportsGetItem[int, _T],
81+
x: SupportsRichComparisonT,
82+
lo: int = 0,
83+
*,
84+
hi: int,
85+
key: Callable[[_T], SupportsRichComparisonT],
86+
) -> int: ...
87+
@overload
4688
def insort_left(
4789
a: MutableSequence[SupportsRichComparisonT],
4890
x: SupportsRichComparisonT,
@@ -70,12 +112,26 @@ if sys.version_info >= (3, 10):
70112
) -> None: ...
71113

72114
else:
115+
@overload
73116
def bisect_left(
74117
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
75118
) -> int: ...
119+
@overload
120+
def bisect_left(a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int) -> int: ...
121+
@overload
122+
def bisect_left(
123+
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int
124+
) -> int: ...
125+
@overload
76126
def bisect_right(
77127
a: SupportsLenAndGetItem[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
78128
) -> int: ...
129+
@overload
130+
def bisect_right(a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int, hi: int) -> int: ...
131+
@overload
132+
def bisect_right(
133+
a: SupportsGetItem[int, SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, *, hi: int
134+
) -> int: ...
79135
def insort_left(
80136
a: MutableSequence[SupportsRichComparisonT], x: SupportsRichComparisonT, lo: int = 0, hi: int | None = None
81137
) -> None: ...

typeshed_client/typeshed/_pickle.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ class PicklerMemoProxy:
6161
class Pickler:
6262
fast: bool
6363
dispatch_table: Mapping[type, Callable[[Any], _ReducedType]]
64-
reducer_override: Callable[[Any], Any]
6564
bin: bool # undocumented
6665
def __init__(
6766
self,
@@ -79,6 +78,10 @@ class Pickler:
7978

8079
# this method has no default implementation for Python < 3.13
8180
def persistent_id(self, obj: Any, /) -> Any: ...
81+
# The following method is not defined on _Pickler, but can be defined on
82+
# sub-classes. Should return `NotImplemented` if pickling the supplied
83+
# object is not supported and returns the same types as `__reduce__()`.
84+
def reducer_override(self, obj: object, /) -> _ReducedType: ...
8285

8386
@type_check_only
8487
class UnpicklerMemoProxy:

typeshed_client/typeshed/_sqlite3.pyi

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ from sqlite3 import (
1919
_IsolationLevel,
2020
)
2121
from typing import Any, Final, Literal, TypeVar, overload
22-
from typing_extensions import TypeAlias
22+
from typing_extensions import TypeAlias, deprecated
2323

2424
if sys.version_info >= (3, 11):
2525
from sqlite3 import Blob as Blob
@@ -299,7 +299,11 @@ def enable_callback_tracebacks(enable: bool, /) -> None: ...
299299

300300
if sys.version_info < (3, 12):
301301
# takes a pos-or-keyword argument because there is a C wrapper
302-
def enable_shared_cache(do_enable: int) -> None: ...
302+
@deprecated(
303+
"Deprecated since Python 3.10; removed in Python 3.12. "
304+
"Open database in URI mode using `cache=shared` parameter instead."
305+
)
306+
def enable_shared_cache(do_enable: int) -> None: ... # undocumented
303307

304308
if sys.version_info >= (3, 10):
305309
def register_adapter(type: type[_T], adapter: _Adapter[_T], /) -> None: ...
@@ -310,4 +314,4 @@ else:
310314
def register_converter(name: str, converter: _Converter, /) -> None: ...
311315

312316
if sys.version_info < (3, 10):
313-
OptimizedUnicode = str
317+
OptimizedUnicode = str # undocumented

typeshed_client/typeshed/_ssl.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ if sys.version_info < (3, 12):
5555
def RAND_pseudo_bytes(n: int, /) -> tuple[bytes, bool]: ...
5656

5757
if sys.version_info < (3, 10):
58+
@deprecated("Unsupported by OpenSSL since 1.1.1; removed in Python 3.10.")
5859
def RAND_egd(path: str) -> None: ...
5960

6061
def RAND_status() -> bool: ...
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
1+
import sys
12
from _typeshed import StrOrBytesPath
23
from types import FrameType
34
from typing import Any
45

5-
from . import tasks
6+
from .tasks import Task
67

7-
def _task_repr_info(task: tasks.Task[Any]) -> list[str]: ... # undocumented
8-
def _task_get_stack(task: tasks.Task[Any], limit: int | None) -> list[FrameType]: ... # undocumented
9-
def _task_print_stack(task: tasks.Task[Any], limit: int | None, file: StrOrBytesPath) -> None: ... # undocumented
8+
def _task_repr_info(task: Task[Any]) -> list[str]: ... # undocumented
9+
10+
if sys.version_info >= (3, 13):
11+
def _task_repr(task: Task[Any]) -> str: ... # undocumented
12+
13+
elif sys.version_info >= (3, 11):
14+
def _task_repr(self: Task[Any]) -> str: ... # undocumented
15+
16+
def _task_get_stack(task: Task[Any], limit: int | None) -> list[FrameType]: ... # undocumented
17+
def _task_print_stack(task: Task[Any], limit: int | None, file: StrOrBytesPath) -> None: ... # undocumented

typeshed_client/typeshed/asyncio/unix_events.pyi

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,35 @@ if sys.platform != "win32":
205205
def remove_child_handler(self, pid: int) -> bool: ...
206206
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
207207

208+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
209+
class ThreadedChildWatcher(AbstractChildWatcher):
210+
def is_active(self) -> Literal[True]: ...
211+
def close(self) -> None: ...
212+
def __enter__(self) -> Self: ...
213+
def __exit__(
214+
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
215+
) -> None: ...
216+
def __del__(self) -> None: ...
217+
def add_child_handler(
218+
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
219+
) -> None: ...
220+
def remove_child_handler(self, pid: int) -> bool: ...
221+
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
222+
223+
@deprecated("Deprecated since Python 3.12; removed in Python 3.14.")
224+
class PidfdChildWatcher(AbstractChildWatcher):
225+
def __enter__(self) -> Self: ...
226+
def __exit__(
227+
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
228+
) -> None: ...
229+
def is_active(self) -> bool: ...
230+
def close(self) -> None: ...
231+
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
232+
def add_child_handler(
233+
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
234+
) -> None: ...
235+
def remove_child_handler(self, pid: int) -> bool: ...
236+
208237
else:
209238
class MultiLoopChildWatcher(AbstractChildWatcher):
210239
def is_active(self) -> bool: ...
@@ -219,30 +248,29 @@ if sys.platform != "win32":
219248
def remove_child_handler(self, pid: int) -> bool: ...
220249
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
221250

222-
if sys.version_info < (3, 14):
223-
class ThreadedChildWatcher(AbstractChildWatcher):
224-
def is_active(self) -> Literal[True]: ...
225-
def close(self) -> None: ...
226-
def __enter__(self) -> Self: ...
227-
def __exit__(
228-
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
229-
) -> None: ...
230-
def __del__(self) -> None: ...
231-
def add_child_handler(
232-
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
233-
) -> None: ...
234-
def remove_child_handler(self, pid: int) -> bool: ...
235-
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
251+
class ThreadedChildWatcher(AbstractChildWatcher):
252+
def is_active(self) -> Literal[True]: ...
253+
def close(self) -> None: ...
254+
def __enter__(self) -> Self: ...
255+
def __exit__(
256+
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
257+
) -> None: ...
258+
def __del__(self) -> None: ...
259+
def add_child_handler(
260+
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
261+
) -> None: ...
262+
def remove_child_handler(self, pid: int) -> bool: ...
263+
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
236264

237-
class PidfdChildWatcher(AbstractChildWatcher):
238-
def __enter__(self) -> Self: ...
239-
def __exit__(
240-
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
241-
) -> None: ...
242-
def is_active(self) -> bool: ...
243-
def close(self) -> None: ...
244-
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
245-
def add_child_handler(
246-
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
247-
) -> None: ...
248-
def remove_child_handler(self, pid: int) -> bool: ...
265+
class PidfdChildWatcher(AbstractChildWatcher):
266+
def __enter__(self) -> Self: ...
267+
def __exit__(
268+
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None
269+
) -> None: ...
270+
def is_active(self) -> bool: ...
271+
def close(self) -> None: ...
272+
def attach_loop(self, loop: events.AbstractEventLoop | None) -> None: ...
273+
def add_child_handler(
274+
self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts]
275+
) -> None: ...
276+
def remove_child_handler(self, pid: int) -> bool: ...

typeshed_client/typeshed/builtins.pyi

Lines changed: 12 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,13 +1240,7 @@ class dict(MutableMapping[_KT, _VT]):
12401240
def __reversed__(self) -> Iterator[_KT]: ...
12411241
__hash__: ClassVar[None] # type: ignore[assignment]
12421242
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
1243-
@overload
1244-
def __or__(self, value: dict[_KT, _VT], /) -> dict[_KT, _VT]: ...
1245-
@overload
12461243
def __or__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ...
1247-
@overload
1248-
def __ror__(self, value: dict[_KT, _VT], /) -> dict[_KT, _VT]: ...
1249-
@overload
12501244
def __ror__(self, value: dict[_T1, _T2], /) -> dict[_KT | _T1, _VT | _T2]: ...
12511245
# dict.__ior__ should be kept roughly in line with MutableMapping.update()
12521246
@overload # type: ignore[misc]
@@ -1262,16 +1256,16 @@ class set(MutableSet[_T]):
12621256
def __init__(self, iterable: Iterable[_T], /) -> None: ...
12631257
def add(self, element: _T, /) -> None: ...
12641258
def copy(self) -> set[_T]: ...
1265-
def difference(self, *s: Iterable[Any]) -> set[_T]: ...
1266-
def difference_update(self, *s: Iterable[Any]) -> None: ...
1267-
def discard(self, element: _T, /) -> None: ...
1268-
def intersection(self, *s: Iterable[Any]) -> set[_T]: ...
1269-
def intersection_update(self, *s: Iterable[Any]) -> None: ...
1270-
def isdisjoint(self, s: Iterable[Any], /) -> bool: ...
1271-
def issubset(self, s: Iterable[Any], /) -> bool: ...
1272-
def issuperset(self, s: Iterable[Any], /) -> bool: ...
1259+
def difference(self, *s: Iterable[object]) -> set[_T]: ...
1260+
def difference_update(self, *s: Iterable[object]) -> None: ...
1261+
def discard(self, element: object, /) -> None: ...
1262+
def intersection(self, *s: Iterable[object]) -> set[_T]: ...
1263+
def intersection_update(self, *s: Iterable[object]) -> None: ...
1264+
def isdisjoint(self, s: Iterable[object], /) -> bool: ...
1265+
def issubset(self, s: Iterable[object], /) -> bool: ...
1266+
def issuperset(self, s: Iterable[object], /) -> bool: ...
12731267
def remove(self, element: _T, /) -> None: ...
1274-
def symmetric_difference(self, s: Iterable[_T], /) -> set[_T]: ...
1268+
def symmetric_difference(self, s: Iterable[_S], /) -> set[_T | _S]: ...
12751269
def symmetric_difference_update(self, s: Iterable[_T], /) -> None: ...
12761270
def union(self, *s: Iterable[_S]) -> set[_T | _S]: ...
12771271
def update(self, *s: Iterable[_T]) -> None: ...
@@ -1303,15 +1297,15 @@ class frozenset(AbstractSet[_T_co]):
13031297
def copy(self) -> frozenset[_T_co]: ...
13041298
def difference(self, *s: Iterable[object]) -> frozenset[_T_co]: ...
13051299
def intersection(self, *s: Iterable[object]) -> frozenset[_T_co]: ...
1306-
def isdisjoint(self, s: Iterable[_T_co], /) -> bool: ...
1300+
def isdisjoint(self, s: Iterable[object], /) -> bool: ...
13071301
def issubset(self, s: Iterable[object], /) -> bool: ...
13081302
def issuperset(self, s: Iterable[object], /) -> bool: ...
1309-
def symmetric_difference(self, s: Iterable[_T_co], /) -> frozenset[_T_co]: ...
1303+
def symmetric_difference(self, s: Iterable[_S], /) -> frozenset[_T_co | _S]: ...
13101304
def union(self, *s: Iterable[_S]) -> frozenset[_T_co | _S]: ...
13111305
def __len__(self) -> int: ...
13121306
def __contains__(self, o: object, /) -> bool: ...
13131307
def __iter__(self) -> Iterator[_T_co]: ...
1314-
def __and__(self, value: AbstractSet[_T_co], /) -> frozenset[_T_co]: ...
1308+
def __and__(self, value: AbstractSet[object], /) -> frozenset[_T_co]: ...
13151309
def __or__(self, value: AbstractSet[_S], /) -> frozenset[_T_co | _S]: ...
13161310
def __sub__(self, value: AbstractSet[object], /) -> frozenset[_T_co]: ...
13171311
def __xor__(self, value: AbstractSet[_S], /) -> frozenset[_T_co | _S]: ...

typeshed_client/typeshed/code.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ class InteractiveConsole(InteractiveInterpreter):
2424
buffer: list[str] # undocumented
2525
filename: str # undocumented
2626
if sys.version_info >= (3, 13):
27+
local_exit: bool # undocumented
2728
def __init__(
2829
self, locals: dict[str, Any] | None = None, filename: str = "<console>", *, local_exit: bool = False
2930
) -> None: ...

typeshed_client/typeshed/configparser.pyi

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import sys
2-
from _typeshed import MaybeNone, StrOrBytesPath, SupportsWrite
2+
from _typeshed import BytesPath, GenericPath, MaybeNone, StrOrBytesPath, StrPath, SupportsWrite
33
from collections.abc import Callable, ItemsView, Iterable, Iterator, Mapping, MutableMapping, Sequence
44
from re import Pattern
5-
from typing import Any, ClassVar, Final, Literal, TypeVar, overload, type_check_only
5+
from typing import Any, AnyStr, ClassVar, Final, Literal, TypeVar, overload, type_check_only
66
from typing_extensions import TypeAlias, deprecated
77

88
if sys.version_info >= (3, 14):
@@ -269,7 +269,14 @@ class RawConfigParser(_Parser):
269269
def has_section(self, section: _SectionName) -> bool: ...
270270
def options(self, section: _SectionName) -> list[str]: ...
271271
def has_option(self, section: _SectionName, option: str) -> bool: ...
272-
def read(self, filenames: StrOrBytesPath | Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str]: ...
272+
@overload
273+
def read(self, filenames: GenericPath[AnyStr], encoding: str | None = None) -> list[AnyStr]: ...
274+
@overload
275+
def read(self, filenames: Iterable[StrPath], encoding: str | None = None) -> list[str]: ...
276+
@overload
277+
def read(self, filenames: Iterable[BytesPath], encoding: str | None = None) -> list[bytes]: ...
278+
@overload
279+
def read(self, filenames: Iterable[StrOrBytesPath], encoding: str | None = None) -> list[str | bytes]: ...
273280
def read_file(self, f: Iterable[str], source: str | None = None) -> None: ...
274281
def read_string(self, string: str, source: str = "<string>") -> None: ...
275282
def read_dict(self, dictionary: Mapping[str, Mapping[str, Any]], source: str = "<dict>") -> None: ...

0 commit comments

Comments
 (0)