Skip to content

Commit aa3492d

Browse files
committed
Updated typeshed stubs to the latest version
1 parent 5ba9dcf commit aa3492d

File tree

537 files changed

+5738
-2982
lines changed

Some content is hidden

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

537 files changed

+5738
-2982
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
8f5a80e7b741226e525bd90e45496b8f68dc69b6
1+
07a59e924fd19fa6de45636498b8ca90649b996e

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ asyncio.staggered: 3.8-
9595
asyncio.taskgroups: 3.11-
9696
asyncio.threads: 3.9-
9797
asyncio.timeouts: 3.11-
98+
asyncio.tools: 3.14-
9899
asyncio.trsock: 3.8-
99100
asyncore: 3.0-3.11
100101
atexit: 3.0-

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ else:
9090

9191
def writer(
9292
csvfile: SupportsWrite[str],
93+
/,
9394
dialect: _DialectLike = "excel",
9495
*,
9596
delimiter: str = ",",
@@ -103,6 +104,7 @@ def writer(
103104
) -> _writer: ...
104105
def reader(
105106
csvfile: Iterable[str],
107+
/,
106108
dialect: _DialectLike = "excel",
107109
*,
108110
delimiter: str = ",",

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

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import types
2-
from collections.abc import Callable, Mapping
3-
from typing import Final, Literal, SupportsIndex
2+
from collections.abc import Callable
3+
from typing import Any, Final, Literal, SupportsIndex
44
from typing_extensions import TypeAlias
55

66
_Configs: TypeAlias = Literal["default", "isolated", "legacy", "empty", ""]
7+
_SharedDict: TypeAlias = dict[str, Any] # many objects can be shared
78

89
class InterpreterError(Exception): ...
910
class InterpreterNotFoundError(InterpreterError): ...
@@ -22,7 +23,11 @@ def is_running(id: SupportsIndex, *, restrict: bool = False) -> bool: ...
2223
def get_config(id: SupportsIndex, *, restrict: bool = False) -> types.SimpleNamespace: ...
2324
def whence(id: SupportsIndex) -> int: ...
2425
def exec(
25-
id: SupportsIndex, code: str | types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False
26+
id: SupportsIndex,
27+
code: str | types.CodeType | Callable[[], object],
28+
shared: _SharedDict | None = None,
29+
*,
30+
restrict: bool = False,
2631
) -> None | types.SimpleNamespace: ...
2732
def call(
2833
id: SupportsIndex,
@@ -33,12 +38,16 @@ def call(
3338
restrict: bool = False,
3439
) -> object: ...
3540
def run_string(
36-
id: SupportsIndex, script: str | types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False
41+
id: SupportsIndex,
42+
script: str | types.CodeType | Callable[[], object],
43+
shared: _SharedDict | None = None,
44+
*,
45+
restrict: bool = False,
3746
) -> None: ...
3847
def run_func(
39-
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False
48+
id: SupportsIndex, func: types.CodeType | Callable[[], object], shared: _SharedDict | None = None, *, restrict: bool = False
4049
) -> None: ...
41-
def set___main___attrs(id: SupportsIndex, updates: Mapping[str, object], *, restrict: bool = False) -> None: ...
50+
def set___main___attrs(id: SupportsIndex, updates: _SharedDict, *, restrict: bool = False) -> None: ...
4251
def incref(id: SupportsIndex, *, implieslink: bool = False, restrict: bool = False) -> None: ...
4352
def decref(id: SupportsIndex, *, restrict: bool = False) -> None: ...
4453
def is_shareable(obj: object) -> bool: ...

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class ZstdCompressor:
5252
self, /, data: ReadableBuffer, mode: _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 0
5353
) -> bytes: ...
5454
def flush(self, /, mode: _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame = 2) -> bytes: ...
55+
def set_pledged_input_size(self, size: int | None, /) -> None: ...
5556
@property
5657
def last_mode(self) -> _ZstdCompressorContinue | _ZstdCompressorFlushBlock | _ZstdCompressorFlushFrame: ...
5758

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

Lines changed: 47 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import ast
12
import builtins
23
import os
34
import sys
@@ -623,21 +624,6 @@ class AsyncWith(stmt):
623624
**kwargs: Unpack[_Attributes],
624625
) -> Self: ...
625626

626-
if sys.version_info >= (3, 10):
627-
class Match(stmt):
628-
__match_args__ = ("subject", "cases")
629-
subject: expr
630-
cases: list[match_case]
631-
if sys.version_info >= (3, 13):
632-
def __init__(self, subject: expr, cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
633-
else:
634-
def __init__(self, subject: expr, cases: list[match_case], **kwargs: Unpack[_Attributes]) -> None: ...
635-
636-
if sys.version_info >= (3, 14):
637-
def __replace__(
638-
self, *, subject: expr = ..., cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]
639-
) -> Self: ...
640-
641627
class Raise(stmt):
642628
if sys.version_info >= (3, 10):
643629
__match_args__ = ("exc", "cause")
@@ -1076,13 +1062,13 @@ if sys.version_info >= (3, 14):
10761062
value: expr
10771063
str: builtins.str
10781064
conversion: int
1079-
format_spec: builtins.str | None = None
1065+
format_spec: expr | None = None
10801066
def __init__(
10811067
self,
10821068
value: expr = ...,
10831069
str: builtins.str = ...,
10841070
conversion: int = ...,
1085-
format_spec: builtins.str | None = ...,
1071+
format_spec: expr | None = ...,
10861072
**kwargs: Unpack[_Attributes],
10871073
) -> None: ...
10881074
def __replace__(
@@ -1091,7 +1077,7 @@ if sys.version_info >= (3, 14):
10911077
value: expr = ...,
10921078
str: builtins.str = ...,
10931079
conversion: int = ...,
1094-
format_spec: builtins.str | None = ...,
1080+
format_spec: expr | None = ...,
10951081
**kwargs: Unpack[_Attributes],
10961082
) -> Self: ...
10971083

@@ -1135,13 +1121,13 @@ class Subscript(expr):
11351121
if sys.version_info >= (3, 10):
11361122
__match_args__ = ("value", "slice", "ctx")
11371123
value: expr
1138-
slice: _Slice
1124+
slice: expr
11391125
ctx: expr_context # Not present in Python < 3.13 if not passed to `__init__`
1140-
def __init__(self, value: expr, slice: _Slice, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1126+
def __init__(self, value: expr, slice: expr, ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> None: ...
11411127

11421128
if sys.version_info >= (3, 14):
11431129
def __replace__(
1144-
self, *, value: expr = ..., slice: _Slice = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]
1130+
self, *, value: expr = ..., slice: expr = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]
11451131
) -> Self: ...
11461132

11471133
class Starred(expr):
@@ -1194,36 +1180,28 @@ class Tuple(expr):
11941180
@deprecated("Deprecated since Python 3.9.")
11951181
class slice(AST): ...
11961182

1197-
_Slice: typing_extensions.TypeAlias = expr
1198-
_SliceAttributes: typing_extensions.TypeAlias = _Attributes
1199-
1200-
class Slice(_Slice):
1183+
class Slice(expr):
12011184
if sys.version_info >= (3, 10):
12021185
__match_args__ = ("lower", "upper", "step")
12031186
lower: expr | None
12041187
upper: expr | None
12051188
step: expr | None
12061189
def __init__(
1207-
self, lower: expr | None = None, upper: expr | None = None, step: expr | None = None, **kwargs: Unpack[_SliceAttributes]
1190+
self, lower: expr | None = None, upper: expr | None = None, step: expr | None = None, **kwargs: Unpack[_Attributes]
12081191
) -> None: ...
12091192

12101193
if sys.version_info >= (3, 14):
12111194
def __replace__(
1212-
self,
1213-
*,
1214-
lower: expr | None = ...,
1215-
upper: expr | None = ...,
1216-
step: expr | None = ...,
1217-
**kwargs: Unpack[_SliceAttributes],
1195+
self, *, lower: expr | None = ..., upper: expr | None = ..., step: expr | None = ..., **kwargs: Unpack[_Attributes]
12181196
) -> Self: ...
12191197

12201198
@deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.")
12211199
class ExtSlice(slice):
1222-
def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[misc]
1200+
def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_Attributes]) -> Tuple: ... # type: ignore[misc]
12231201

