From 375cead202d69e04658c632d0ea886240aef0743 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Thu, 14 Nov 2024 22:29:29 -0800 Subject: [PATCH] Sync vendored typeshed stubs (#14350) --- .../vendor/typeshed/source_commit.txt | 2 +- .../vendor/typeshed/stdlib/VERSIONS | 7 ++ .../vendor/typeshed/stdlib/_bz2.pyi | 18 ++++ .../vendor/typeshed/stdlib/_contextvars.pyi | 61 ++++++++++++ .../vendor/typeshed/stdlib/_dbm.pyi | 43 +++++++++ .../stdlib/_frozen_importlib_external.pyi | 4 +- .../vendor/typeshed/stdlib/_gdbm.pyi | 47 +++++++++ .../vendor/typeshed/stdlib/_io.pyi | 34 ++++--- .../vendor/typeshed/stdlib/_lzma.pyi | 60 ++++++++++++ .../vendor/typeshed/stdlib/_queue.pyi | 20 ++++ .../vendor/typeshed/stdlib/_struct.pyi | 22 +++++ .../typeshed/stdlib/_threading_local.pyi | 3 +- .../vendor/typeshed/stdlib/builtins.pyi | 6 +- .../vendor/typeshed/stdlib/bz2.pyi | 19 +--- .../vendor/typeshed/stdlib/contextvars.pyi | 62 +----------- .../vendor/typeshed/stdlib/dbm/gnu.pyi | 48 +--------- .../vendor/typeshed/stdlib/dbm/ndbm.pyi | 44 +-------- .../typeshed/stdlib/distutils/ccompiler.pyi | 4 +- .../vendor/typeshed/stdlib/fractions.pyi | 10 +- .../vendor/typeshed/stdlib/getopt.pyi | 8 +- .../vendor/typeshed/stdlib/ipaddress.pyi | 41 +++++--- .../vendor/typeshed/stdlib/logging/config.pyi | 6 +- .../typeshed/stdlib/logging/handlers.pyi | 2 + .../vendor/typeshed/stdlib/lzma.pyi | 95 +++++++------------ .../vendor/typeshed/stdlib/mmap.pyi | 19 +++- .../stdlib/multiprocessing/managers.pyi | 80 +++++++++++----- .../typeshed/stdlib/multiprocessing/spawn.pyi | 2 +- .../vendor/typeshed/stdlib/queue.pyi | 13 +-- .../vendor/typeshed/stdlib/struct.pyi | 23 +---- .../vendor/typeshed/stdlib/tarfile.pyi | 4 +- 30 files changed, 472 insertions(+), 335 deletions(-) create mode 100644 crates/red_knot_vendored/vendor/typeshed/stdlib/_bz2.pyi create mode 100644 crates/red_knot_vendored/vendor/typeshed/stdlib/_contextvars.pyi create mode 100644 crates/red_knot_vendored/vendor/typeshed/stdlib/_dbm.pyi create mode 100644 crates/red_knot_vendored/vendor/typeshed/stdlib/_gdbm.pyi create mode 100644 crates/red_knot_vendored/vendor/typeshed/stdlib/_lzma.pyi create mode 100644 crates/red_knot_vendored/vendor/typeshed/stdlib/_queue.pyi create mode 100644 crates/red_knot_vendored/vendor/typeshed/stdlib/_struct.pyi diff --git a/crates/red_knot_vendored/vendor/typeshed/source_commit.txt b/crates/red_knot_vendored/vendor/typeshed/source_commit.txt index ca51c736ffcab..905099a75eaaf 100644 --- a/crates/red_knot_vendored/vendor/typeshed/source_commit.txt +++ b/crates/red_knot_vendored/vendor/typeshed/source_commit.txt @@ -1 +1 @@ -d262beb07502cda412db2179fb406d45d1a9486f +5052fa2f18db4493892e0f2775030683c9d06531 diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/VERSIONS b/crates/red_knot_vendored/vendor/typeshed/stdlib/VERSIONS index 7c9f3cfda837d..702fdbab75c07 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/VERSIONS +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/VERSIONS @@ -24,18 +24,22 @@ _asyncio: 3.0- _bisect: 3.0- _blake2: 3.6- _bootlocale: 3.4-3.9 +_bz2: 3.3- _codecs: 3.0- _collections_abc: 3.3- _compat_pickle: 3.1- _compression: 3.5- +_contextvars: 3.7- _csv: 3.0- _ctypes: 3.0- _curses: 3.0- +_dbm: 3.0- _decimal: 3.3- _dummy_thread: 3.0-3.8 _dummy_threading: 3.0-3.8 _frozen_importlib: 3.0- _frozen_importlib_external: 3.5- +_gdbm: 3.0- _heapq: 3.0- _imp: 3.0- _interpchannels: 3.13- @@ -45,6 +49,7 @@ _io: 3.0- _json: 3.0- _locale: 3.0- _lsprof: 3.0- +_lzma: 3.3- _markupbase: 3.0- _msi: 3.0-3.12 _operator: 3.4- @@ -52,12 +57,14 @@ _osx_support: 3.0- _posixsubprocess: 3.2- _py_abc: 3.7- _pydecimal: 3.5- +_queue: 3.7- _random: 3.0- _sitebuiltins: 3.4- _socket: 3.0- # present in 3.0 at runtime, but not in typeshed _sqlite3: 3.0- _ssl: 3.0- _stat: 3.4- +_struct: 3.0- _thread: 3.0- _threading_local: 3.0- _tkinter: 3.0- diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_bz2.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_bz2.pyi new file mode 100644 index 0000000000000..4ba26fe96be02 --- /dev/null +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_bz2.pyi @@ -0,0 +1,18 @@ +from _typeshed import ReadableBuffer +from typing import final + +@final +class BZ2Compressor: + def __init__(self, compresslevel: int = 9) -> None: ... + def compress(self, data: ReadableBuffer, /) -> bytes: ... + def flush(self) -> bytes: ... + +@final +class BZ2Decompressor: + def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ... + @property + def eof(self) -> bool: ... + @property + def needs_input(self) -> bool: ... + @property + def unused_data(self) -> bytes: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_contextvars.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_contextvars.pyi new file mode 100644 index 0000000000000..2e21a8c5d017d --- /dev/null +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_contextvars.pyi @@ -0,0 +1,61 @@ +import sys +from collections.abc import Callable, Iterator, Mapping +from typing import Any, ClassVar, Generic, TypeVar, final, overload +from typing_extensions import ParamSpec + +if sys.version_info >= (3, 9): + from types import GenericAlias + +_T = TypeVar("_T") +_D = TypeVar("_D") +_P = ParamSpec("_P") + +@final +class ContextVar(Generic[_T]): + @overload + def __init__(self, name: str) -> None: ... + @overload + def __init__(self, name: str, *, default: _T) -> None: ... + def __hash__(self) -> int: ... + @property + def name(self) -> str: ... + @overload + def get(self) -> _T: ... + @overload + def get(self, default: _T, /) -> _T: ... + @overload + def get(self, default: _D, /) -> _D | _T: ... + def set(self, value: _T, /) -> Token[_T]: ... + def reset(self, token: Token[_T], /) -> None: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... + +@final +class Token(Generic[_T]): + @property + def var(self) -> ContextVar[_T]: ... + @property + def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express + MISSING: ClassVar[object] + if sys.version_info >= (3, 9): + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... + +def copy_context() -> Context: ... + +# It doesn't make sense to make this generic, because for most Contexts each ContextVar will have +# a different value. +@final +class Context(Mapping[ContextVar[Any], Any]): + def __init__(self) -> None: ... + @overload + def get(self, key: ContextVar[_T], default: None = None, /) -> _T | None: ... + @overload + def get(self, key: ContextVar[_T], default: _T, /) -> _T: ... + @overload + def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ... + def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... + def copy(self) -> Context: ... + def __getitem__(self, key: ContextVar[_T], /) -> _T: ... + def __iter__(self) -> Iterator[ContextVar[Any]]: ... + def __len__(self) -> int: ... + def __eq__(self, value: object, /) -> bool: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_dbm.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_dbm.pyi new file mode 100644 index 0000000000000..4113a7e3ffb9b --- /dev/null +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_dbm.pyi @@ -0,0 +1,43 @@ +import sys +from _typeshed import ReadOnlyBuffer, StrOrBytesPath +from types import TracebackType +from typing import TypeVar, overload +from typing_extensions import Self, TypeAlias + +if sys.platform != "win32": + _T = TypeVar("_T") + _KeyType: TypeAlias = str | ReadOnlyBuffer + _ValueType: TypeAlias = str | ReadOnlyBuffer + + class error(OSError): ... + library: str + + # Actual typename dbm, not exposed by the implementation + class _dbm: + def close(self) -> None: ... + if sys.version_info >= (3, 13): + def clear(self) -> None: ... + + def __getitem__(self, item: _KeyType) -> bytes: ... + def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... + def __delitem__(self, key: _KeyType) -> None: ... + def __len__(self) -> int: ... + def __del__(self) -> None: ... + def __enter__(self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + @overload + def get(self, k: _KeyType) -> bytes | None: ... + @overload + def get(self, k: _KeyType, default: _T) -> bytes | _T: ... + def keys(self) -> list[bytes]: ... + def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... + # Don't exist at runtime + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] + + if sys.version_info >= (3, 11): + def open(filename: StrOrBytesPath, flags: str = "r", mode: int = 0o666, /) -> _dbm: ... + else: + def open(filename: str, flags: str = "r", mode: int = 0o666, /) -> _dbm: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi index 933d7466248eb..d3127666da301 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_frozen_importlib_external.pyi @@ -107,9 +107,9 @@ class FileLoader: def get_filename(self, name: str | None = None) -> str: ... def load_module(self, name: str | None = None) -> types.ModuleType: ... if sys.version_info >= (3, 10): - def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.FileReader: ... + def get_resource_reader(self, name: str | None = None) -> importlib.readers.FileReader: ... else: - def get_resource_reader(self, module: types.ModuleType) -> Self | None: ... + def get_resource_reader(self, name: str | None = None) -> Self | None: ... def open_resource(self, resource: str) -> _io.FileIO: ... def resource_path(self, resource: str) -> str: ... def is_resource(self, name: str) -> bool: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_gdbm.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_gdbm.pyi new file mode 100644 index 0000000000000..1d1d541f54770 --- /dev/null +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_gdbm.pyi @@ -0,0 +1,47 @@ +import sys +from _typeshed import ReadOnlyBuffer, StrOrBytesPath +from types import TracebackType +from typing import TypeVar, overload +from typing_extensions import Self, TypeAlias + +if sys.platform != "win32": + _T = TypeVar("_T") + _KeyType: TypeAlias = str | ReadOnlyBuffer + _ValueType: TypeAlias = str | ReadOnlyBuffer + + open_flags: str + + class error(OSError): ... + # Actual typename gdbm, not exposed by the implementation + class _gdbm: + def firstkey(self) -> bytes | None: ... + def nextkey(self, key: _KeyType) -> bytes | None: ... + def reorganize(self) -> None: ... + def sync(self) -> None: ... + def close(self) -> None: ... + if sys.version_info >= (3, 13): + def clear(self) -> None: ... + + def __getitem__(self, item: _KeyType) -> bytes: ... + def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... + def __delitem__(self, key: _KeyType) -> None: ... + def __contains__(self, key: _KeyType) -> bool: ... + def __len__(self) -> int: ... + def __enter__(self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + @overload + def get(self, k: _KeyType) -> bytes | None: ... + @overload + def get(self, k: _KeyType, default: _T) -> bytes | _T: ... + def keys(self) -> list[bytes]: ... + def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... + # Don't exist at runtime + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] + + if sys.version_info >= (3, 11): + def open(filename: StrOrBytesPath, flags: str = "r", mode: int = 0o666, /) -> _gdbm: ... + else: + def open(filename: str, flags: str = "r", mode: int = 0o666, /) -> _gdbm: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_io.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_io.pyi index ccd47726f3564..284d99f92b60d 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/_io.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_io.pyi @@ -33,10 +33,10 @@ class _IOBase: def readable(self) -> bool: ... read: Callable[..., Any] def readlines(self, hint: int = -1, /) -> list[bytes]: ... - def seek(self, offset: int, whence: int = ..., /) -> int: ... + def seek(self, offset: int, whence: int = 0, /) -> int: ... def seekable(self) -> bool: ... def tell(self) -> int: ... - def truncate(self, size: int | None = ..., /) -> int: ... + def truncate(self, size: int | None = None, /) -> int: ... def writable(self) -> bool: ... write: Callable[..., Any] def writelines(self, lines: Iterable[ReadableBuffer], /) -> None: ... @@ -59,8 +59,8 @@ class _BufferedIOBase(_IOBase): def readinto(self, buffer: WriteableBuffer, /) -> int: ... def write(self, buffer: ReadableBuffer, /) -> int: ... def readinto1(self, buffer: WriteableBuffer, /) -> int: ... - def read(self, size: int | None = ..., /) -> bytes: ... - def read1(self, size: int = ..., /) -> bytes: ... + def read(self, size: int | None = -1, /) -> bytes: ... + def read1(self, size: int = -1, /) -> bytes: ... class FileIO(RawIOBase, _RawIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of writelines in the base classes mode: str @@ -69,13 +69,15 @@ class FileIO(RawIOBase, _RawIOBase, BinaryIO): # type: ignore[misc] # incompat # "name" is a str. In the future, making FileIO generic might help. name: Any def __init__( - self, file: FileDescriptorOrPath, mode: str = ..., closefd: bool = ..., opener: _Opener | None = ... + self, file: FileDescriptorOrPath, mode: str = "r", closefd: bool = True, opener: _Opener | None = None ) -> None: ... @property def closefd(self) -> bool: ... + def seek(self, pos: int, whence: int = 0, /) -> int: ... + def read(self, size: int | None = -1, /) -> bytes | MaybeNone: ... class BytesIO(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes - def __init__(self, initial_bytes: ReadableBuffer = ...) -> None: ... + def __init__(self, initial_bytes: ReadableBuffer = b"") -> None: ... # BytesIO does not contain a "name" field. This workaround is necessary # to allow BytesIO sub-classes to add this field, as it is defined # as a read-only property on IO[]. @@ -83,16 +85,22 @@ class BytesIO(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] def getvalue(self) -> bytes: ... def getbuffer(self) -> memoryview: ... def read1(self, size: int | None = -1, /) -> bytes: ... + def readlines(self, size: int | None = None, /) -> list[bytes]: ... + def seek(self, pos: int, whence: int = 0, /) -> int: ... class BufferedReader(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes raw: RawIOBase def __init__(self, raw: RawIOBase, buffer_size: int = 8192) -> None: ... def peek(self, size: int = 0, /) -> bytes: ... + def seek(self, target: int, whence: int = 0, /) -> int: ... + def truncate(self, pos: int | None = None, /) -> int: ... class BufferedWriter(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of writelines in the base classes raw: RawIOBase def __init__(self, raw: RawIOBase, buffer_size: int = 8192) -> None: ... def write(self, buffer: ReadableBuffer, /) -> int: ... + def seek(self, target: int, whence: int = 0, /) -> int: ... + def truncate(self, pos: int | None = None, /) -> int: ... class BufferedRandom(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of methods in the base classes mode: str @@ -101,10 +109,11 @@ class BufferedRandom(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore def __init__(self, raw: RawIOBase, buffer_size: int = 8192) -> None: ... def seek(self, target: int, whence: int = 0, /) -> int: ... # stubtest needs this def peek(self, size: int = 0, /) -> bytes: ... + def truncate(self, pos: int | None = None, /) -> int: ... class BufferedRWPair(BufferedIOBase, _BufferedIOBase): def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = 8192) -> None: ... - def peek(self, size: int = ..., /) -> bytes: ... + def peek(self, size: int = 0, /) -> bytes: ... class _TextIOBase(_IOBase): encoding: str @@ -115,9 +124,9 @@ class _TextIOBase(_IOBase): def detach(self) -> BinaryIO: ... def write(self, s: str, /) -> int: ... def writelines(self, lines: Iterable[str], /) -> None: ... # type: ignore[override] - def readline(self, size: int = ..., /) -> str: ... # type: ignore[override] + def readline(self, size: int = -1, /) -> str: ... # type: ignore[override] def readlines(self, hint: int = -1, /) -> list[str]: ... # type: ignore[override] - def read(self, size: int | None = ..., /) -> str: ... + def read(self, size: int | None = -1, /) -> str: ... @type_check_only class _WrappedBuffer(Protocol): @@ -177,9 +186,10 @@ class TextIOWrapper(TextIOBase, _TextIOBase, TextIO, Generic[_BufferT_co]): # t # TextIOWrapper's version of seek only supports a limited subset of # operations. def seek(self, cookie: int, whence: int = 0, /) -> int: ... + def truncate(self, pos: int | None = None, /) -> int: ... class StringIO(TextIOBase, _TextIOBase, TextIO): # type: ignore[misc] # incompatible definitions of write in the base classes - def __init__(self, initial_value: str | None = ..., newline: str | None = ...) -> None: ... + def __init__(self, initial_value: str | None = "", newline: str | None = "\n") -> None: ... # StringIO does not contain a "name" field. This workaround is necessary # to allow StringIO sub-classes to add this field, as it is defined # as a read-only property on IO[]. @@ -187,9 +197,11 @@ class StringIO(TextIOBase, _TextIOBase, TextIO): # type: ignore[misc] # incomp def getvalue(self) -> str: ... @property def line_buffering(self) -> bool: ... + def seek(self, pos: int, whence: int = 0, /) -> int: ... + def truncate(self, pos: int | None = None, /) -> int: ... class IncrementalNewlineDecoder: - def __init__(self, decoder: codecs.IncrementalDecoder | None, translate: bool, errors: str = ...) -> None: ... + def __init__(self, decoder: codecs.IncrementalDecoder | None, translate: bool, errors: str = "strict") -> None: ... def decode(self, input: ReadableBuffer | str, final: bool = False) -> str: ... @property def newlines(self) -> str | tuple[str, ...] | None: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_lzma.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_lzma.pyi new file mode 100644 index 0000000000000..1f5be78876c61 --- /dev/null +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_lzma.pyi @@ -0,0 +1,60 @@ +from _typeshed import ReadableBuffer +from collections.abc import Mapping, Sequence +from typing import Any, Final, final +from typing_extensions import TypeAlias + +_FilterChain: TypeAlias = Sequence[Mapping[str, Any]] + +FORMAT_AUTO: Final = 0 +FORMAT_XZ: Final = 1 +FORMAT_ALONE: Final = 2 +FORMAT_RAW: Final = 3 +CHECK_NONE: Final = 0 +CHECK_CRC32: Final = 1 +CHECK_CRC64: Final = 4 +CHECK_SHA256: Final = 10 +CHECK_ID_MAX: Final = 15 +CHECK_UNKNOWN: Final = 16 +FILTER_LZMA1: int # v big number +FILTER_LZMA2: Final = 33 +FILTER_DELTA: Final = 3 +FILTER_X86: Final = 4 +FILTER_IA64: Final = 6 +FILTER_ARM: Final = 7 +FILTER_ARMTHUMB: Final = 8 +FILTER_SPARC: Final = 9 +FILTER_POWERPC: Final = 5 +MF_HC3: Final = 3 +MF_HC4: Final = 4 +MF_BT2: Final = 18 +MF_BT3: Final = 19 +MF_BT4: Final = 20 +MODE_FAST: Final = 1 +MODE_NORMAL: Final = 2 +PRESET_DEFAULT: Final = 6 +PRESET_EXTREME: int # v big number + +@final +class LZMADecompressor: + def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ... + def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ... + @property + def check(self) -> int: ... + @property + def eof(self) -> bool: ... + @property + def unused_data(self) -> bytes: ... + @property + def needs_input(self) -> bool: ... + +@final +class LZMACompressor: + def __init__( + self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... + ) -> None: ... + def compress(self, data: ReadableBuffer, /) -> bytes: ... + def flush(self) -> bytes: ... + +class LZMAError(Exception): ... + +def is_check_supported(check_id: int, /) -> bool: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_queue.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_queue.pyi new file mode 100644 index 0000000000000..0d4caea7442ec --- /dev/null +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_queue.pyi @@ -0,0 +1,20 @@ +import sys +from typing import Any, Generic, TypeVar + +if sys.version_info >= (3, 9): + from types import GenericAlias + +_T = TypeVar("_T") + +class Empty(Exception): ... + +class SimpleQueue(Generic[_T]): + def __init__(self) -> None: ... + def empty(self) -> bool: ... + def get(self, block: bool = True, timeout: float | None = None) -> _T: ... + def get_nowait(self) -> _T: ... + def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ... + def put_nowait(self, item: _T) -> None: ... + def qsize(self) -> int: ... + if sys.version_info >= (3, 9): + def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_struct.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_struct.pyi new file mode 100644 index 0000000000000..662170e869f31 --- /dev/null +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_struct.pyi @@ -0,0 +1,22 @@ +from _typeshed import ReadableBuffer, WriteableBuffer +from collections.abc import Iterator +from typing import Any + +def pack(fmt: str | bytes, /, *v: Any) -> bytes: ... +def pack_into(fmt: str | bytes, buffer: WriteableBuffer, offset: int, /, *v: Any) -> None: ... +def unpack(format: str | bytes, buffer: ReadableBuffer, /) -> tuple[Any, ...]: ... +def unpack_from(format: str | bytes, /, buffer: ReadableBuffer, offset: int = 0) -> tuple[Any, ...]: ... +def iter_unpack(format: str | bytes, buffer: ReadableBuffer, /) -> Iterator[tuple[Any, ...]]: ... +def calcsize(format: str | bytes, /) -> int: ... + +class Struct: + @property + def format(self) -> str: ... + @property + def size(self) -> int: ... + def __init__(self, format: str | bytes) -> None: ... + def pack(self, *v: Any) -> bytes: ... + def pack_into(self, buffer: WriteableBuffer, offset: int, *v: Any) -> None: ... + def unpack(self, buffer: ReadableBuffer, /) -> tuple[Any, ...]: ... + def unpack_from(self, buffer: ReadableBuffer, offset: int = 0) -> tuple[Any, ...]: ... + def iter_unpack(self, buffer: ReadableBuffer, /) -> Iterator[tuple[Any, ...]]: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/_threading_local.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/_threading_local.pyi index 98683dabcef8f..f9ac942278b95 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/_threading_local.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/_threading_local.pyi @@ -1,5 +1,5 @@ from typing import Any -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias from weakref import ReferenceType __all__ = ["local"] @@ -12,6 +12,7 @@ class _localimpl: def create_dict(self) -> _LocalDict: ... class local: + def __new__(cls, /, *args: Any, **kw: Any) -> Self: ... def __getattribute__(self, name: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... def __delattr__(self, name: str) -> None: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/builtins.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/builtins.pyi index 2fea1b29a4342..14ad7ebaf601c 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/builtins.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/builtins.pyi @@ -1284,9 +1284,7 @@ class property: @final class _NotImplementedType(Any): - # A little weird, but typing the __call__ as NotImplemented makes the error message - # for NotImplemented() much better - __call__: NotImplemented # type: ignore[valid-type] # pyright: ignore[reportInvalidTypeForm] + __call__: None NotImplemented: _NotImplementedType @@ -1917,7 +1915,7 @@ class StopIteration(Exception): class OSError(Exception): errno: int | None - strerror: str + strerror: str | None # filename, filename2 are actually str | bytes | None filename: Any filename2: Any diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/bz2.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/bz2.pyi index cd11baa1a0c1c..ee5587031f2aa 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/bz2.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/bz2.pyi @@ -1,9 +1,10 @@ import _compression import sys +from _bz2 import BZ2Compressor as BZ2Compressor, BZ2Decompressor as BZ2Decompressor from _compression import BaseStream from _typeshed import ReadableBuffer, StrOrBytesPath, WriteableBuffer from collections.abc import Iterable -from typing import IO, Any, Literal, Protocol, SupportsIndex, TextIO, final, overload +from typing import IO, Any, Literal, Protocol, SupportsIndex, TextIO, overload from typing_extensions import Self, TypeAlias __all__ = ["BZ2File", "BZ2Compressor", "BZ2Decompressor", "open", "compress", "decompress"] @@ -128,19 +129,3 @@ class BZ2File(BaseStream, IO[bytes]): def seek(self, offset: int, whence: int = 0) -> int: ... def write(self, data: ReadableBuffer) -> int: ... def writelines(self, seq: Iterable[ReadableBuffer]) -> None: ... - -@final -class BZ2Compressor: - def __init__(self, compresslevel: int = 9) -> None: ... - def compress(self, data: ReadableBuffer, /) -> bytes: ... - def flush(self) -> bytes: ... - -@final -class BZ2Decompressor: - def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ... - @property - def eof(self) -> bool: ... - @property - def needs_input(self) -> bool: ... - @property - def unused_data(self) -> bytes: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/contextvars.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/contextvars.pyi index dd5ea0acbe2c0..22dc33006e9d4 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/contextvars.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/contextvars.pyi @@ -1,63 +1,3 @@ -import sys -from collections.abc import Callable, Iterator, Mapping -from typing import Any, ClassVar, Generic, TypeVar, final, overload -from typing_extensions import ParamSpec - -if sys.version_info >= (3, 9): - from types import GenericAlias +from _contextvars import Context as Context, ContextVar as ContextVar, Token as Token, copy_context as copy_context __all__ = ("Context", "ContextVar", "Token", "copy_context") - -_T = TypeVar("_T") -_D = TypeVar("_D") -_P = ParamSpec("_P") - -@final -class ContextVar(Generic[_T]): - @overload - def __init__(self, name: str) -> None: ... - @overload - def __init__(self, name: str, *, default: _T) -> None: ... - def __hash__(self) -> int: ... - @property - def name(self) -> str: ... - @overload - def get(self) -> _T: ... - @overload - def get(self, default: _T, /) -> _T: ... - @overload - def get(self, default: _D, /) -> _D | _T: ... - def set(self, value: _T, /) -> Token[_T]: ... - def reset(self, token: Token[_T], /) -> None: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... - -@final -class Token(Generic[_T]): - @property - def var(self) -> ContextVar[_T]: ... - @property - def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express - MISSING: ClassVar[object] - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... - -def copy_context() -> Context: ... - -# It doesn't make sense to make this generic, because for most Contexts each ContextVar will have -# a different value. -@final -class Context(Mapping[ContextVar[Any], Any]): - def __init__(self) -> None: ... - @overload - def get(self, key: ContextVar[_T], default: None = None, /) -> _T | None: ... - @overload - def get(self, key: ContextVar[_T], default: _T, /) -> _T: ... - @overload - def get(self, key: ContextVar[_T], default: _D, /) -> _T | _D: ... - def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ... - def copy(self) -> Context: ... - def __getitem__(self, key: ContextVar[_T], /) -> _T: ... - def __iter__(self) -> Iterator[ContextVar[Any]]: ... - def __len__(self) -> int: ... - def __eq__(self, value: object, /) -> bool: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/gnu.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/gnu.pyi index 1d1d541f54770..2dac3d12b0ca4 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/gnu.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/gnu.pyi @@ -1,47 +1 @@ -import sys -from _typeshed import ReadOnlyBuffer, StrOrBytesPath -from types import TracebackType -from typing import TypeVar, overload -from typing_extensions import Self, TypeAlias - -if sys.platform != "win32": - _T = TypeVar("_T") - _KeyType: TypeAlias = str | ReadOnlyBuffer - _ValueType: TypeAlias = str | ReadOnlyBuffer - - open_flags: str - - class error(OSError): ... - # Actual typename gdbm, not exposed by the implementation - class _gdbm: - def firstkey(self) -> bytes | None: ... - def nextkey(self, key: _KeyType) -> bytes | None: ... - def reorganize(self) -> None: ... - def sync(self) -> None: ... - def close(self) -> None: ... - if sys.version_info >= (3, 13): - def clear(self) -> None: ... - - def __getitem__(self, item: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __contains__(self, key: _KeyType) -> bool: ... - def __len__(self) -> int: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - @overload - def get(self, k: _KeyType) -> bytes | None: ... - @overload - def get(self, k: _KeyType, default: _T) -> bytes | _T: ... - def keys(self) -> list[bytes]: ... - def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... - # Don't exist at runtime - __new__: None # type: ignore[assignment] - __init__: None # type: ignore[assignment] - - if sys.version_info >= (3, 11): - def open(filename: StrOrBytesPath, flags: str = "r", mode: int = 0o666, /) -> _gdbm: ... - else: - def open(filename: str, flags: str = "r", mode: int = 0o666, /) -> _gdbm: ... +from _gdbm import * diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/ndbm.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/ndbm.pyi index 4113a7e3ffb9b..66c943ab640be 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/ndbm.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/dbm/ndbm.pyi @@ -1,43 +1 @@ -import sys -from _typeshed import ReadOnlyBuffer, StrOrBytesPath -from types import TracebackType -from typing import TypeVar, overload -from typing_extensions import Self, TypeAlias - -if sys.platform != "win32": - _T = TypeVar("_T") - _KeyType: TypeAlias = str | ReadOnlyBuffer - _ValueType: TypeAlias = str | ReadOnlyBuffer - - class error(OSError): ... - library: str - - # Actual typename dbm, not exposed by the implementation - class _dbm: - def close(self) -> None: ... - if sys.version_info >= (3, 13): - def clear(self) -> None: ... - - def __getitem__(self, item: _KeyType) -> bytes: ... - def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ... - def __delitem__(self, key: _KeyType) -> None: ... - def __len__(self) -> int: ... - def __del__(self) -> None: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - @overload - def get(self, k: _KeyType) -> bytes | None: ... - @overload - def get(self, k: _KeyType, default: _T) -> bytes | _T: ... - def keys(self) -> list[bytes]: ... - def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... - # Don't exist at runtime - __new__: None # type: ignore[assignment] - __init__: None # type: ignore[assignment] - - if sys.version_info >= (3, 11): - def open(filename: StrOrBytesPath, flags: str = "r", mode: int = 0o666, /) -> _dbm: ... - else: - def open(filename: str, flags: str = "r", mode: int = 0o666, /) -> _dbm: ... +from _dbm import * diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/distutils/ccompiler.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/distutils/ccompiler.pyi index e0f33f430e5a0..56617d8a7b8d3 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/distutils/ccompiler.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/distutils/ccompiler.pyi @@ -1,5 +1,5 @@ from _typeshed import BytesPath, StrPath, Unused -from collections.abc import Callable, Iterable +from collections.abc import Callable, Iterable, Sequence from distutils.file_util import _BytesPathT, _StrPathT from typing import Literal, overload from typing_extensions import TypeAlias, TypeVarTuple, Unpack @@ -63,7 +63,7 @@ class CCompiler: def set_executables(self, **args: str) -> None: ... def compile( self, - sources: list[str], + sources: Sequence[StrPath], output_dir: str | None = None, macros: list[_Macro] | None = None, include_dirs: list[str] | None = None, diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/fractions.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/fractions.pyi index 086aff50344c7..fbcfa868cc1bb 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/fractions.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/fractions.pyi @@ -2,7 +2,7 @@ import sys from collections.abc import Callable from decimal import Decimal from numbers import Integral, Rational, Real -from typing import Any, Literal, SupportsIndex, overload +from typing import Any, Literal, Protocol, SupportsIndex, overload from typing_extensions import Self, TypeAlias _ComparableNum: TypeAlias = int | float | Decimal | Real @@ -20,11 +20,19 @@ else: @overload def gcd(a: Integral, b: Integral) -> Integral: ... +class _ConvertibleToIntegerRatio(Protocol): + def as_integer_ratio(self) -> tuple[int | Rational, int | Rational]: ... + class Fraction(Rational): @overload def __new__(cls, numerator: int | Rational = 0, denominator: int | Rational | None = None) -> Self: ... @overload def __new__(cls, value: float | Decimal | str, /) -> Self: ... + + if sys.version_info >= (3, 14): + @overload + def __new__(cls, value: _ConvertibleToIntegerRatio) -> Self: ... + @classmethod def from_float(cls, f: float) -> Self: ... @classmethod diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/getopt.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/getopt.pyi index bc9d4da4796b2..bcc8d9750b199 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/getopt.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/getopt.pyi @@ -1,7 +1,11 @@ +from collections.abc import Iterable + __all__ = ["GetoptError", "error", "getopt", "gnu_getopt"] -def getopt(args: list[str], shortopts: str, longopts: list[str] = []) -> tuple[list[tuple[str, str]], list[str]]: ... -def gnu_getopt(args: list[str], shortopts: str, longopts: list[str] = []) -> tuple[list[tuple[str, str]], list[str]]: ... +def getopt(args: list[str], shortopts: str, longopts: Iterable[str] | str = []) -> tuple[list[tuple[str, str]], list[str]]: ... +def gnu_getopt( + args: list[str], shortopts: str, longopts: Iterable[str] | str = [] +) -> tuple[list[tuple[str, str]], list[str]]: ... class GetoptError(Exception): msg: str diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/ipaddress.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/ipaddress.pyi index fa2faf8e6c13c..fce233e845550 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/ipaddress.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/ipaddress.pyi @@ -128,19 +128,6 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]): @property def hostmask(self) -> _A: ... -class _BaseInterface(_BaseAddress, Generic[_A, _N]): - hostmask: _A - netmask: _A - network: _N - @property - def ip(self) -> _A: ... - @property - def with_hostmask(self) -> str: ... - @property - def with_netmask(self) -> str: ... - @property - def with_prefixlen(self) -> str: ... - class _BaseV4: @property def version(self) -> Literal[4]: ... @@ -154,9 +141,21 @@ class IPv4Address(_BaseV4, _BaseAddress): class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): ... -class IPv4Interface(IPv4Address, _BaseInterface[IPv4Address, IPv4Network]): +class IPv4Interface(IPv4Address): + netmask: IPv4Address + network: IPv4Network def __eq__(self, other: object) -> bool: ... def __hash__(self) -> int: ... + @property + def hostmask(self) -> IPv4Address: ... + @property + def ip(self) -> IPv4Address: ... + @property + def with_hostmask(self) -> str: ... + @property + def with_netmask(self) -> str: ... + @property + def with_prefixlen(self) -> str: ... class _BaseV6: @property @@ -184,9 +183,21 @@ class IPv6Network(_BaseV6, _BaseNetwork[IPv6Address]): @property def is_site_local(self) -> bool: ... -class IPv6Interface(IPv6Address, _BaseInterface[IPv6Address, IPv6Network]): +class IPv6Interface(IPv6Address): + netmask: IPv6Address + network: IPv6Network def __eq__(self, other: object) -> bool: ... def __hash__(self) -> int: ... + @property + def hostmask(self) -> IPv6Address: ... + @property + def ip(self) -> IPv6Address: ... + @property + def with_hostmask(self) -> str: ... + @property + def with_netmask(self) -> str: ... + @property + def with_prefixlen(self) -> str: ... def v4_int_to_packed(address: int) -> bytes: ... def v6_int_to_packed(address: int) -> bytes: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/config.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/config.pyi index af57f36715be1..5c444e66c4c7b 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/config.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/config.pyi @@ -1,6 +1,6 @@ import sys from _typeshed import StrOrBytesPath -from collections.abc import Callable, Hashable, Iterable, Sequence +from collections.abc import Callable, Hashable, Iterable, Mapping, Sequence from configparser import RawConfigParser from re import Pattern from threading import Thread @@ -63,7 +63,7 @@ def dictConfig(config: _DictConfigArgs | dict[str, Any]) -> None: ... if sys.version_info >= (3, 10): def fileConfig( fname: StrOrBytesPath | IO[str] | RawConfigParser, - defaults: dict[str, str] | None = None, + defaults: Mapping[str, str] | None = None, disable_existing_loggers: bool = True, encoding: str | None = None, ) -> None: ... @@ -71,7 +71,7 @@ if sys.version_info >= (3, 10): else: def fileConfig( fname: StrOrBytesPath | IO[str] | RawConfigParser, - defaults: dict[str, str] | None = None, + defaults: Mapping[str, str] | None = None, disable_existing_loggers: bool = True, ) -> None: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/handlers.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/handlers.pyi index 91f9fe57e46f3..d594d6569a7e3 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/handlers.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/logging/handlers.pyi @@ -260,6 +260,8 @@ class QueueHandler(Handler): def __init__(self, queue: _QueueLike[Any]) -> None: ... def prepare(self, record: LogRecord) -> Any: ... def enqueue(self, record: LogRecord) -> None: ... + if sys.version_info >= (3, 12): + listener: QueueListener | None class QueueListener: handlers: tuple[Handler, ...] # undocumented diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/lzma.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/lzma.pyi index 2df2b9a8bd6a4..2f0279f5986bd 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/lzma.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/lzma.pyi @@ -1,7 +1,41 @@ from _compression import BaseStream +from _lzma import ( + CHECK_CRC32 as CHECK_CRC32, + CHECK_CRC64 as CHECK_CRC64, + CHECK_ID_MAX as CHECK_ID_MAX, + CHECK_NONE as CHECK_NONE, + CHECK_SHA256 as CHECK_SHA256, + CHECK_UNKNOWN as CHECK_UNKNOWN, + FILTER_ARM as FILTER_ARM, + FILTER_ARMTHUMB as FILTER_ARMTHUMB, + FILTER_DELTA as FILTER_DELTA, + FILTER_IA64 as FILTER_IA64, + FILTER_LZMA1 as FILTER_LZMA1, + FILTER_LZMA2 as FILTER_LZMA2, + FILTER_POWERPC as FILTER_POWERPC, + FILTER_SPARC as FILTER_SPARC, + FILTER_X86 as FILTER_X86, + FORMAT_ALONE as FORMAT_ALONE, + FORMAT_AUTO as FORMAT_AUTO, + FORMAT_RAW as FORMAT_RAW, + FORMAT_XZ as FORMAT_XZ, + MF_BT2 as MF_BT2, + MF_BT3 as MF_BT3, + MF_BT4 as MF_BT4, + MF_HC3 as MF_HC3, + MF_HC4 as MF_HC4, + MODE_FAST as MODE_FAST, + MODE_NORMAL as MODE_NORMAL, + PRESET_DEFAULT as PRESET_DEFAULT, + PRESET_EXTREME as PRESET_EXTREME, + LZMACompressor as LZMACompressor, + LZMADecompressor as LZMADecompressor, + LZMAError as LZMAError, + _FilterChain, + is_check_supported as is_check_supported, +) from _typeshed import ReadableBuffer, StrOrBytesPath -from collections.abc import Mapping, Sequence -from typing import IO, Any, Final, Literal, TextIO, final, overload +from typing import IO, Literal, TextIO, overload from typing_extensions import Self, TypeAlias __all__ = [ @@ -48,62 +82,6 @@ _OpenTextWritingMode: TypeAlias = Literal["wt", "xt", "at"] _PathOrFile: TypeAlias = StrOrBytesPath | IO[bytes] -_FilterChain: TypeAlias = Sequence[Mapping[str, Any]] - -FORMAT_AUTO: Final = 0 -FORMAT_XZ: Final = 1 -FORMAT_ALONE: Final = 2 -FORMAT_RAW: Final = 3 -CHECK_NONE: Final = 0 -CHECK_CRC32: Final = 1 -CHECK_CRC64: Final = 4 -CHECK_SHA256: Final = 10 -CHECK_ID_MAX: Final = 15 -CHECK_UNKNOWN: Final = 16 -FILTER_LZMA1: int # v big number -FILTER_LZMA2: Final = 33 -FILTER_DELTA: Final = 3 -FILTER_X86: Final = 4 -FILTER_IA64: Final = 6 -FILTER_ARM: Final = 7 -FILTER_ARMTHUMB: Final = 8 -FILTER_SPARC: Final = 9 -FILTER_POWERPC: Final = 5 -MF_HC3: Final = 3 -MF_HC4: Final = 4 -MF_BT2: Final = 18 -MF_BT3: Final = 19 -MF_BT4: Final = 20 -MODE_FAST: Final = 1 -MODE_NORMAL: Final = 2 -PRESET_DEFAULT: Final = 6 -PRESET_EXTREME: int # v big number - -# from _lzma.c -@final -class LZMADecompressor: - def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ... - def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ... - @property - def check(self) -> int: ... - @property - def eof(self) -> bool: ... - @property - def unused_data(self) -> bytes: ... - @property - def needs_input(self) -> bool: ... - -# from _lzma.c -@final -class LZMACompressor: - def __init__( - self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... - ) -> None: ... - def compress(self, data: ReadableBuffer, /) -> bytes: ... - def flush(self) -> bytes: ... - -class LZMAError(Exception): ... - class LZMAFile(BaseStream, IO[bytes]): # type: ignore[misc] # incompatible definitions of writelines in the base classes def __init__( self, @@ -194,4 +172,3 @@ def compress( def decompress( data: ReadableBuffer, format: int = 0, memlimit: int | None = None, filters: _FilterChain | None = None ) -> bytes: ... -def is_check_supported(check_id: int, /) -> bool: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/mmap.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/mmap.pyi index 5be7f7b76ba1c..f94e876237d19 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/mmap.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/mmap.pyi @@ -34,9 +34,22 @@ class mmap: if sys.platform == "win32": def __init__(self, fileno: int, length: int, tagname: str | None = ..., access: int = ..., offset: int = ...) -> None: ... else: - def __init__( - self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... - ) -> None: ... + if sys.version_info >= (3, 13): + def __init__( + self, + fileno: int, + length: int, + flags: int = ..., + prot: int = ..., + access: int = ..., + offset: int = ..., + *, + trackfd: bool = True, + ) -> None: ... + else: + def __init__( + self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... + ) -> None: ... def close(self) -> None: ... def flush(self, offset: int = ..., size: int = ...) -> None: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi index c5a1134377a1b..1669c5f09f978 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/managers.pyi @@ -10,6 +10,7 @@ from typing_extensions import Self, TypeAlias from .connection import Connection from .context import BaseContext from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory +from .util import Finalize as _Finalize __all__ = ["BaseManager", "SyncManager", "BaseProxy", "Token", "SharedMemoryManager"] @@ -60,31 +61,58 @@ class ValueProxy(BaseProxy, Generic[_T]): if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... -class DictProxy(BaseProxy, MutableMapping[_KT, _VT]): - __builtins__: ClassVar[dict[str, Any]] - def __len__(self) -> int: ... - def __getitem__(self, key: _KT, /) -> _VT: ... - def __setitem__(self, key: _KT, value: _VT, /) -> None: ... - def __delitem__(self, key: _KT, /) -> None: ... - def __iter__(self) -> Iterator[_KT]: ... - def copy(self) -> dict[_KT, _VT]: ... - @overload # type: ignore[override] - def get(self, key: _KT, /) -> _VT | None: ... - @overload - def get(self, key: _KT, default: _VT, /) -> _VT: ... - @overload - def get(self, key: _KT, default: _T, /) -> _VT | _T: ... - @overload - def pop(self, key: _KT, /) -> _VT: ... - @overload - def pop(self, key: _KT, default: _VT, /) -> _VT: ... - @overload - def pop(self, key: _KT, default: _T, /) -> _VT | _T: ... - def keys(self) -> list[_KT]: ... # type: ignore[override] - def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] - def values(self) -> list[_VT]: ... # type: ignore[override] - if sys.version_info >= (3, 13): - def __class_getitem__(cls, args: Any, /) -> Any: ... +if sys.version_info >= (3, 13): + class _BaseDictProxy(BaseProxy, MutableMapping[_KT, _VT]): + __builtins__: ClassVar[dict[str, Any]] + def __len__(self) -> int: ... + def __getitem__(self, key: _KT, /) -> _VT: ... + def __setitem__(self, key: _KT, value: _VT, /) -> None: ... + def __delitem__(self, key: _KT, /) -> None: ... + def __iter__(self) -> Iterator[_KT]: ... + def copy(self) -> dict[_KT, _VT]: ... + @overload # type: ignore[override] + def get(self, key: _KT, /) -> _VT | None: ... + @overload + def get(self, key: _KT, default: _VT, /) -> _VT: ... + @overload + def get(self, key: _KT, default: _T, /) -> _VT | _T: ... + @overload + def pop(self, key: _KT, /) -> _VT: ... + @overload + def pop(self, key: _KT, default: _VT, /) -> _VT: ... + @overload + def pop(self, key: _KT, default: _T, /) -> _VT | _T: ... + def keys(self) -> list[_KT]: ... # type: ignore[override] + def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] + def values(self) -> list[_VT]: ... # type: ignore[override] + + class DictProxy(_BaseDictProxy[_KT, _VT]): + def __class_getitem__(cls, args: Any, /) -> GenericAlias: ... + +else: + class DictProxy(BaseProxy, MutableMapping[_KT, _VT]): + __builtins__: ClassVar[dict[str, Any]] + def __len__(self) -> int: ... + def __getitem__(self, key: _KT, /) -> _VT: ... + def __setitem__(self, key: _KT, value: _VT, /) -> None: ... + def __delitem__(self, key: _KT, /) -> None: ... + def __iter__(self) -> Iterator[_KT]: ... + def copy(self) -> dict[_KT, _VT]: ... + @overload # type: ignore[override] + def get(self, key: _KT, /) -> _VT | None: ... + @overload + def get(self, key: _KT, default: _VT, /) -> _VT: ... + @overload + def get(self, key: _KT, default: _T, /) -> _VT | _T: ... + @overload + def pop(self, key: _KT, /) -> _VT: ... + @overload + def pop(self, key: _KT, default: _VT, /) -> _VT: ... + @overload + def pop(self, key: _KT, default: _T, /) -> _VT | _T: ... + def keys(self) -> list[_KT]: ... # type: ignore[override] + def items(self) -> list[tuple[_KT, _VT]]: ... # type: ignore[override] + def values(self) -> list[_VT]: ... # type: ignore[override] class BaseListProxy(BaseProxy, MutableSequence[_T]): __builtins__: ClassVar[dict[str, Any]] @@ -156,7 +184,7 @@ class BaseManager: def get_server(self) -> Server: ... def connect(self) -> None: ... def start(self, initializer: Callable[..., object] | None = None, initargs: Iterable[Any] = ()) -> None: ... - def shutdown(self) -> None: ... # only available after start() was called + shutdown: _Finalize # only available after start() was called def join(self, timeout: float | None = None) -> None: ... # undocumented @property def address(self) -> Any: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi index 43ce2f07d9962..4a97532228974 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/multiprocessing/spawn.pyi @@ -23,7 +23,7 @@ def get_command_line(**kwds: Any) -> list[str]: ... def spawn_main(pipe_handle: int, parent_pid: int | None = None, tracker_fd: int | None = None) -> None: ... # undocumented -def _main(fd: int) -> Any: ... +def _main(fd: int, parent_sentinel: int) -> int: ... def get_preparation_data(name: str) -> dict[str, Any]: ... old_main_modules: list[ModuleType] diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/queue.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/queue.pyi index 16643c99d08df..4fb49cb6102b3 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/queue.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/queue.pyi @@ -1,4 +1,5 @@ import sys +from _queue import Empty as Empty, SimpleQueue as SimpleQueue from threading import Condition, Lock from typing import Any, Generic, TypeVar @@ -11,7 +12,6 @@ if sys.version_info >= (3, 13): _T = TypeVar("_T") -class Empty(Exception): ... class Full(Exception): ... if sys.version_info >= (3, 13): @@ -55,14 +55,3 @@ class PriorityQueue(Queue[_T]): class LifoQueue(Queue[_T]): queue: list[_T] - -class SimpleQueue(Generic[_T]): - def __init__(self) -> None: ... - def empty(self) -> bool: ... - def get(self, block: bool = True, timeout: float | None = None) -> _T: ... - def get_nowait(self) -> _T: ... - def put(self, item: _T, block: bool = True, timeout: float | None = None) -> None: ... - def put_nowait(self, item: _T) -> None: ... - def qsize(self) -> int: ... - if sys.version_info >= (3, 9): - def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/struct.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/struct.pyi index e684632489ea0..2c26908746ecc 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/struct.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/struct.pyi @@ -1,26 +1,5 @@ -from _typeshed import ReadableBuffer, WriteableBuffer -from collections.abc import Iterator -from typing import Any +from _struct import * __all__ = ["calcsize", "pack", "pack_into", "unpack", "unpack_from", "iter_unpack", "Struct", "error"] class error(Exception): ... - -def pack(fmt: str | bytes, /, *v: Any) -> bytes: ... -def pack_into(fmt: str | bytes, buffer: WriteableBuffer, offset: int, /, *v: Any) -> None: ... -def unpack(format: str | bytes, buffer: ReadableBuffer, /) -> tuple[Any, ...]: ... -def unpack_from(format: str | bytes, /, buffer: ReadableBuffer, offset: int = 0) -> tuple[Any, ...]: ... -def iter_unpack(format: str | bytes, buffer: ReadableBuffer, /) -> Iterator[tuple[Any, ...]]: ... -def calcsize(format: str | bytes, /) -> int: ... - -class Struct: - @property - def format(self) -> str: ... - @property - def size(self) -> int: ... - def __init__(self, format: str | bytes) -> None: ... - def pack(self, *v: Any) -> bytes: ... - def pack_into(self, buffer: WriteableBuffer, offset: int, *v: Any) -> None: ... - def unpack(self, buffer: ReadableBuffer, /) -> tuple[Any, ...]: ... - def unpack_from(self, buffer: ReadableBuffer, offset: int = 0) -> tuple[Any, ...]: ... - def iter_unpack(self, buffer: ReadableBuffer, /) -> Iterator[tuple[Any, ...]]: ... diff --git a/crates/red_knot_vendored/vendor/typeshed/stdlib/tarfile.pyi b/crates/red_knot_vendored/vendor/typeshed/stdlib/tarfile.pyi index 4d9ede57ea998..a7135d8150ee9 100644 --- a/crates/red_knot_vendored/vendor/typeshed/stdlib/tarfile.pyi +++ b/crates/red_knot_vendored/vendor/typeshed/stdlib/tarfile.pyi @@ -1,7 +1,7 @@ import bz2 import io import sys -from _typeshed import StrOrBytesPath, StrPath +from _typeshed import StrOrBytesPath, StrPath, SupportsRead from builtins import list as _list # aliases to avoid name clashes with fields named "type" or "list" from collections.abc import Callable, Iterable, Iterator, Mapping from gzip import _ReadableFileobj as _GzipReadableFileobj, _WritableFileobj as _GzipWritableFileobj @@ -481,7 +481,7 @@ class TarFile: *, filter: Callable[[TarInfo], TarInfo | None] | None = None, ) -> None: ... - def addfile(self, tarinfo: TarInfo, fileobj: IO[bytes] | None = None) -> None: ... + def addfile(self, tarinfo: TarInfo, fileobj: SupportsRead[bytes] | None = None) -> None: ... def gettarinfo( self, name: StrOrBytesPath | None = None, arcname: str | None = None, fileobj: IO[bytes] | None = None ) -> TarInfo: ...