Skip to content

Commit e17e1e8

Browse files
Sync vendored typeshed stubs (#17753)
Co-authored-by: typeshedbot <>
1 parent 03d8679 commit e17e1e8

18 files changed

+76
-39
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
f65bdc1acde54fda93c802459280da74518d2eef
1+
eec809d049d10a5ae9b88780eab15fe36a9768d7

crates/red_knot_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ def spec_from_file_location(
3636
loader: LoaderProtocol | None = None,
3737
submodule_search_locations: list[str] | None = ...,
3838
) -> importlib.machinery.ModuleSpec | None: ...
39-
39+
@deprecated(
40+
"Deprecated as of Python 3.6: Use site configuration instead. "
41+
"Future versions of Python may not enable this finder by default."
42+
)
4043
class WindowsRegistryFinder(importlib.abc.MetaPathFinder):
4144
if sys.version_info < (3, 12):
4245
@classmethod
@@ -118,6 +121,13 @@ class FileLoader:
118121
class SourceFileLoader(importlib.abc.FileLoader, FileLoader, importlib.abc.SourceLoader, SourceLoader): # type: ignore[misc] # incompatible method arguments in base classes
119122
def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = 0o666) -> None: ...
120123
def path_stats(self, path: str) -> Mapping[str, Any]: ...
124+
def source_to_code( # type: ignore[override] # incompatible with InspectLoader.source_to_code
125+
self,
126+
data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive,
127+
path: ReadableBuffer | StrPath,
128+
*,
129+
_optimize: int = -1,
130+
) -> types.CodeType: ...
121131

122132
class SourcelessFileLoader(importlib.abc.FileLoader, FileLoader, _LoaderBasics):
123133
def get_code(self, fullname: str) -> types.CodeType | None: ...

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,8 +1893,12 @@ if sys.version_info >= (3, 14):
18931893
def compare(left: AST, right: AST, /, *, compare_attributes: bool = False) -> bool: ...
18941894

18951895
class NodeVisitor:
1896+
# All visit methods below can be overwritten by subclasses and return an
1897+
# arbitrary value, which is passed to the caller.
18961898
def visit(self, node: AST) -> Any: ...
18971899
def generic_visit(self, node: AST) -> Any: ...
1900+
# The following visit methods are not defined on NodeVisitor, but can
1901+
# be implemented by subclasses and are called during a visit if defined.
18981902
def visit_Module(self, node: Module) -> Any: ...
18991903
def visit_Interactive(self, node: Interactive) -> Any: ...
19001904
def visit_Expression(self, node: Expression) -> Any: ...

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class AsyncExitStack(_BaseExitStack[_ExitT_co], metaclass=abc.ABCMeta):
179179
async def __aenter__(self) -> Self: ...
180180
async def __aexit__(
181181
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
182-
) -> bool: ...
182+
) -> _ExitT_co: ...
183183

184184
if sys.version_info >= (3, 10):
185185
class nullcontext(AbstractContextManager[_T, None], AbstractAsyncContextManager[_T, None]):

crates/red_knot_vendored/vendor/typeshed/stdlib/curses/__init__.pyi

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@ COLOR_PAIRS: int
2323

2424
def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T: ...
2525

26-
# typeshed used the name _CursesWindow for the underlying C class before
27-
# it was mapped to the name 'window' in 3.8.
28-
# Kept here as a legacy alias in case any third-party code is relying on it.
29-
_CursesWindow = window
30-
3126
# At runtime this class is unexposed and calls itself curses.ncurses_version.
3227
# That name would conflict with the actual curses.ncurses_version, which is
3328
# an instance of this class.

crates/red_knot_vendored/vendor/typeshed/stdlib/email/_header_value_parser.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ TOKEN_ENDS: Final[set[str]]
1717
ASPECIALS: Final[set[str]]
1818
ATTRIBUTE_ENDS: Final[set[str]]
1919
EXTENDED_ATTRIBUTE_ENDS: Final[set[str]]
20-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
20+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
2121
NLSET: Final[set[str]]
22-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
22+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
2323
SPECIALSNL: Final[set[str]]
2424

2525
if sys.version_info >= (3, 10):

crates/red_knot_vendored/vendor/typeshed/stdlib/email/_policybase.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class _PolicyBase(Generic[_MessageT]):
2323
raise_on_defect: bool
2424
mangle_from_: bool
2525
message_factory: _MessageFactory[_MessageT] | None
26-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
26+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
2727
verify_generated_headers: bool
2828