12241202
@deprecated("Deprecated since Python 3.9. Use the index value directly instead.")
12251203
class Index(slice):
1226-
def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... # type: ignore[misc]
1204+
def __new__(cls, value: expr, **kwargs: Unpack[_Attributes]) -> expr: ... # type: ignore[misc]
12271205

12281206
class expr_context(AST): ...
12291207

@@ -1465,37 +1443,48 @@ class withitem(AST):
14651443
def __replace__(self, *, context_expr: expr = ..., optional_vars: expr | None = ...) -> Self: ...
14661444

14671445
if sys.version_info >= (3, 10):
1446+
class pattern(AST):
1447+
lineno: int
1448+
col_offset: int
1449+
end_lineno: int
1450+
end_col_offset: int
1451+
def __init__(self, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1452+
1453+
if sys.version_info >= (3, 14):
1454+
def __replace__(
1455+
self, *, lineno: int = ..., col_offset: int = ..., end_lineno: int = ..., end_col_offset: int = ...
1456+
) -> Self: ...
1457+
14681458
class match_case(AST):
14691459
__match_args__ = ("pattern", "guard", "body")
1470-
pattern: _Pattern
1460+
pattern: ast.pattern
14711461
guard: expr | None
14721462
body: list[stmt]
14731463
if sys.version_info >= (3, 13):
1474-
def __init__(self, pattern: _Pattern, guard: expr | None = None, body: list[stmt] = ...) -> None: ...
1475-
else:
1464+
def __init__(self, pattern: ast.pattern, guard: expr | None = None, body: list[stmt] = ...) -> None: ...
1465+
elif sys.version_info >= (3, 10):
14761466
@overload
1477-
def __init__(self, pattern: _Pattern, guard: expr | None, body: list[stmt]) -> None: ...
1467+
def __init__(self, pattern: ast.pattern, guard: expr | None, body: list[stmt]) -> None: ...
14781468
@overload
1479-
def __init__(self, pattern: _Pattern, guard: expr | None = None, *, body: list[stmt]) -> None: ...
1469+
def __init__(self, pattern: ast.pattern, guard: expr | None = None, *, body: list[stmt]) -> None: ...
14801470

14811471
if sys.version_info >= (3, 14):
1482-
def __replace__(self, *, pattern: _Pattern = ..., guard: expr | None = ..., body: list[stmt] = ...) -> Self: ...
1472+
def __replace__(self, *, pattern: ast.pattern = ..., guard: expr | None = ..., body: list[stmt] = ...) -> Self: ...
14831473

1484-
class pattern(AST):
1485-
lineno: int
1486-
col_offset: int
1487-
end_lineno: int
1488-
end_col_offset: int
1489-
def __init__(self, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1474+
class Match(stmt):
1475+
__match_args__ = ("subject", "cases")
1476+
subject: expr
1477+
cases: list[match_case]
1478+
if sys.version_info >= (3, 13):
1479+
def __init__(self, subject: expr, cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]) -> None: ...
1480+
else:
1481+
def __init__(self, subject: expr, cases: list[match_case], **kwargs: Unpack[_Attributes]) -> None: ...
14901482

14911483
if sys.version_info >= (3, 14):
14921484
def __replace__(
1493-
self, *, lineno: int = ..., col_offset: int = ..., end_lineno: int = ..., end_col_offset: int = ...
1485+
self, *, subject: expr = ..., cases: list[match_case] = ..., **kwargs: Unpack[_Attributes]
14941486
) -> Self: ...
14951487

1496-
# Without the alias, Pyright complains variables named pattern are recursively defined
1497-
_Pattern: typing_extensions.TypeAlias = pattern
1498-
14991488
class MatchValue(pattern):
15001489
__match_args__ = ("value",)
15011490
value: expr
@@ -1590,22 +1579,22 @@ if sys.version_info >= (3, 10):
15901579
class MatchStar(pattern):
15911580
__match_args__ = ("name",)
15921581
name: str | None
1593-
def __init__(self, name: str | None, **kwargs: Unpack[_Attributes[int]]) -> None: ...
1582+
def __init__(self, name: str | None = None, **kwargs: Unpack[_Attributes[int]]) -> None: ...
15941583

15951584
if sys.version_info >= (3, 14):
15961585
def __replace__(self, *, name: str | None = ..., **kwargs: Unpack[_Attributes[int]]) -> Self: ...
15971586

15981587
class MatchAs(pattern):
15991588
__match_args__ = ("pattern", "name")
1600-
pattern: _Pattern | None
1589+
pattern: ast.pattern | None
16011590
name: str | None
16021591
def __init__(
1603-
self, pattern: _Pattern | None = None, name: str | None = None, **kwargs: Unpack[_Attributes[int]]
1592+
self, pattern: ast.pattern | None = None, name: str | None = None, **kwargs: Unpack[_Attributes[int]]
16041593
) -> None: ...
16051594

16061595
if sys.version_info >= (3, 14):
16071596
def __replace__(
1608-
self, *, pattern: _Pattern | None = ..., name: str | None = ..., **kwargs: Unpack[_Attributes[int]]
1597+
self, *, pattern: ast.pattern | None = ..., name: str | None = ..., **kwargs: Unpack[_Attributes[int]]
16091598
) -> Self: ...
16101599

16111600
class MatchOr(pattern):
@@ -1708,6 +1697,8 @@ if sys.version_info < (3, 14):
17081697
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
17091698
class Num(Constant, metaclass=_ABC):
17101699
value: int | float | complex
1700+
# Aliases for value, for backwards compatibility
1701+
n: int | float | complex
17111702

17121703
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
17131704
class Str(Constant, metaclass=_ABC):
@@ -1808,7 +1799,7 @@ if sys.version_info >= (3, 13):
18081799
type_comments: bool = False,
18091800
feature_version: None | int | tuple[int, int] = None,
18101801
optimize: Literal[-1, 0, 1, 2] = -1,
1811-
) -> AST: ...
1802+
) -> mod: ...
18121803

