Skip to content

Commit ac7b177

Browse files
Sync vendored typeshed stubs (#12899)
Close and reopen this PR to trigger CI Co-authored-by: typeshedbot <>
1 parent e4c2859 commit ac7b177

Some content is hidden

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

41 files changed

+653
-172
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4ef2d66663fc080fefa379e6ae5fc45d4f8b54eb
1+
1ace5718deaf3041f8e3d1dc9c9e8a8e830e517f

crates/red_knot_python_semantic/vendor/typeshed/stdlib/_ast.pyi

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -753,9 +753,11 @@ class Constant(expr):
753753
__match_args__ = ("value", "kind")
754754
value: Any # None, str, bytes, bool, int, float, complex, Ellipsis
755755
kind: str | None
756-
# Aliases for value, for backwards compatibility
757-
s: Any
758-
n: int | float | complex
756+
if sys.version_info < (3, 14):
757+
# Aliases for value, for backwards compatibility
758+
s: Any
759+
n: int | float | complex
760+
759761
def __init__(self, value: Any, kind: str | None = None, **kwargs: Unpack[_Attributes]) -> None: ...
760762

761763
class NamedExpr(expr):

crates/red_knot_python_semantic/vendor/typeshed/stdlib/_collections_abc.pyi

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
import sys
22
from abc import abstractmethod
33
from types import MappingProxyType
4-
from typing import ( # noqa: Y022,Y038,Y057
4+
from typing import ( # noqa: Y022,Y038
55
AbstractSet as Set,
66
AsyncGenerator as AsyncGenerator,
77
AsyncIterable as AsyncIterable,
88
AsyncIterator as AsyncIterator,
99
Awaitable as Awaitable,
10-
ByteString as ByteString,
1110
Callable as Callable,
1211
Collection as Collection,
1312
Container as Container,
@@ -59,8 +58,12 @@ __all__ = [
5958
"ValuesView",
6059
"Sequence",
6160
"MutableSequence",
62-
"ByteString",
6361
]
62+
if sys.version_info < (3, 14):
63+
from typing import ByteString as ByteString # noqa: Y057
64+
65+
__all__ += ["ByteString"]
66+
6467
if sys.version_info >= (3, 12):
6568
__all__ += ["Buffer"]
6669

crates/red_knot_python_semantic/vendor/typeshed/stdlib/_ctypes.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ class _CDataMeta(type):
5151
# By default mypy complains about the following two methods, because strictly speaking cls
5252
# might not be a Type[_CT]. However this can never actually happen, because the only class that
5353
# uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here.
54-
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc]
55-
def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc]
54+
def __mul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
55+
def __rmul__(cls: type[_CT], other: int) -> type[Array[_CT]]: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
5656

5757
class _CData(metaclass=_CDataMeta):
5858
_b_base_: int

crates/red_knot_python_semantic/vendor/typeshed/stdlib/argparse.pyi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -357,7 +357,17 @@ class Action(_AttributeHolder):
357357

358358
if sys.version_info >= (3, 12):
359359
class BooleanOptionalAction(Action):
360-
if sys.version_info >= (3, 13):
360+
if sys.version_info >= (3, 14):
361+
def __init__(
362+
self,
363+
option_strings: Sequence[str],
364+
dest: str,
365+
default: bool | None = None,
366+
required: bool = False,
367+
help: str | None = None,
368+
deprecated: bool = False,
369+
) -> None: ...
370+
elif sys.version_info >= (3, 13):
361371
@overload
362372
def __init__(
363373
self,

crates/red_knot_python_semantic/vendor/typeshed/stdlib/ast.pyi

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,27 +10,28 @@ class _ABC(type):
1010
if sys.version_info >= (3, 9):
1111
def __init__(cls, *args: Unused) -> None: ...
1212

13-
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
14-
class Num(Constant, metaclass=_ABC):
15-
value: int | float | complex
13+
if sys.version_info < (3, 14):
14+
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
15+
class Num(Constant, metaclass=_ABC):
16+
value: int | float | complex
1617

17-
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
18-
class Str(Constant, metaclass=_ABC):
19-
value: str
20-
# Aliases for value, for backwards compatibility
21-
s: str
18+
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
19+
class Str(Constant, metaclass=_ABC):
20+
value: str
21+
# Aliases for value, for backwards compatibility
22+
s: str
2223

23-
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
24-
class Bytes(Constant, metaclass=_ABC):
25-
value: bytes
26-
# Aliases for value, for backwards compatibility
27-
s: bytes
24+
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
25+
class Bytes(Constant, metaclass=_ABC):
26+
value: bytes
27+
# Aliases for value, for backwards compatibility
28+
s: bytes
2829

29-
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
30-
class NameConstant(Constant, metaclass=_ABC): ...
30+
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
31+
class NameConstant(Constant, metaclass=_ABC): ...
3132

32-
@deprecated("Replaced by ast.Constant; removal scheduled for Python 3.14")
33-
class Ellipsis(Constant, metaclass=_ABC): ...
33+
@deprecated("Replaced by ast.Constant; removed in Python 3.14")
34+
class Ellipsis(Constant, metaclass=_ABC): ...
3435

3536
if sys.version_info >= (3, 9):
3637
class slice(AST): ...

crates/red_knot_python_semantic/vendor/typeshed/stdlib/asyncio/tasks.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ if sys.version_info >= (3, 10):
151151
@overload
152152
def gather(*coros_or_futures: _FutureLike[_T], return_exceptions: Literal[False] = False) -> Future[list[_T]]: ... # type: ignore[overload-overlap]
153153
@overload
154-
def gather(coro_or_future1: _FutureLike[_T1], /, *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ... # type: ignore[overload-overlap]
154+
def gather(coro_or_future1: _FutureLike[_T1], /, *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ...
155155
@overload
156-
def gather( # type: ignore[overload-overlap]
156+
def gather(
157157
coro_or_future1: _FutureLike[_T1], coro_or_future2: _FutureLike[_T2], /, *, return_exceptions: bool
158158
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
159159
@overload
160-
def gather( # type: ignore[overload-overlap]
160+
def gather(
161161
coro_or_future1: _FutureLike[_T1],
162162
coro_or_future2: _FutureLike[_T2],
163163
coro_or_future3: _FutureLike[_T3],
@@ -166,7 +166,7 @@ if sys.version_info >= (3, 10):
166166
return_exceptions: bool,
167167
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
168168
@overload
169-
def gather( # type: ignore[overload-overlap]
169+
def gather(
170170
coro_or_future1: _FutureLike[_T1],
171171
coro_or_future2: _FutureLike[_T2],
172172
coro_or_future3: _FutureLike[_T3],
@@ -176,7 +176,7 @@ if sys.version_info >= (3, 10):
176176
return_exceptions: bool,
177177
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
178178
@overload
179-
def gather( # type: ignore[overload-overlap]
179+
def gather(
180180
coro_or_future1: _FutureLike[_T1],
181181
coro_or_future2: _FutureLike[_T2],
182182
coro_or_future3: _FutureLike[_T3],
@@ -189,7 +189,7 @@ if sys.version_info >= (3, 10):
189189
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
190190
]: ...
191191
@overload
192-
def gather( # type: ignore[overload-overlap]
192+
def gather(
193193
coro_or_future1: _FutureLike[_T1],
194194
coro_or_future2: _FutureLike[_T2],
195195
coro_or_future3: _FutureLike[_T3],

crates/red_knot_python_semantic/vendor/typeshed/stdlib/asyncio/unix_events.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if sys.platform != "win32":
159159

160160
class _UnixSelectorEventLoop(BaseSelectorEventLoop):
161161
if sys.version_info >= (3, 13):
162-
async def create_unix_server( # type: ignore[override]
162+
async def create_unix_server(
163163
self,
164164
protocol_factory: _ProtocolFactory,
165165
path: StrPath | None = None,

crates/red_knot_python_semantic/vendor/typeshed/stdlib/builtins.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,17 +1744,16 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
17441744
# without creating many false-positive errors (see #7578).
17451745
# Instead, we special-case the most common examples of this: bool and literal integers.
17461746
@overload
1747-
def sum(iterable: Iterable[bool | _LiteralInteger], /, start: int = 0) -> int: ... # type: ignore[overload-overlap]
1747+
def sum(iterable: Iterable[bool | _LiteralInteger], /, start: int = 0) -> int: ...
17481748
@overload
17491749
def sum(iterable: Iterable[_SupportsSumNoDefaultT], /) -> _SupportsSumNoDefaultT | Literal[0]: ...
17501750
@overload
17511751
def sum(iterable: Iterable[_AddableT1], /, start: _AddableT2) -> _AddableT1 | _AddableT2: ...
17521752

17531753
# The argument to `vars()` has to have a `__dict__` attribute, so the second overload can't be annotated with `object`
17541754
# (A "SupportsDunderDict" protocol doesn't work)
1755-
# Use a type: ignore to make complaints about overlapping overloads go away
17561755
@overload
1757-
def vars(object: type, /) -> types.MappingProxyType[str, Any]: ... # type: ignore[overload-overlap]
1756+
def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
17581757
@overload
17591758
def vars(object: Any = ..., /) -> dict[str, Any]: ...
17601759

crates/red_knot_python_semantic/vendor/typeshed/stdlib/contextlib.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ class AbstractAsyncContextManager(Protocol[_T_co, _ExitT_co]):
5555
) -> _ExitT_co: ...
5656

5757
class ContextDecorator:
58+
def _recreate_cm(self) -> Self: ...
5859
def __call__(self, func: _F) -> _F: ...
5960

6061
class _GeneratorContextManager(AbstractContextManager[_T_co, bool | None], ContextDecorator):
@@ -80,6 +81,7 @@ if sys.version_info >= (3, 10):
8081
_AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]])
8182

8283
class AsyncContextDecorator:
84+
def _recreate_cm(self) -> Self: ...
8385
def __call__(self, func: _AF) -> _AF: ...
8486

8587
class _AsyncGeneratorContextManager(AbstractAsyncContextManager[_T_co, bool | None], AsyncContextDecorator):

0 commit comments

Comments
 (0)