2929
def __init__(
@@ -35,7 +35,7 @@ class _PolicyBase(Generic[_MessageT]):
3535
raise_on_defect: bool = False,
3636
mangle_from_: bool = ..., # default depends on sub-class
3737
message_factory: _MessageFactory[_MessageT] | None = None,
38-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
38+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
3939
verify_generated_headers: bool = True,
4040
) -> None: ...
4141
def clone(
@@ -47,7 +47,7 @@ class _PolicyBase(Generic[_MessageT]):
4747
raise_on_defect: bool = ...,
4848
mangle_from_: bool = ...,
4949
message_factory: _MessageFactory[_MessageT] | None = ...,
50-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
50+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
5151
verify_generated_headers: bool = ...,
5252
) -> Self: ...
5353
def __add__(self, other: Policy) -> Self: ...

crates/red_knot_vendored/vendor/typeshed/stdlib/email/errors.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class BoundaryError(MessageParseError): ...
77
class MultipartConversionError(MessageError, TypeError): ...
88
class CharsetError(MessageError): ...
99

10-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
10+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
1111
class HeaderWriteError(MessageError): ...
1212

1313
class MessageDefect(ValueError):

crates/red_knot_vendored/vendor/typeshed/stdlib/email/policy.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class EmailPolicy(Policy[_MessageT]):
2424
raise_on_defect: bool = ...,
2525
mangle_from_: bool = ...,
2626
message_factory: None = None,
27-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
27+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
2828
verify_generated_headers: bool = ...,
2929
utf8: bool = ...,
3030
refold_source: str = ...,
@@ -41,7 +41,7 @@ class EmailPolicy(Policy[_MessageT]):
4141
raise_on_defect: bool = ...,
4242
mangle_from_: bool = ...,
4343
message_factory: _MessageFactory[_MessageT] | None = ...,
44-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
44+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
4545
verify_generated_headers: bool = ...,
4646
utf8: bool = ...,
4747
refold_source: str = ...,
@@ -62,7 +62,7 @@ class EmailPolicy(Policy[_MessageT]):
6262
raise_on_defect: bool = ...,
6363
mangle_from_: bool = ...,
6464
message_factory: _MessageFactory[_MessageT] | None = ...,
65-
# Added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
65+
# Added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
6666
verify_generated_headers: bool = ...,
6767
utf8: bool = ...,
6868
refold_source: str = ...,