18131804
else:
18141805
@overload
@@ -1879,7 +1870,7 @@ else:
18791870
*,
18801871
type_comments: bool = False,
18811872
feature_version: None | int | tuple[int, int] = None,
1882-
) -> AST: ...
1873+
) -> mod: ...
18831874

18841875
def literal_eval(node_or_string: str | AST) -> Any: ...
18851876

packages/pyright-internal/typeshed-fallback/stdlib/asyncio/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ruff: noqa: PLR5501 # This condition is so big, it's clearer to keep to platform condition in two blocks
1+
# This condition is so big, it's clearer to keep to platform condition in two blocks
22
# Can't NOQA on a specific line: https://github.com/plinss/flake8-noqa/issues/22
33
import sys
44
from collections.abc import Awaitable, Coroutine, Generator
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
from collections.abc import Iterable
2+
from enum import Enum
3+
from typing import NamedTuple, SupportsIndex, type_check_only
4+
5+
@type_check_only
6+
class _AwaitedInfo(NamedTuple): # AwaitedInfo_Type from _remote_debugging
7+
thread_id: int
8+
awaited_by: list[_TaskInfo]
9+
10+
@type_check_only
11+
class _TaskInfo(NamedTuple): # TaskInfo_Type from _remote_debugging
12+
task_id: int
13+
task_name: str
14+
coroutine_stack: list[_CoroInfo]
15+
awaited_by: list[_CoroInfo]
16+
17+
@type_check_only
18+
class _CoroInfo(NamedTuple): # CoroInfo_Type from _remote_debugging
19+
call_stack: list[_FrameInfo]
20+
task_name: int | str
21+
22+
@type_check_only
23+
class _FrameInfo(NamedTuple): # FrameInfo_Type from _remote_debugging
24+
filename: str
25+
lineno: int
26+
funcname: str
27+
28+
class NodeType(Enum):
29+
COROUTINE = 1
30+
TASK = 2
31+
32+
class CycleFoundException(Exception):
33+
cycles: list[list[int]]
34+
id2name: dict[int, str]
35+
def __init__(self, cycles: list[list[int]], id2name: dict[int, str]) -> None: ...
36+
37+
def get_all_awaited_by(pid: SupportsIndex) -> list[_AwaitedInfo]: ...
38+
def build_async_tree(result: Iterable[_AwaitedInfo], task_emoji: str = "(T)", cor_emoji: str = "") -> list[list[str]]: ...
39+
def build_task_table(result: Iterable[_AwaitedInfo]) -> list[list[int | str]]: ...
40+
def display_awaited_by_tasks_table(pid: SupportsIndex) -> None: ...
41+
def display_awaited_by_tasks_tree(pid: SupportsIndex) -> None: ...

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ class bytes(Sequence[int]):
707707
def strip(self, bytes: ReadableBuffer | None = None, /) -> bytes: ...
708708
def swapcase(self) -> bytes: ...
709709
def title(self) -> bytes: ...
710-
def translate(self, table: ReadableBuffer | None, /, delete: bytes = b"") -> bytes: ...
710+
def translate(self, table: ReadableBuffer | None, /, delete: ReadableBuffer = b"") -> bytes: ...
711711
def upper(self) -> bytes: ...
712712
def zfill(self, width: SupportsIndex, /) -> bytes: ...
713713
@classmethod

packages/pyright-internal/typeshed-fallback/stdlib/collections/__init__.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,8 @@ class UserDict(MutableMapping[_KT, _VT]):
108108
@overload
109109
def get(self, key: _KT, default: None = None) -> _VT | None: ...
110110
@overload
111+
def get(self, key: _KT, default: _VT) -> _VT: ...
112+
@overload
111113
def get(self, key: _KT, default: _T) -> _VT | _T: ...
112114

113115
class UserList(MutableSequence[_T]):
@@ -452,6 +454,8 @@ class ChainMap(MutableMapping[_KT, _VT]):
452454
@overload
453455
def get(self, key: _KT, default: None = None) -> _VT | None: ...
454456
@overload
457+
def get(self, key: _KT, default: _VT) -> _VT: ...
458+
@overload
455459
def get(self, key: _KT, default: _T) -> _VT | _T: ...
456460
def __missing__(self, key: _KT) -> _VT: ... # undocumented
457461
def __bool__(self) -> bool: ...

0 commit comments

Comments
 (0)