crates/red_knot_vendored/vendor/typeshed/stdlib/email/utils.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ _PDTZ: TypeAlias = tuple[int, int, int, int, int, int, int, int, int, int | None
3030
def quote(str: str) -> str: ...
3131
def unquote(str: str) -> str: ...
3232

33-
# `strict` parameter added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
33+
# `strict` parameter added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
3434
def parseaddr(addr: str | list[str], *, strict: bool = True) -> tuple[str, str]: ...
3535
def formataddr(pair: tuple[str | None, str], charset: str | Charset = "utf-8") -> str: ...
3636

37-
# `strict` parameter added in Python 3.8.20, 3.9.20, 3.10.15, 3.11.10, 3.12.5
37+
# `strict` parameter added in Python 3.9.20, 3.10.15, 3.11.10, 3.12.5
3838
def getaddresses(fieldvalues: Iterable[str], *, strict: bool = True) -> list[tuple[str, str]]: ...
3939
@overload
4040
def parsedate(data: None) -> None: ...

crates/red_knot_vendored/vendor/typeshed/stdlib/enum.pyi

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ if sys.version_info >= (3, 11):
299299
def __or__(self, other: int) -> Self: ...
300300
def __and__(self, other: int) -> Self: ...
301301
def __xor__(self, other: int) -> Self: ...
302+
def __invert__(self) -> Self: ...
302303
__ror__ = __or__
303304
__rand__ = __and__
304305
__rxor__ = __xor__
@@ -309,6 +310,7 @@ else:
309310
def __or__(self, other: int) -> Self: ...
310311
def __and__(self, other: int) -> Self: ...
311312
def __xor__(self, other: int) -> Self: ...
313+
def __invert__(self) -> Self: ...
312314
__ror__ = __or__
313315
__rand__ = __and__
314316
__rxor__ = __xor__

crates/red_knot_vendored/vendor/typeshed/stdlib/importlib/abc.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ from importlib import _bootstrap_external
88
from importlib.machinery import ModuleSpec
99
from io import BufferedReader
1010
from typing import IO, Any, Literal, Protocol, overload, runtime_checkable
11+
from typing_extensions import deprecated
1112

1213
if sys.version_info >= (3, 11):
1314
__all__ = [
@@ -38,6 +39,7 @@ else:
3839
if sys.version_info < (3, 12):
3940
class Finder(metaclass=ABCMeta): ...
4041

42+
@deprecated("Deprecated as of Python 3.7: Use importlib.resources.abc.TraversableResources instead.")
4143
class ResourceLoader(Loader):
4244
@abstractmethod
4345
def get_data(self, path: str) -> bytes: ...
@@ -58,6 +60,7 @@ class ExecutionLoader(InspectLoader):
5860
def get_filename(self, fullname: str) -> str: ...
5961

6062
class SourceLoader(_bootstrap_external.SourceLoader, ResourceLoader, ExecutionLoader, metaclass=ABCMeta): # type: ignore[misc] # incompatible definitions of source_to_code in the base classes
63+
@deprecated("Deprecated as of Python 3.3: Use importlib.resources.abc.SourceLoader.path_stats instead.")
6164
def path_mtime(self, path: str) -> float: ...
6265
def set_data(self, path: str, data: bytes) -> None: ...
6366
def get_source(self, fullname: str) -> str | None: ...

crates/red_knot_vendored/vendor/typeshed/stdlib/pydoc.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from collections.abc import Callable, Container, Mapping, MutableMapping
66
from reprlib import Repr
77
from types import MethodType, ModuleType, TracebackType
88
from typing import IO, Any, AnyStr, Final, NoReturn, Protocol, TypeVar
9-
from typing_extensions import TypeGuard
9+
from typing_extensions import TypeGuard, deprecated
1010

1111
__all__ = ["help"]
1212

@@ -31,7 +31,14 @@ def stripid(text: str) -> str: ...
3131
def allmethods(cl: type) -> MutableMapping[str, MethodType]: ...
3232
def visiblename(name: str, all: Container[str] | None = None, obj: object = None) -> bool: ...
3333
def classify_class_attrs(object: object) -> list[tuple[str, str, type, str]]: ...
34-
def ispackage(path: str) -> bool: ...
34+
35+
if sys.version_info >= (3, 13):
36+
@deprecated("Deprecated in Python 3.13.")
37+
def ispackage(path: str) -> bool: ...
38+
39+
else:
40+
def ispackage(path: str) -> bool: ...
41+
3542
def source_synopsis(file: IO[AnyStr]) -> AnyStr | None: ...
3643
def synopsis(filename: str, cache: MutableMapping[str, tuple[int, str]] = {}) -> str | None: ...
3744

crates/red_knot_vendored/vendor/typeshed/stdlib/sys/__init__.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ flags: _flags
9696
# This can be re-visited when typeshed drops support for 3.10,
9797
# at which point all supported versions will include int_max_str_digits
9898
# in all patch versions.
99-
# 3.8 and 3.9 are 15 or 16-tuple
99+
# 3.9 is 15 or 16-tuple
100100
# 3.10 is 16 or 17-tuple
101101
# 3.11+ is an 18-tuple.
102102
@final
@@ -184,7 +184,7 @@ class _flags(_UninstantiableStructseq, tuple[int, ...]):
184184
# Whether or not this exists on lower versions of Python
185185
# may depend on which patch release you're using
186186
# (it was backported to all Python versions on 3.8+ as a security fix)
187-
# Added in: 3.8.14, 3.9.14, 3.10.7
187+
# Added in: 3.9.14, 3.10.7
188188
# and present in all versions of 3.11 and later.
189189
@property
190190
def int_max_str_digits(self) -> int: ...
@@ -448,7 +448,7 @@ if sys.platform == "win32":
448448
def get_coroutine_origin_tracking_depth() -> int: ...
449449
def set_coroutine_origin_tracking_depth(depth: int) -> None: ...
450450

451-
# The following two functions were added in 3.11.0, 3.10.7, 3.9.14, and 3.8.14,
451+
# The following two functions were added in 3.11.0, 3.10.7, and 3.9.14,
452452
# as part of the response to CVE-2020-10735
453453
def set_int_max_str_digits(maxdigits: int) -> None: ...
454454
def get_int_max_str_digits() -> int: ...

crates/red_knot_vendored/vendor/typeshed/stdlib/tarfile.pyi

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ from collections.abc import Callable, Iterable, Iterator, Mapping
77
from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj
88
from types import TracebackType
99
from typing import IO, ClassVar, Literal, Protocol, overload
10-
from typing_extensions import Self, TypeAlias
10+
from typing_extensions import Self, TypeAlias, deprecated
1111

1212
__all__ = [
1313
"TarFile",
@@ -622,7 +622,6 @@ class TarInfo:
622622
offset: int
623623
offset_data: int
624624
sparse: bytes | None
625-
tarfile: TarFile | None
626625
mode: int
627626
type: bytes
628627
linkname: str
@@ -632,6 +631,16 @@ class TarInfo:
632631
gname: str
633632
pax_headers: Mapping[str, str]
634633
def __init__(self, name: str = "") -> None: ...
634+
if sys.version_info >= (3, 13):
635+
@property
636+
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.16")
637+
def tarfile(self) -> TarFile | None: ...
638+
@tarfile.setter
639+
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.16")
640+
def tarfile(self, tarfile: TarFile | None) -> None: ...
641+
else:
642+
tarfile: TarFile | None
643+
635644
@classmethod
636645
def frombuf(cls, buf: bytes | bytearray, encoding: str, errors: str) -> Self: ...
637646
@classmethod

crates/red_knot_vendored/vendor/typeshed/stdlib/threading.pyi

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ from _typeshed import ProfileFunction, TraceFunction
55
from collections.abc import Callable, Iterable, Mapping
66
from types import TracebackType
77
from typing import Any, TypeVar, final
8+
from typing_extensions import deprecated
89

910
_T = TypeVar("_T")
1011

@@ -44,9 +45,11 @@ if sys.version_info >= (3, 12):
4445
_profile_hook: ProfileFunction | None
4546

4647
def active_count() -> int: ...
47-
def activeCount() -> int: ... # deprecated alias for active_count()
48+
@deprecated("Use active_count() instead")
49+
def activeCount() -> int: ...
4850
def current_thread() -> Thread: ...
49-
def currentThread() -> Thread: ... # deprecated alias for current_thread()
51+
@deprecated("Use current_thread() instead")
52+
def currentThread() -> Thread: ...
5053
def get_ident() -> int: ...
5154
def enumerate() -> list[Thread]: ...
5255
def main_thread() -> Thread: ...
@@ -89,11 +92,14 @@ class Thread:
8992
@property
9093
def native_id(self) -> int | None: ... # only available on some platforms
9194
def is_alive(self) -> bool: ...
92-
# the following methods are all deprecated
93-
def getName(self) -> str: ...
94-
def setName(self, name: str) -> None: ...
95+
@deprecated("Get the daemon attribute instead")
9596
def isDaemon(self) -> bool: ...
97+
@deprecated("Set the daemon attribute instead")
9698
def setDaemon(self, daemonic: bool) -> None: ...
99+
@deprecated("Use the name attribute instead")
100+
def getName(self) -> str: ...
101+
@deprecated("Use the name attribute instead")
102+
def setName(self, name: str) -> None: ...
97103

98104
class _DummyThread(Thread):
99105
def __init__(self) -> None: ...
@@ -124,7 +130,8 @@ class Condition:
124130
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ...
125131
def notify(self, n: int = 1) -> None: ...
126132
def notify_all(self) -> None: ...
127-
def notifyAll(self) -> None: ... # deprecated alias for notify_all()
133+
@deprecated("Use notify_all() instead")
134+
def notifyAll(self) -> None: ...
128135

129136
class Semaphore:
130137
_value: int
@@ -138,7 +145,8 @@ class BoundedSemaphore(Semaphore): ...
138145

139146
class Event:
140147
def is_set(self) -> bool: ...
141-
def isSet(self) -> bool: ... # deprecated alias for is_set()
148+
@deprecated("Use is_set() instead")
149+
def isSet(self) -> bool: ...
142150
def set(self) -> None: ...
143151
def clear(self) -> None: ...
144152
def wait(self, timeout: float | None = None) -> bool: ...

crates/red_knot_vendored/vendor/typeshed/stdlib/tkinter/__init__.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -977,6 +977,7 @@ class Tk(Misc, Wm):
977977
sync: bool = False,
978978
use: str | None = None,
979979
) -> None: ...
980+
# Keep this in sync with ttktheme.ThemedTk. See issue #13858
980981
@overload
981982
def configure(
982983
self,

crates/red_knot_vendored/vendor/typeshed/stdlib/unittest/mock.pyi

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import sys
2+
from _typeshed import MaybeNone
23
from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, Sequence
34
from contextlib import _GeneratorContextManager
45
from types import TracebackType
@@ -69,16 +70,13 @@ _CallValue: TypeAlias = str | tuple[Any, ...] | Mapping[str, Any] | _ArgsKwargs
6970

7071
class _Call(tuple[Any, ...]):
7172
def __new__(
72-
cls, value: _CallValue = (), name: str | None = "", parent: Any | None = None, two: bool = False, from_kall: bool = True
73+
cls, value: _CallValue = (), name: str | None = "", parent: _Call | None = None, two: bool = False, from_kall: bool = True
7374
) -> Self: ...
74-
name: Any
75-
parent: Any
76-
from_kall: Any
7775
def __init__(
7876
self,
7977
value: _CallValue = (),
8078
name: str | None = None,
81-
parent: Any | None = None,
79+
parent: _Call | None = None,
8280
two: bool = False,
8381
from_kall: bool = True,
8482
) -> None: ...
@@ -162,7 +160,7 @@ class NonCallableMock(Base, Any):
162160
side_effect: Any
163161
called: bool
164162
call_count: int
165-
call_args: Any
163+
call_args: _Call | MaybeNone
166164
call_args_list: _CallList
167165
mock_calls: _CallList
168166
def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ...

0 commit comments

Comments
 (0)