diff --git a/packages/pyright-internal/src/tests/samples/coroutines2.py b/packages/pyright-internal/src/tests/samples/coroutines2.py index 6cb017e83b73..510163156629 100644 --- a/packages/pyright-internal/src/tests/samples/coroutines2.py +++ b/packages/pyright-internal/src/tests/samples/coroutines2.py @@ -5,10 +5,8 @@ from typing import Any, Coroutine -async def inspector(coro: Coroutine[Any, Any, Any]): - assert coro.cr_frame is not None - print(coro.cr_frame.f_locals) - return await coro +async def inspector(cr: Coroutine[Any, Any, Any]): + return await cr async def inner(sleep: int, message: str) -> str: diff --git a/packages/pyright-internal/typeshed-fallback/README.md b/packages/pyright-internal/typeshed-fallback/README.md index 9776813d07ea..b52ecf3a5de9 100644 --- a/packages/pyright-internal/typeshed-fallback/README.md +++ b/packages/pyright-internal/typeshed-fallback/README.md @@ -21,7 +21,7 @@ the project the stubs are for, but instead report them here to typeshed.** Further documentation on stub files, typeshed, and Python's typing system in general, can also be found at https://typing.readthedocs.io/en/latest/. -Typeshed supports Python versions 3.8 to 3.13. +Typeshed supports Python versions 3.9 to 3.13. ## Using diff --git a/packages/pyright-internal/typeshed-fallback/commit.txt b/packages/pyright-internal/typeshed-fallback/commit.txt index ee0e813f0467..22c527ecbe4b 100644 --- a/packages/pyright-internal/typeshed-fallback/commit.txt +++ b/packages/pyright-internal/typeshed-fallback/commit.txt @@ -1 +1 @@ -2ccc53bb6716463680fcf1d204642c46299b7f88 +c2e4ef3ae495272f902071dcf4a0f7701c00c4a2 diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS b/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS index 7ff14c55d3a8..3c6898dc1a77 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS +++ b/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS @@ -57,6 +57,7 @@ _msi: 3.0-3.12 _multibytecodec: 3.0- _operator: 3.4- _osx_support: 3.0- +_pickle: 3.0- _posixsubprocess: 3.2- _py_abc: 3.7- _pydecimal: 3.5- diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_asyncio.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_asyncio.pyi index a259026615aa..89cdff6cc283 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_asyncio.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_asyncio.pyi @@ -65,7 +65,7 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn self, coro: _TaskCompatibleCoro[_T_co], *, - loop: AbstractEventLoop = ..., + loop: AbstractEventLoop | None = None, name: str | None = ..., context: Context | None = None, eager_start: bool = False, @@ -75,13 +75,13 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn self, coro: _TaskCompatibleCoro[_T_co], *, - loop: AbstractEventLoop = ..., + loop: AbstractEventLoop | None = None, name: str | None = ..., context: Context | None = None, ) -> None: ... else: def __init__( - self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop = ..., name: str | None = ... + self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = ... ) -> None: ... if sys.version_info >= (3, 12): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_blake2.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_blake2.pyi index 10d7019a222f..3d17cb59c79b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_blake2.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_blake2.pyi @@ -22,8 +22,8 @@ class blake2b: digest_size: int name: str if sys.version_info >= (3, 9): - def __init__( - self, + def __new__( + cls, data: ReadableBuffer = b"", /, *, @@ -39,10 +39,10 @@ class blake2b: inner_size: int = 0, last_node: bool = False, usedforsecurity: bool = True, - ) -> None: ... + ) -> Self: ... else: - def __init__( - self, + def __new__( + cls, data: ReadableBuffer = b"", /, *, @@ -57,7 +57,7 @@ class blake2b: node_depth: int = 0, inner_size: int = 0, last_node: bool = False, - ) -> None: ... + ) -> Self: ... def copy(self) -> Self: ... def digest(self) -> bytes: ... @@ -74,8 +74,8 @@ class blake2s: digest_size: int name: str if sys.version_info >= (3, 9): - def __init__( - self, + def __new__( + cls, data: ReadableBuffer = b"", /, *, @@ -91,10 +91,10 @@ class blake2s: inner_size: int = 0, last_node: bool = False, usedforsecurity: bool = True, - ) -> None: ... + ) -> Self: ... else: - def __init__( - self, + def __new__( + cls, data: ReadableBuffer = b"", /, *, @@ -109,7 +109,7 @@ class blake2s: node_depth: int = 0, inner_size: int = 0, last_node: bool = False, - ) -> None: ... + ) -> Self: ... def copy(self) -> Self: ... def digest(self) -> bytes: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_bz2.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_bz2.pyi index 4ba26fe96be0..fdad932ca22e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_bz2.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_bz2.pyi @@ -1,9 +1,15 @@ +import sys from _typeshed import ReadableBuffer from typing import final +from typing_extensions import Self @final class BZ2Compressor: - def __init__(self, compresslevel: int = 9) -> None: ... + if sys.version_info >= (3, 12): + def __new__(cls, compresslevel: int = 9, /) -> Self: ... + else: + def __init__(self, compresslevel: int = 9, /) -> None: ... + def compress(self, data: ReadableBuffer, /) -> bytes: ... def flush(self) -> bytes: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi index bf7f2991f9a4..8bac0ce1dca3 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_collections_abc.pyi @@ -8,6 +8,7 @@ from typing import ( # noqa: Y022,Y038 AsyncIterator as AsyncIterator, Awaitable as Awaitable, Callable as Callable, + ClassVar, Collection as Collection, Container as Container, Coroutine as Coroutine, @@ -74,6 +75,7 @@ _VT_co = TypeVar("_VT_co", covariant=True) # Value type covariant containers. class dict_keys(KeysView[_KT_co], Generic[_KT_co, _VT_co]): # undocumented def __eq__(self, value: object, /) -> bool: ... def __reversed__(self) -> Iterator[_KT_co]: ... + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 13): def isdisjoint(self, other: Iterable[_KT_co], /) -> bool: ... if sys.version_info >= (3, 10): @@ -91,6 +93,7 @@ class dict_values(ValuesView[_VT_co], Generic[_KT_co, _VT_co]): # undocumented class dict_items(ItemsView[_KT_co, _VT_co]): # undocumented def __eq__(self, value: object, /) -> bool: ... def __reversed__(self) -> Iterator[tuple[_KT_co, _VT_co]]: ... + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 13): def isdisjoint(self, other: Iterable[tuple[_KT_co, _VT_co]], /) -> bool: ... if sys.version_info >= (3, 10): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_contextvars.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_contextvars.pyi index 2e21a8c5d017..c7d0814b3cb4 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_contextvars.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_contextvars.pyi @@ -1,7 +1,7 @@ import sys from collections.abc import Callable, Iterator, Mapping from typing import Any, ClassVar, Generic, TypeVar, final, overload -from typing_extensions import ParamSpec +from typing_extensions import ParamSpec, Self if sys.version_info >= (3, 9): from types import GenericAlias @@ -13,9 +13,9 @@ _P = ParamSpec("_P") @final class ContextVar(Generic[_T]): @overload - def __init__(self, name: str) -> None: ... + def __new__(cls, name: str) -> Self: ... @overload - def __init__(self, name: str, *, default: _T) -> None: ... + def __new__(cls, name: str, *, default: _T) -> Self: ... def __hash__(self) -> int: ... @property def name(self) -> str: ... @@ -37,6 +37,7 @@ class Token(Generic[_T]): @property def old_value(self) -> Any: ... # returns either _T or MISSING, but that's hard to express MISSING: ClassVar[object] + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 9): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... @@ -55,6 +56,7 @@ class Context(Mapping[ContextVar[Any], Any]): 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: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __getitem__(self, key: ContextVar[_T], /) -> _T: ... def __iter__(self) -> Iterator[ContextVar[Any]]: ... def __len__(self) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi index afa2870be158..aa9fc538417e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_csv.pyi @@ -32,8 +32,8 @@ class Dialect: lineterminator: str quoting: _QuotingType strict: bool - def __init__( - self, + def __new__( + cls, dialect: _DialectLike | None = ..., delimiter: str = ",", doublequote: bool = True, @@ -43,7 +43,7 @@ class Dialect: quoting: _QuotingType = 0, skipinitialspace: bool = False, strict: bool = False, - ) -> None: ... + ) -> Self: ... if sys.version_info >= (3, 10): # This class calls itself _csv.reader. @@ -115,7 +115,7 @@ def reader( ) -> _reader: ... def register_dialect( name: str, - dialect: type[Dialect] = ..., + dialect: type[Dialect | csv.Dialect] = ..., *, delimiter: str = ",", quotechar: str | None = '"', diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi index 1f3f8f38802b..0ce1cb39eff6 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_ctypes.pyi @@ -169,18 +169,18 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType): # Abstract attribute that must be defined on subclasses _flags_: ClassVar[int] @overload - def __init__(self) -> None: ... + def __new__(cls) -> Self: ... @overload - def __init__(self, address: int, /) -> None: ... + def __new__(cls, address: int, /) -> Self: ... @overload - def __init__(self, callable: Callable[..., Any], /) -> None: ... + def __new__(cls, callable: Callable[..., Any], /) -> Self: ... @overload - def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> None: ... + def __new__(cls, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> Self: ... if sys.platform == "win32": @overload - def __init__( - self, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., / - ) -> None: ... + def __new__( + cls, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., / + ) -> Self: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi index 9e06a1414da5..52c5185727e7 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi @@ -1,7 +1,7 @@ import sys -from _typeshed import ReadOnlyBuffer, SupportsRead +from _typeshed import ReadOnlyBuffer, SupportsRead, SupportsWrite from curses import _ncurses_version -from typing import IO, Any, final, overload +from typing import Any, final, overload from typing_extensions import TypeAlias # NOTE: This module is ordinarily only available on Unix, but the windows-curses @@ -517,7 +517,7 @@ class window: # undocumented def overwrite( self, destwin: window, sminrow: int, smincol: int, dminrow: int, dmincol: int, dmaxrow: int, dmaxcol: int ) -> None: ... - def putwin(self, file: IO[Any], /) -> None: ... + def putwin(self, file: SupportsWrite[bytes], /) -> None: ... def redrawln(self, beg: int, num: int, /) -> None: ... def redrawwin(self) -> None: ... @overload diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_dummy_threading.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_dummy_threading.pyi index 21d1d1921c0e..1b66fb414d7a 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_dummy_threading.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_dummy_threading.pyi @@ -1,11 +1,23 @@ -import sys -from _thread import _excepthook, _ExceptHookArgs +from _threading_local import local as local from _typeshed import ProfileFunction, TraceFunction -from collections.abc import Callable, Iterable, Mapping -from types import TracebackType -from typing import Any, TypeVar - -_T = TypeVar("_T") +from threading import ( + TIMEOUT_MAX as TIMEOUT_MAX, + Barrier as Barrier, + BoundedSemaphore as BoundedSemaphore, + BrokenBarrierError as BrokenBarrierError, + Condition as Condition, + Event as Event, + ExceptHookArgs as ExceptHookArgs, + Lock as Lock, + RLock as RLock, + Semaphore as Semaphore, + Thread as Thread, + ThreadError as ThreadError, + Timer as Timer, + _DummyThread as _DummyThread, + _RLock as _RLock, + excepthook as excepthook, +) __all__ = [ "get_ident", @@ -42,123 +54,3 @@ def main_thread() -> Thread: ... def settrace(func: TraceFunction) -> None: ... def setprofile(func: ProfileFunction | None) -> None: ... def stack_size(size: int | None = None) -> int: ... - -TIMEOUT_MAX: float - -class ThreadError(Exception): ... - -class local: - def __getattribute__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, name: str) -> None: ... - -class Thread: - name: str - daemon: bool - @property - def ident(self) -> int | None: ... - def __init__( - self, - group: None = None, - target: Callable[..., object] | None = None, - name: str | None = None, - args: Iterable[Any] = (), - kwargs: Mapping[str, Any] | None = None, - *, - daemon: bool | None = None, - ) -> None: ... - def start(self) -> None: ... - def run(self) -> None: ... - def join(self, timeout: float | None = None) -> None: ... - def getName(self) -> str: ... - def setName(self, name: str) -> None: ... - @property - def native_id(self) -> int | None: ... # only available on some platforms - def is_alive(self) -> bool: ... - if sys.version_info < (3, 9): - def isAlive(self) -> bool: ... - - def isDaemon(self) -> bool: ... - def setDaemon(self, daemonic: bool) -> None: ... - -class _DummyThread(Thread): ... - -class Lock: - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... - def release(self) -> None: ... - def locked(self) -> bool: ... - -class _RLock: - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... - def release(self) -> None: ... - -RLock = _RLock - -class Condition: - def __init__(self, lock: Lock | _RLock | None = None) -> None: ... - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... - def release(self) -> None: ... - def wait(self, timeout: float | None = None) -> bool: ... - def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ... - def notify(self, n: int = 1) -> None: ... - def notify_all(self) -> None: ... - def notifyAll(self) -> None: ... - -class Semaphore: - def __init__(self, value: int = 1) -> None: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> bool | None: ... - def acquire(self, blocking: bool = True, timeout: float | None = None) -> bool: ... - def __enter__(self, blocking: bool = True, timeout: float | None = None) -> bool: ... - if sys.version_info >= (3, 9): - def release(self, n: int = ...) -> None: ... - else: - def release(self) -> None: ... - -class BoundedSemaphore(Semaphore): ... - -class Event: - def is_set(self) -> bool: ... - def set(self) -> None: ... - def clear(self) -> None: ... - def wait(self, timeout: float | None = None) -> bool: ... - -excepthook = _excepthook -ExceptHookArgs = _ExceptHookArgs - -class Timer(Thread): - def __init__( - self, - interval: float, - function: Callable[..., object], - args: Iterable[Any] | None = None, - kwargs: Mapping[str, Any] | None = None, - ) -> None: ... - def cancel(self) -> None: ... - -class Barrier: - @property - def parties(self) -> int: ... - @property - def n_waiting(self) -> int: ... - @property - def broken(self) -> bool: ... - def __init__(self, parties: int, action: Callable[[], None] | None = None, timeout: float | None = None) -> None: ... - def wait(self, timeout: float | None = None) -> int: ... - def reset(self) -> None: ... - def abort(self) -> None: ... - -class BrokenBarrierError(RuntimeError): ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_frozen_importlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_frozen_importlib.pyi index b6d7a1842048..3dbc8c6b52f0 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_frozen_importlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_frozen_importlib.pyi @@ -5,7 +5,7 @@ import types from _typeshed.importlib import LoaderProtocol from collections.abc import Mapping, Sequence from types import ModuleType -from typing import Any +from typing import Any, ClassVar # Signature of `builtins.__import__` should be kept identical to `importlib.__import__` def __import__( @@ -43,6 +43,7 @@ class ModuleSpec: def parent(self) -> str | None: ... has_location: bool def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] class BuiltinImporter(importlib.abc.MetaPathFinder, importlib.abc.InspectLoader): # MetaPathFinder diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_interpqueues.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_interpqueues.pyi index db5e4cff5068..c9323b106f3d 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_interpqueues.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_interpqueues.pyi @@ -1,16 +1,19 @@ -from typing import Any, SupportsIndex +from typing import Any, Literal, SupportsIndex +from typing_extensions import TypeAlias + +_UnboundOp: TypeAlias = Literal[1, 2, 3] class QueueError(RuntimeError): ... class QueueNotFoundError(QueueError): ... def bind(qid: SupportsIndex) -> None: ... -def create(maxsize: SupportsIndex, fmt: SupportsIndex) -> int: ... +def create(maxsize: SupportsIndex, fmt: SupportsIndex, unboundop: _UnboundOp) -> int: ... def destroy(qid: SupportsIndex) -> None: ... -def get(qid: SupportsIndex) -> tuple[Any, int]: ... +def get(qid: SupportsIndex) -> tuple[Any, int, _UnboundOp | None]: ... def get_count(qid: SupportsIndex) -> int: ... def get_maxsize(qid: SupportsIndex) -> int: ... -def get_queue_defaults(qid: SupportsIndex) -> tuple[int]: ... +def get_queue_defaults(qid: SupportsIndex) -> tuple[int, _UnboundOp]: ... def is_full(qid: SupportsIndex) -> bool: ... -def list_all() -> list[tuple[int, int]]: ... -def put(qid: SupportsIndex, obj: Any, fmt: SupportsIndex) -> None: ... +def list_all() -> list[tuple[int, int, _UnboundOp]]: ... +def put(qid: SupportsIndex, obj: Any, fmt: SupportsIndex, unboundop: _UnboundOp) -> None: ... def release(qid: SupportsIndex) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_interpreters.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_interpreters.pyi index a57ef13c6d0f..caa1115e9d3d 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_interpreters.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_interpreters.pyi @@ -21,7 +21,9 @@ def get_main() -> tuple[int, int]: ... def is_running(id: SupportsIndex, *, restrict: bool = False) -> bool: ... def get_config(id: SupportsIndex, *, restrict: bool = False) -> types.SimpleNamespace: ... def whence(id: SupportsIndex) -> int: ... -def exec(id: SupportsIndex, code: str, shared: bool | None = None, *, restrict: bool = False) -> None: ... +def exec( + id: SupportsIndex, code: str | types.CodeType | Callable[[], object], shared: bool | None = None, *, restrict: bool = False +) -> None | types.SimpleNamespace: ... def call( id: SupportsIndex, callable: Callable[..., object], diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_io.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_io.pyi index 284d99f92b60..54efd3199760 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_io.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_io.pyi @@ -112,7 +112,7 @@ class BufferedRandom(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore 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 __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = 8192, /) -> None: ... def peek(self, size: int = 0, /) -> bytes: ... class _TextIOBase(_IOBase): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi index e1c7c52ca3b1..5296b8e62a02 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_json.pyi @@ -1,5 +1,6 @@ from collections.abc import Callable from typing import Any, final +from typing_extensions import Self @final class make_encoder: @@ -19,8 +20,8 @@ class make_encoder: def encoder(self) -> Callable[[str], str]: ... @property def item_separator(self) -> str: ... - def __init__( - self, + def __new__( + cls, markers: dict[int, Any] | None, default: Callable[[Any], Any], encoder: Callable[[str], str], @@ -30,7 +31,7 @@ class make_encoder: sort_keys: bool, skipkeys: bool, allow_nan: bool, - ) -> None: ... + ) -> Self: ... def __call__(self, obj: object, _current_indent_level: int) -> Any: ... @final @@ -42,7 +43,7 @@ class make_scanner: parse_float: Any strict: bool # TODO: 'context' needs the attrs above (ducktype), but not __call__. - def __init__(self, context: make_scanner) -> None: ... + def __new__(cls, context: make_scanner) -> Self: ... def __call__(self, string: str, index: int) -> tuple[Any, int]: ... def encode_basestring(s: str, /) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_lzma.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_lzma.pyi index 1f5be78876c6..1a27c7428e8e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_lzma.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_lzma.pyi @@ -1,7 +1,8 @@ +import sys from _typeshed import ReadableBuffer from collections.abc import Mapping, Sequence from typing import Any, Final, final -from typing_extensions import TypeAlias +from typing_extensions import Self, TypeAlias _FilterChain: TypeAlias = Sequence[Mapping[str, Any]] @@ -36,7 +37,11 @@ PRESET_EXTREME: int # v big number @final class LZMADecompressor: - def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ... + if sys.version_info >= (3, 12): + def __new__(cls, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> Self: ... + else: + 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: ... @@ -49,9 +54,15 @@ class LZMADecompressor: @final class LZMACompressor: - def __init__( - self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... - ) -> None: ... + if sys.version_info >= (3, 12): + def __new__( + cls, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ... + ) -> Self: ... + else: + 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: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_pickle.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_pickle.pyi new file mode 100644 index 000000000000..50bbb6bc16cd --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_pickle.pyi @@ -0,0 +1,107 @@ +import sys +from _typeshed import ReadableBuffer, SupportsWrite +from collections.abc import Callable, Iterable, Iterator, Mapping +from pickle import PickleBuffer as PickleBuffer +from typing import Any, Protocol, type_check_only +from typing_extensions import TypeAlias + +class _ReadableFileobj(Protocol): + def read(self, n: int, /) -> bytes: ... + def readline(self) -> bytes: ... + +_BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None + +_ReducedType: TypeAlias = ( + str + | tuple[Callable[..., Any], tuple[Any, ...]] + | tuple[Callable[..., Any], tuple[Any, ...], Any] + | tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None] + | tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None, Iterator[Any] | None] +) + +def dump( + obj: Any, + file: SupportsWrite[bytes], + protocol: int | None = None, + *, + fix_imports: bool = True, + buffer_callback: _BufferCallback = None, +) -> None: ... +def dumps( + obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None +) -> bytes: ... +def load( + file: _ReadableFileobj, + *, + fix_imports: bool = True, + encoding: str = "ASCII", + errors: str = "strict", + buffers: Iterable[Any] | None = (), +) -> Any: ... +def loads( + data: ReadableBuffer, + /, + *, + fix_imports: bool = True, + encoding: str = "ASCII", + errors: str = "strict", + buffers: Iterable[Any] | None = (), +) -> Any: ... + +class PickleError(Exception): ... +class PicklingError(PickleError): ... +class UnpicklingError(PickleError): ... + +@type_check_only +class PicklerMemoProxy: + def clear(self, /) -> None: ... + def copy(self, /) -> dict[int, tuple[int, Any]]: ... + +class Pickler: + fast: bool + dispatch_table: Mapping[type, Callable[[Any], _ReducedType]] + reducer_override: Callable[[Any], Any] + bin: bool # undocumented + def __init__( + self, + file: SupportsWrite[bytes], + protocol: int | None = None, + fix_imports: bool = True, + buffer_callback: _BufferCallback = None, + ) -> None: ... + @property + def memo(self) -> PicklerMemoProxy: ... + @memo.setter + def memo(self, value: PicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ... + def dump(self, obj: Any, /) -> None: ... + def clear_memo(self) -> None: ... + if sys.version_info >= (3, 13): + def persistent_id(self, obj: Any, /) -> Any: ... + else: + persistent_id: Callable[[Any], Any] + +@type_check_only +class UnpicklerMemoProxy: + def clear(self, /) -> None: ... + def copy(self, /) -> dict[int, tuple[int, Any]]: ... + +class Unpickler: + def __init__( + self, + file: _ReadableFileobj, + *, + fix_imports: bool = True, + encoding: str = "ASCII", + errors: str = "strict", + buffers: Iterable[Any] | None = (), + ) -> None: ... + @property + def memo(self) -> UnpicklerMemoProxy: ... + @memo.setter + def memo(self, value: UnpicklerMemoProxy | dict[int, tuple[int, Any]]) -> None: ... + def load(self) -> Any: ... + def find_class(self, module_name: str, global_name: str, /) -> Any: ... + if sys.version_info >= (3, 13): + def persistent_load(self, pid: Any, /) -> Any: ... + else: + persistent_load: Callable[[Any], Any] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_sitebuiltins.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_sitebuiltins.pyi index 49e88a196825..eb6c81129421 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_sitebuiltins.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_sitebuiltins.pyi @@ -1,3 +1,4 @@ +import sys from collections.abc import Iterable from typing import ClassVar, Literal, NoReturn @@ -5,7 +6,7 @@ class Quitter: name: str eof: str def __init__(self, name: str, eof: str) -> None: ... - def __call__(self, code: int | None = None) -> NoReturn: ... + def __call__(self, code: sys._ExitCode = None) -> NoReturn: ... class _Printer: MAXLINES: ClassVar[Literal[23]] @@ -13,4 +14,4 @@ class _Printer: def __call__(self) -> None: ... class _Helper: - def __call__(self, request: object) -> None: ... + def __call__(self, request: object = ...) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi index 36bc5c31c646..4cf71cbcadfa 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_socket.pyi @@ -78,8 +78,10 @@ if sys.platform == "win32": SO_EXCLUSIVEADDRUSE: int if sys.platform != "win32": SO_REUSEPORT: int + if sys.platform != "darwin" or sys.version_info >= (3, 13): + SO_BINDTODEVICE: int + if sys.platform != "win32" and sys.platform != "darwin": - SO_BINDTODEVICE: int SO_DOMAIN: int SO_MARK: int SO_PASSCRED: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_ssl.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_ssl.pyi index 938135eb1192..e39ab5eb6de8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_ssl.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_ssl.pyi @@ -12,7 +12,7 @@ from ssl import ( SSLWantWriteError as SSLWantWriteError, SSLZeroReturnError as SSLZeroReturnError, ) -from typing import Any, Literal, TypedDict, final, overload +from typing import Any, ClassVar, Literal, TypedDict, final, overload from typing_extensions import NotRequired, Self, TypeAlias _PasswordType: TypeAlias = Callable[[], str | bytes | bytearray] | str | bytes | bytearray @@ -119,6 +119,7 @@ class MemoryBIO: @final class SSLSession: + __hash__: ClassVar[None] # type: ignore[assignment] @property def has_ticket(self) -> bool: ... @property @@ -239,9 +240,7 @@ OP_SINGLE_ECDH_USE: int OP_NO_COMPRESSION: int OP_ENABLE_MIDDLEBOX_COMPAT: int OP_NO_RENEGOTIATION: int -if sys.version_info >= (3, 11): - OP_IGNORE_UNEXPECTED_EOF: int -elif sys.version_info >= (3, 8) and sys.platform == "linux": +if sys.version_info >= (3, 11) or sys.platform == "linux": OP_IGNORE_UNEXPECTED_EOF: int if sys.version_info >= (3, 12): OP_LEGACY_SERVER_CONNECT: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi index f0b70ed2a0b0..378ac2423757 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_thread.pyi @@ -13,17 +13,11 @@ error = RuntimeError def _count() -> int: ... @final -class LockType: +class RLock: def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... def release(self) -> None: ... - def locked(self) -> bool: ... - def acquire_lock(self, blocking: bool = True, timeout: float = -1) -> bool: ... - def release_lock(self) -> None: ... - def locked_lock(self) -> bool: ... - def __enter__(self) -> bool: ... - def __exit__( - self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None - ) -> None: ... + __enter__ = acquire + def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... if sys.version_info >= (3, 13): @final @@ -37,7 +31,33 @@ if sys.version_info >= (3, 13): def start_joinable_thread( function: Callable[[], object], handle: _ThreadHandle | None = None, daemon: bool = True ) -> _ThreadHandle: ... - lock = LockType + @final + class lock: + def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... + def release(self) -> None: ... + def locked(self) -> bool: ... + def acquire_lock(self, blocking: bool = True, timeout: float = -1) -> bool: ... + def release_lock(self) -> None: ... + def locked_lock(self) -> bool: ... + def __enter__(self) -> bool: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... + + LockType = lock +else: + @final + class LockType: + def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... + def release(self) -> None: ... + def locked(self) -> bool: ... + def acquire_lock(self, blocking: bool = True, timeout: float = -1) -> bool: ... + def release_lock(self) -> None: ... + def locked_lock(self) -> bool: ... + def __enter__(self) -> bool: ... + def __exit__( + self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None + ) -> None: ... @overload def start_new_thread(function: Callable[[Unpack[_Ts]], object], args: tuple[Unpack[_Ts]], /) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi index 63b1e7ca7cb4..4206a2114f95 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi @@ -113,16 +113,31 @@ TK_VERSION: Final[str] class TkttType: def deletetimerhandler(self): ... -def create( - screenName: str | None = None, - baseName: str = "", - className: str = "Tk", - interactive: bool = False, - wantobjects: bool = False, - wantTk: bool = True, - sync: bool = False, - use: str | None = None, - /, -): ... +if sys.version_info >= (3, 13): + def create( + screenName: str | None = None, + baseName: str = "", + className: str = "Tk", + interactive: bool = False, + wantobjects: int = 0, + wantTk: bool = True, + sync: bool = False, + use: str | None = None, + /, + ): ... + +else: + def create( + screenName: str | None = None, + baseName: str = "", + className: str = "Tk", + interactive: bool = False, + wantobjects: bool = False, + wantTk: bool = True, + sync: bool = False, + use: str | None = None, + /, + ): ... + def getbusywaitinterval(): ... def setbusywaitinterval(new_val, /): ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_weakrefset.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_weakrefset.pyi index 2a4e682f64ed..b55318528208 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_weakrefset.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_weakrefset.pyi @@ -1,6 +1,6 @@ import sys from collections.abc import Iterable, Iterator, MutableSet -from typing import Any, TypeVar, overload +from typing import Any, ClassVar, TypeVar, overload from typing_extensions import Self if sys.version_info >= (3, 9): @@ -21,6 +21,7 @@ class WeakSet(MutableSet[_T]): def copy(self) -> Self: ... def remove(self, item: _T) -> None: ... def update(self, other: Iterable[_T]) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __contains__(self, item: object) -> bool: ... def __len__(self) -> int: ... def __iter__(self) -> Iterator[_T]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi index 2526322ac8f6..b9652ec5f75a 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi @@ -1,8 +1,8 @@ import sys -from _typeshed import sentinel +from _typeshed import SupportsWrite, sentinel from collections.abc import Callable, Generator, Iterable, Sequence from re import Pattern -from typing import IO, Any, Final, Generic, NewType, NoReturn, Protocol, TypeVar, overload +from typing import IO, Any, ClassVar, Final, Generic, NewType, NoReturn, Protocol, TypeVar, overload from typing_extensions import Self, TypeAlias, deprecated __all__ = [ @@ -182,33 +182,33 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def add_subparsers( self: _ArgumentParserT, *, - title: str = ..., - description: str | None = ..., - prog: str = ..., + title: str = "subcommands", + description: str | None = None, + prog: str | None = None, action: type[Action] = ..., option_string: str = ..., - dest: str | None = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | None = ..., + dest: str | None = None, + required: bool = False, + help: str | None = None, + metavar: str | None = None, ) -> _SubParsersAction[_ArgumentParserT]: ... @overload def add_subparsers( self, *, - title: str = ..., - description: str | None = ..., - prog: str = ..., + title: str = "subcommands", + description: str | None = None, + prog: str | None = None, parser_class: type[_ArgumentParserT], action: type[Action] = ..., option_string: str = ..., - dest: str | None = ..., - required: bool = ..., - help: str | None = ..., - metavar: str | None = ..., + dest: str | None = None, + required: bool = False, + help: str | None = None, + metavar: str | None = None, ) -> _SubParsersAction[_ArgumentParserT]: ... - def print_usage(self, file: IO[str] | None = None) -> None: ... - def print_help(self, file: IO[str] | None = None) -> None: ... + def print_usage(self, file: SupportsWrite[str] | None = None) -> None: ... + def print_help(self, file: SupportsWrite[str] | None = None) -> None: ... def format_usage(self) -> str: ... def format_help(self) -> str: ... @overload @@ -237,7 +237,13 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): # undocumented def _get_optional_actions(self) -> list[Action]: ... def _get_positional_actions(self) -> list[Action]: ... - def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> tuple[Namespace, list[str]]: ... + if sys.version_info >= (3, 12): + def _parse_known_args( + self, arg_strings: list[str], namespace: Namespace, intermixed: bool + ) -> tuple[Namespace, list[str]]: ... + else: + def _parse_known_args(self, arg_strings: list[str], namespace: Namespace) -> tuple[Namespace, list[str]]: ... + def _read_args_from_files(self, arg_strings: list[str]) -> list[str]: ... def _match_argument(self, action: Action, arg_strings_pattern: str) -> int: ... def _match_arguments_partial(self, actions: Sequence[Action], arg_strings_pattern: str) -> list[int]: ... @@ -248,7 +254,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): def _get_value(self, action: Action, arg_string: str) -> Any: ... def _check_value(self, action: Action, value: Any) -> None: ... def _get_formatter(self) -> HelpFormatter: ... - def _print_message(self, message: str, file: IO[str] | None = None) -> None: ... + def _print_message(self, message: str, file: SupportsWrite[str] | None = None) -> None: ... class HelpFormatter: # undocumented @@ -450,6 +456,7 @@ class Namespace(_AttributeHolder): def __setattr__(self, name: str, value: Any, /) -> None: ... def __contains__(self, key: str) -> bool: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] class FileType: # undocumented diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/array.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/array.pyi index 878d8d8cb808..19ec8c1e78f9 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/array.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/array.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer, SupportsRead, SupportsWrite from collections.abc import Iterable # pytype crashes if array inherits from collections.abc.MutableSequence instead of typing.MutableSequence -from typing import Any, Literal, MutableSequence, SupportsIndex, TypeVar, overload # noqa: Y022 +from typing import Any, ClassVar, Literal, MutableSequence, SupportsIndex, TypeVar, overload # noqa: Y022 from typing_extensions import Self, TypeAlias if sys.version_info >= (3, 12): @@ -24,19 +24,21 @@ class array(MutableSequence[_T]): @property def itemsize(self) -> int: ... @overload - def __init__(self: array[int], typecode: _IntTypeCode, initializer: bytes | bytearray | Iterable[int] = ..., /) -> None: ... + def __new__( + cls: type[array[int]], typecode: _IntTypeCode, initializer: bytes | bytearray | Iterable[int] = ..., / + ) -> array[int]: ... @overload - def __init__( - self: array[float], typecode: _FloatTypeCode, initializer: bytes | bytearray | Iterable[float] = ..., / - ) -> None: ... + def __new__( + cls: type[array[float]], typecode: _FloatTypeCode, initializer: bytes | bytearray | Iterable[float] = ..., / + ) -> array[float]: ... @overload - def __init__( - self: array[str], typecode: _UnicodeTypeCode, initializer: bytes | bytearray | Iterable[str] = ..., / - ) -> None: ... + def __new__( + cls: type[array[str]], typecode: _UnicodeTypeCode, initializer: bytes | bytearray | Iterable[str] = ..., / + ) -> array[str]: ... @overload - def __init__(self, typecode: str, initializer: Iterable[_T], /) -> None: ... + def __new__(cls, typecode: str, initializer: Iterable[_T], /) -> Self: ... @overload - def __init__(self, typecode: str, initializer: bytes | bytearray = ..., /) -> None: ... + def __new__(cls, typecode: str, initializer: bytes | bytearray = ..., /) -> Self: ... def append(self, v: _T, /) -> None: ... def buffer_info(self) -> tuple[int, int]: ... def byteswap(self) -> None: ... @@ -62,6 +64,7 @@ class array(MutableSequence[_T]): def fromstring(self, buffer: str | ReadableBuffer, /) -> None: ... def tostring(self) -> bytes: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __len__(self) -> int: ... @overload def __getitem__(self, key: SupportsIndex, /) -> _T: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ast.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ast.pyi index 351a4af2fb75..7a4438a33fbc 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ast.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ast.pyi @@ -7,7 +7,7 @@ from _ast import ( PyCF_TYPE_COMMENTS as PyCF_TYPE_COMMENTS, ) from _typeshed import ReadableBuffer, Unused -from collections.abc import Iterator +from collections.abc import Iterable, Iterator from typing import Any, ClassVar, Generic, Literal, TypedDict, TypeVar as _TypeVar, overload from typing_extensions import Self, Unpack, deprecated @@ -1154,6 +1154,7 @@ class Tuple(expr): if sys.version_info >= (3, 14): def __replace__(self, *, elts: list[expr] = ..., ctx: expr_context = ..., **kwargs: Unpack[_Attributes]) -> Self: ... +@deprecated("Deprecated since Python 3.9.") class slice(AST): ... # deprecated and moved to ast.py for >= (3, 9) if sys.version_info >= (3, 9): @@ -1185,22 +1186,38 @@ class Slice(_Slice): **kwargs: Unpack[_SliceAttributes], ) -> Self: ... +@deprecated("Deprecated since Python 3.9. Use ast.Tuple instead.") class ExtSlice(slice): # deprecated and moved to ast.py if sys.version_info >= (3, 9) - dims: list[slice] - def __init__(self, dims: list[slice], **kwargs: Unpack[_SliceAttributes]) -> None: ... + if sys.version_info >= (3, 9): + def __new__(cls, dims: Iterable[slice] = (), **kwargs: Unpack[_SliceAttributes]) -> Tuple: ... # type: ignore[misc] + else: + dims: list[slice] + def __init__(self, dims: list[slice], **kwargs: Unpack[_SliceAttributes]) -> None: ... +@deprecated("Deprecated since Python 3.9. Use the index value directly instead.") class Index(slice): # deprecated and moved to ast.py if sys.version_info >= (3, 9) - value: expr - def __init__(self, value: expr, **kwargs: Unpack[_SliceAttributes]) -> None: ... + if sys.version_info >= (3, 9): + def __new__(cls, value: expr, **kwargs: Unpack[_SliceAttributes]) -> expr: ... # type: ignore[misc] + else: + value: expr + def __init__(self, value: expr, **kwargs: Unpack[_SliceAttributes]) -> None: ... class expr_context(AST): ... + +@deprecated("Deprecated since Python 3.9. Unused in Python 3.") class AugLoad(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9) + +@deprecated("Deprecated since Python 3.9. Unused in Python 3.") class AugStore(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9) + +@deprecated("Deprecated since Python 3.9. Unused in Python 3.") class Param(expr_context): ... # deprecated and moved to ast.py if sys.version_info >= (3, 9) +@deprecated("Deprecated since Python 3.9. Unused in Python 3.") class Suite(mod): # deprecated and moved to ast.py if sys.version_info >= (3, 9) - body: list[stmt] - def __init__(self, body: list[stmt]) -> None: ... + if sys.version_info < (3, 9): + body: list[stmt] + def __init__(self, body: list[stmt]) -> None: ... class Load(expr_context): ... class Store(expr_context): ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/__init__.pyi index daf28862aa6a..7c3ac6ede4fe 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/__init__.pyi @@ -30,6 +30,1306 @@ if sys.platform == "win32": else: from .unix_events import * +if sys.platform == "win32": + if sys.version_info >= (3, 14): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "QueueShutDown", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "create_eager_task_factory", # from tasks + "eager_task_factory", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "TaskGroup", # from taskgroups + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from windows_events + "ProactorEventLoop", # from windows_events + "IocpProactor", # from windows_events + "DefaultEventLoopPolicy", # from windows_events + "WindowsSelectorEventLoopPolicy", # from windows_events + "WindowsProactorEventLoopPolicy", # from windows_events + "EventLoop", # from windows_events + ) + elif sys.version_info >= (3, 13): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "QueueShutDown", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "create_eager_task_factory", # from tasks + "eager_task_factory", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "TaskGroup", # from taskgroups + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from windows_events + "ProactorEventLoop", # from windows_events + "IocpProactor", # from windows_events + "DefaultEventLoopPolicy", # from windows_events + "WindowsSelectorEventLoopPolicy", # from windows_events + "WindowsProactorEventLoopPolicy", # from windows_events + "EventLoop", # from windows_events + ) + elif sys.version_info >= (3, 12): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "create_eager_task_factory", # from tasks + "eager_task_factory", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "TaskGroup", # from taskgroups + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from windows_events + "ProactorEventLoop", # from windows_events + "IocpProactor", # from windows_events + "DefaultEventLoopPolicy", # from windows_events + "WindowsSelectorEventLoopPolicy", # from windows_events + "WindowsProactorEventLoopPolicy", # from windows_events + ) + elif sys.version_info >= (3, 11): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from windows_events + "ProactorEventLoop", # from windows_events + "IocpProactor", # from windows_events + "DefaultEventLoopPolicy", # from windows_events + "WindowsSelectorEventLoopPolicy", # from windows_events + "WindowsProactorEventLoopPolicy", # from windows_events + ) + elif sys.version_info >= (3, 10): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "coroutine", # from coroutines + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "to_thread", # from threads + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from windows_events + "ProactorEventLoop", # from windows_events + "IocpProactor", # from windows_events + "DefaultEventLoopPolicy", # from windows_events + "WindowsSelectorEventLoopPolicy", # from windows_events + "WindowsProactorEventLoopPolicy", # from windows_events + ) + elif sys.version_info >= (3, 9): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "coroutine", # from coroutines + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "to_thread", # from threads + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from windows_events + "ProactorEventLoop", # from windows_events + "IocpProactor", # from windows_events + "DefaultEventLoopPolicy", # from windows_events + "WindowsSelectorEventLoopPolicy", # from windows_events + "WindowsProactorEventLoopPolicy", # from windows_events + ) + else: + __all__ = ( + "BaseEventLoop", # from base_events + "coroutine", # from coroutines + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from windows_events + "ProactorEventLoop", # from windows_events + "IocpProactor", # from windows_events + "DefaultEventLoopPolicy", # from windows_events + "WindowsSelectorEventLoopPolicy", # from windows_events + "WindowsProactorEventLoopPolicy", # from windows_events + ) +else: + if sys.version_info >= (3, 14): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "QueueShutDown", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "open_unix_connection", # from streams + "start_unix_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "create_eager_task_factory", # from tasks + "eager_task_factory", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "TaskGroup", # from taskgroups + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from unix_events + "DefaultEventLoopPolicy", # from unix_events + "EventLoop", # from unix_events + ) + elif sys.version_info >= (3, 13): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "QueueShutDown", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "open_unix_connection", # from streams + "start_unix_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "create_eager_task_factory", # from tasks + "eager_task_factory", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "TaskGroup", # from taskgroups + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from unix_events + "AbstractChildWatcher", # from unix_events + "SafeChildWatcher", # from unix_events + "FastChildWatcher", # from unix_events + "PidfdChildWatcher", # from unix_events + "MultiLoopChildWatcher", # from unix_events + "ThreadedChildWatcher", # from unix_events + "DefaultEventLoopPolicy", # from unix_events + "EventLoop", # from unix_events + ) + elif sys.version_info >= (3, 12): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "open_unix_connection", # from streams + "start_unix_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "create_eager_task_factory", # from tasks + "eager_task_factory", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "TaskGroup", # from taskgroups + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from unix_events + "AbstractChildWatcher", # from unix_events + "SafeChildWatcher", # from unix_events + "FastChildWatcher", # from unix_events + "PidfdChildWatcher", # from unix_events + "MultiLoopChildWatcher", # from unix_events + "ThreadedChildWatcher", # from unix_events + "DefaultEventLoopPolicy", # from unix_events + ) + elif sys.version_info >= (3, 11): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "BrokenBarrierError", # from exceptions + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "Barrier", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "Runner", # from runners + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "open_unix_connection", # from streams + "start_unix_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "to_thread", # from threads + "Timeout", # from timeouts + "timeout", # from timeouts + "timeout_at", # from timeouts + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from unix_events + "AbstractChildWatcher", # from unix_events + "SafeChildWatcher", # from unix_events + "FastChildWatcher", # from unix_events + "PidfdChildWatcher", # from unix_events + "MultiLoopChildWatcher", # from unix_events + "ThreadedChildWatcher", # from unix_events + "DefaultEventLoopPolicy", # from unix_events + ) + elif sys.version_info >= (3, 10): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "coroutine", # from coroutines + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "open_unix_connection", # from streams + "start_unix_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "to_thread", # from threads + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from unix_events + "AbstractChildWatcher", # from unix_events + "SafeChildWatcher", # from unix_events + "FastChildWatcher", # from unix_events + "PidfdChildWatcher", # from unix_events + "MultiLoopChildWatcher", # from unix_events + "ThreadedChildWatcher", # from unix_events + "DefaultEventLoopPolicy", # from unix_events + ) + elif sys.version_info >= (3, 9): + __all__ = ( + "BaseEventLoop", # from base_events + "Server", # from base_events + "coroutine", # from coroutines + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "open_unix_connection", # from streams + "start_unix_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "to_thread", # from threads + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from unix_events + "AbstractChildWatcher", # from unix_events + "SafeChildWatcher", # from unix_events + "FastChildWatcher", # from unix_events + "PidfdChildWatcher", # from unix_events + "MultiLoopChildWatcher", # from unix_events + "ThreadedChildWatcher", # from unix_events + "DefaultEventLoopPolicy", # from unix_events + ) + else: + __all__ = ( + "BaseEventLoop", # from base_events + "coroutine", # from coroutines + "iscoroutinefunction", # from coroutines + "iscoroutine", # from coroutines + "AbstractEventLoopPolicy", # from events + "AbstractEventLoop", # from events + "AbstractServer", # from events + "Handle", # from events + "TimerHandle", # from events + "get_event_loop_policy", # from events + "set_event_loop_policy", # from events + "get_event_loop", # from events + "set_event_loop", # from events + "new_event_loop", # from events + "get_child_watcher", # from events + "set_child_watcher", # from events + "_set_running_loop", # from events + "get_running_loop", # from events + "_get_running_loop", # from events + "CancelledError", # from exceptions + "InvalidStateError", # from exceptions + "TimeoutError", # from exceptions + "IncompleteReadError", # from exceptions + "LimitOverrunError", # from exceptions + "SendfileNotAvailableError", # from exceptions + "Future", # from futures + "wrap_future", # from futures + "isfuture", # from futures + "Lock", # from locks + "Event", # from locks + "Condition", # from locks + "Semaphore", # from locks + "BoundedSemaphore", # from locks + "BaseProtocol", # from protocols + "Protocol", # from protocols + "DatagramProtocol", # from protocols + "SubprocessProtocol", # from protocols + "BufferedProtocol", # from protocols + "run", # from runners + "Queue", # from queues + "PriorityQueue", # from queues + "LifoQueue", # from queues + "QueueFull", # from queues + "QueueEmpty", # from queues + "StreamReader", # from streams + "StreamWriter", # from streams + "StreamReaderProtocol", # from streams + "open_connection", # from streams + "start_server", # from streams + "open_unix_connection", # from streams + "start_unix_server", # from streams + "create_subprocess_exec", # from subprocess + "create_subprocess_shell", # from subprocess + "Task", # from tasks + "create_task", # from tasks + "FIRST_COMPLETED", # from tasks + "FIRST_EXCEPTION", # from tasks + "ALL_COMPLETED", # from tasks + "wait", # from tasks + "wait_for", # from tasks + "as_completed", # from tasks + "sleep", # from tasks + "gather", # from tasks + "shield", # from tasks + "ensure_future", # from tasks + "run_coroutine_threadsafe", # from tasks + "current_task", # from tasks + "all_tasks", # from tasks + "_register_task", # from tasks + "_unregister_task", # from tasks + "_enter_task", # from tasks + "_leave_task", # from tasks + "BaseTransport", # from transports + "ReadTransport", # from transports + "WriteTransport", # from transports + "Transport", # from transports + "DatagramTransport", # from transports + "SubprocessTransport", # from transports + "SelectorEventLoop", # from unix_events + "AbstractChildWatcher", # from unix_events + "SafeChildWatcher", # from unix_events + "FastChildWatcher", # from unix_events + "MultiLoopChildWatcher", # from unix_events + "ThreadedChildWatcher", # from unix_events + "DefaultEventLoopPolicy", # from unix_events + ) + _T_co = TypeVar("_T_co", covariant=True) # Aliases imported by multiple submodules in typeshed diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/base_events.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/base_events.pyi index cba2c7799528..d410193a3379 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/base_events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/base_events.pyi @@ -13,6 +13,7 @@ from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket from typing import IO, Any, Literal, TypeVar, overload from typing_extensions import TypeAlias, TypeVarTuple, Unpack +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 9): __all__ = ("BaseEventLoop", "Server") else: @@ -452,6 +453,7 @@ class BaseEventLoop(AbstractEventLoop): bufsize: Literal[0] = 0, encoding: None = None, errors: None = None, + text: Literal[False] | None = None, **kwargs: Any, ) -> tuple[SubprocessTransport, _ProtocolT]: ... def add_reader(self, fd: FileDescriptorLike, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/coroutines.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/coroutines.pyi index bc797de7fd51..8ef30b3d3198 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/coroutines.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/coroutines.pyi @@ -3,6 +3,7 @@ from collections.abc import Awaitable, Callable, Coroutine from typing import Any, TypeVar, overload from typing_extensions import ParamSpec, TypeGuard, TypeIs +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 11): __all__ = ("iscoroutinefunction", "iscoroutine") else: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi index ead64070671f..af1594524c45 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi @@ -22,6 +22,7 @@ from .tasks import Task from .transports import BaseTransport, DatagramTransport, ReadTransport, SubprocessTransport, Transport, WriteTransport from .unix_events import AbstractChildWatcher +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 14): __all__ = ( "AbstractEventLoopPolicy", diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/exceptions.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/exceptions.pyi index 0746394d582f..759838f45de4 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/exceptions.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/exceptions.pyi @@ -1,5 +1,6 @@ import sys +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 11): __all__ = ( "BrokenBarrierError", diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/futures.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/futures.pyi index 28e6ca8c86a3..cb2785012fb2 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/futures.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/futures.pyi @@ -5,6 +5,7 @@ from typing_extensions import TypeIs from .events import AbstractEventLoop +# Keep asyncio.__all__ updated with any changes to __all__ here __all__ = ("Future", "wrap_future", "isfuture") _T = TypeVar("_T") diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/locks.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/locks.pyi index 0114aeb23329..4eef69dee5c3 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/locks.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/locks.pyi @@ -15,6 +15,7 @@ if sys.version_info >= (3, 10): else: _LoopBoundMixin = object +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 11): __all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore", "Barrier") else: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/proactor_events.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/proactor_events.pyi index 957fdd6ce255..909d671df289 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/proactor_events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/proactor_events.pyi @@ -62,3 +62,4 @@ class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePip class BaseProactorEventLoop(base_events.BaseEventLoop): def __init__(self, proactor: Any) -> None: ... + async def sock_recv(self, sock: socket, n: int) -> bytes: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/protocols.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/protocols.pyi index 5173b74ed5a0..5425336c49a8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/protocols.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/protocols.pyi @@ -2,6 +2,7 @@ from _typeshed import ReadableBuffer from asyncio import transports from typing import Any +# Keep asyncio.__all__ updated with any changes to __all__ here __all__ = ("BaseProtocol", "Protocol", "DatagramProtocol", "SubprocessProtocol", "BufferedProtocol") class BaseProtocol: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/queues.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/queues.pyi index 895205aa9519..d287fe779297 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/queues.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/queues.pyi @@ -13,6 +13,7 @@ else: class QueueEmpty(Exception): ... class QueueFull(Exception): ... +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 13): __all__ = ("Queue", "PriorityQueue", "LifoQueue", "QueueFull", "QueueEmpty", "QueueShutDown") diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/runners.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/runners.pyi index 37a85b709cdc..caf5e4996cf4 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/runners.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/runners.pyi @@ -7,6 +7,7 @@ from typing_extensions import Self from .events import AbstractEventLoop +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 11): __all__ = ("Runner", "run") else: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/selector_events.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/selector_events.pyi index 430f2dd405cd..18c5df033e2f 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/selector_events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/selector_events.pyi @@ -1,4 +1,5 @@ import selectors +from socket import socket from . import base_events @@ -6,3 +7,4 @@ __all__ = ("BaseSelectorEventLoop",) class BaseSelectorEventLoop(base_events.BaseEventLoop): def __init__(self, selector: selectors.BaseSelector | None = None) -> None: ... + async def sock_recv(self, sock: socket, n: int) -> bytes: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/streams.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/streams.pyi index ed95583c1847..43df5ae2d0c8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/streams.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/streams.pyi @@ -9,6 +9,7 @@ from typing_extensions import Self, TypeAlias from . import events, protocols, transports from .base_events import Server +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.platform == "win32": __all__ = ("StreamReader", "StreamWriter", "StreamReaderProtocol", "open_connection", "start_server") else: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/subprocess.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/subprocess.pyi index 19452d4eb469..50d75391f36d 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/subprocess.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/subprocess.pyi @@ -5,6 +5,7 @@ from asyncio import events, protocols, streams, transports from collections.abc import Callable, Collection from typing import IO, Any, Literal +# Keep asyncio.__all__ updated with any changes to __all__ here __all__ = ("create_subprocess_exec", "create_subprocess_shell") PIPE: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/taskgroups.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/taskgroups.pyi index aec3f1127f15..30b7c9129f6f 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/taskgroups.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/taskgroups.pyi @@ -8,6 +8,7 @@ from . import _CoroutineLike from .events import AbstractEventLoop from .tasks import Task +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 12): __all__ = ("TaskGroup",) else: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi index d1ff7d425ba4..a349e81d80e9 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi @@ -18,6 +18,7 @@ from .futures import Future if sys.version_info >= (3, 11): from contextvars import Context +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.version_info >= (3, 12): __all__ = ( "Task", diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/threads.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/threads.pyi index 799efd25fea4..00aae2ea814c 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/threads.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/threads.pyi @@ -2,6 +2,7 @@ from collections.abc import Callable from typing import TypeVar from typing_extensions import ParamSpec +# Keep asyncio.__all__ updated with any changes to __all__ here __all__ = ("to_thread",) _P = ParamSpec("_P") _R = TypeVar("_R") diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/timeouts.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/timeouts.pyi index 2f0e40e25680..668cccbfe8b1 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/timeouts.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/timeouts.pyi @@ -2,6 +2,7 @@ from types import TracebackType from typing import final from typing_extensions import Self +# Keep asyncio.__all__ updated with any changes to __all__ here __all__ = ("Timeout", "timeout", "timeout_at") @final diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/transports.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/transports.pyi index 531f77672438..c28ae234f2cc 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/transports.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/transports.pyi @@ -4,6 +4,7 @@ from collections.abc import Iterable, Mapping from socket import _Address from typing import Any +# Keep asyncio.__all__ updated with any changes to __all__ here __all__ = ("BaseTransport", "ReadTransport", "WriteTransport", "Transport", "DatagramTransport", "SubprocessTransport") class BaseTransport: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/unix_events.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/unix_events.pyi index fb21c5b5fa05..abf5d7ffd699 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/unix_events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/unix_events.pyi @@ -13,10 +13,12 @@ from .selector_events import BaseSelectorEventLoop _Ts = TypeVarTuple("_Ts") +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.platform != "win32": if sys.version_info >= (3, 14): __all__ = ("SelectorEventLoop", "DefaultEventLoopPolicy", "EventLoop") elif sys.version_info >= (3, 13): + # Adds EventLoop __all__ = ( "SelectorEventLoop", "AbstractChildWatcher", @@ -29,6 +31,7 @@ if sys.platform != "win32": "EventLoop", ) elif sys.version_info >= (3, 9): + # adds PidfdChildWatcher __all__ = ( "SelectorEventLoop", "AbstractChildWatcher", diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/windows_events.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/windows_events.pyi index e5205ba4dcb0..2ffc2eccb228 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/windows_events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/windows_events.pyi @@ -6,6 +6,7 @@ from typing import IO, Any, ClassVar, Final, NoReturn from . import events, futures, proactor_events, selector_events, streams, windows_utils +# Keep asyncio.__all__ updated with any changes to __all__ here if sys.platform == "win32": if sys.version_info >= (3, 13): # 3.13 added `EventLoop`. diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi index 4c7467fc84c8..b0912b8872d7 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi @@ -1,5 +1,6 @@ # ruff: noqa: PYI036 # This is the module declaring BaseException import _ast +import _sitebuiltins import _typeshed import sys import types @@ -46,7 +47,6 @@ from typing import ( # noqa: Y022 Mapping, MutableMapping, MutableSequence, - NoReturn, Protocol, Sequence, SupportsAbs, @@ -1362,8 +1362,10 @@ def compile( *, _feature_version: int = -1, ) -> Any: ... -def copyright() -> None: ... -def credits() -> None: ... + +copyright: _sitebuiltins._Printer +credits: _sitebuiltins._Printer + def delattr(obj: object, name: str, /) -> None: ... def dir(o: object = ..., /) -> list[str]: ... @overload @@ -1418,7 +1420,7 @@ else: /, ) -> None: ... -def exit(code: sys._ExitCode = None) -> NoReturn: ... +exit: _sitebuiltins.Quitter class filter(Generic[_T]): @overload @@ -1452,7 +1454,9 @@ def getattr(o: object, name: str, default: _T, /) -> Any | _T: ... def globals() -> dict[str, Any]: ... def hasattr(obj: object, name: str, /) -> bool: ... def hash(obj: object, /) -> int: ... -def help(request: object = ...) -> None: ... + +help: _sitebuiltins._Helper + def hex(number: int | SupportsIndex, /) -> str: ... def id(obj: object, /) -> int: ... def input(prompt: object = "", /) -> str: ... @@ -1478,23 +1482,25 @@ else: def isinstance(obj: object, class_or_tuple: _ClassInfo, /) -> bool: ... def issubclass(cls: type, class_or_tuple: _ClassInfo, /) -> bool: ... def len(obj: Sized, /) -> int: ... -def license() -> None: ... + +license: _sitebuiltins._Printer + def locals() -> dict[str, Any]: ... class map(Generic[_S]): @overload - def __new__(cls, func: Callable[[_T1], _S], iter1: Iterable[_T1], /) -> Self: ... + def __new__(cls, func: Callable[[_T1], _S], iterable: Iterable[_T1], /) -> Self: ... @overload - def __new__(cls, func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], /) -> Self: ... + def __new__(cls, func: Callable[[_T1, _T2], _S], iterable: Iterable[_T1], iter2: Iterable[_T2], /) -> Self: ... @overload def __new__( - cls, func: Callable[[_T1, _T2, _T3], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], / + cls, func: Callable[[_T1, _T2, _T3], _S], iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], / ) -> Self: ... @overload def __new__( cls, func: Callable[[_T1, _T2, _T3, _T4], _S], - iter1: Iterable[_T1], + iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], @@ -1504,7 +1510,7 @@ class map(Generic[_S]): def __new__( cls, func: Callable[[_T1, _T2, _T3, _T4, _T5], _S], - iter1: Iterable[_T1], + iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], iter4: Iterable[_T4], @@ -1515,7 +1521,7 @@ class map(Generic[_S]): def __new__( cls, func: Callable[..., _S], - iter1: Iterable[Any], + iterable: Iterable[Any], iter2: Iterable[Any], iter3: Iterable[Any], iter4: Iterable[Any], @@ -1721,7 +1727,8 @@ def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ... def pow(base: _SupportsSomeKindOfPow, exp: float, mod: None = None) -> Any: ... @overload def pow(base: _SupportsSomeKindOfPow, exp: complex, mod: None = None) -> complex: ... -def quit(code: sys._ExitCode = None) -> NoReturn: ... + +quit: _sitebuiltins.Quitter class reversed(Generic[_T]): @overload @@ -1957,9 +1964,7 @@ class NameError(Exception): class ReferenceError(Exception): ... class RuntimeError(Exception): ... - -class StopAsyncIteration(Exception): - value: Any +class StopAsyncIteration(Exception): ... class SyntaxError(Exception): msg: str diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi index b3c721f1e283..c6f517adb3cd 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/codecs.pyi @@ -254,6 +254,8 @@ class StreamReaderWriter(TextIO): def writable(self) -> bool: ... class StreamRecoder(BinaryIO): + data_encoding: str + file_encoding: str def __init__( self, stream: _Stream, diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/codeop.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/codeop.pyi index 6a51b7786384..cfe52e9b35de 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/codeop.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/codeop.pyi @@ -1,3 +1,4 @@ +import sys from types import CodeType __all__ = ["compile_command", "Compile", "CommandCompiler"] @@ -6,7 +7,10 @@ def compile_command(source: str, filename: str = "", symbol: str = "singl class Compile: flags: int - def __call__(self, source: str, filename: str, symbol: str) -> CodeType: ... + if sys.version_info >= (3, 13): + def __call__(self, source: str, filename: str, symbol: str, flags: int = 0) -> CodeType: ... + else: + def __call__(self, source: str, filename: str, symbol: str) -> CodeType: ... class CommandCompiler: compiler: Compile diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/collections/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/collections/__init__.pyi index 2d136318813c..0f99b5c3c67e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/collections/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/collections/__init__.pyi @@ -1,7 +1,7 @@ import sys from _collections_abc import dict_items, dict_keys, dict_values from _typeshed import SupportsItems, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT -from typing import Any, Generic, NoReturn, SupportsIndex, TypeVar, final, overload +from typing import Any, ClassVar, Generic, NoReturn, SupportsIndex, TypeVar, final, overload from typing_extensions import Self if sys.version_info >= (3, 9): @@ -119,6 +119,7 @@ class UserList(MutableSequence[_T]): def __init__(self, initlist: None = None) -> None: ... @overload def __init__(self, initlist: Iterable[_T]) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __lt__(self, other: list[_T] | UserList[_T]) -> bool: ... def __le__(self, other: list[_T] | UserList[_T]) -> bool: ... def __gt__(self, other: list[_T] | UserList[_T]) -> bool: ... @@ -254,6 +255,7 @@ class deque(MutableSequence[_T]): def rotate(self, n: int = 1, /) -> None: ... def __copy__(self) -> Self: ... def __len__(self) -> int: ... + __hash__: ClassVar[None] # type: ignore[assignment] # These methods of deque don't take slices, unlike MutableSequence, hence the type: ignores def __getitem__(self, key: SupportsIndex, /) -> _T: ... # type: ignore[override] def __setitem__(self, key: SupportsIndex, value: _T, /) -> None: ... # type: ignore[override] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/concurrent/futures/process.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/concurrent/futures/process.pyi index a1de3d679b23..97dc261be7ed 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/concurrent/futures/process.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/concurrent/futures/process.pyi @@ -72,9 +72,19 @@ class _CallItem: class _SafeQueue(Queue[Future[Any]]): pending_work_items: dict[int, _WorkItem[Any]] - shutdown_lock: Lock + if sys.version_info < (3, 12): + shutdown_lock: Lock thread_wakeup: _ThreadWakeup - if sys.version_info >= (3, 9): + if sys.version_info >= (3, 12): + def __init__( + self, + max_size: int | None = 0, + *, + ctx: BaseContext, + pending_work_items: dict[int, _WorkItem[Any]], + thread_wakeup: _ThreadWakeup, + ) -> None: ... + elif sys.version_info >= (3, 9): def __init__( self, max_size: int | None = 0, diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi index dc5d926775f3..f57e7fa67036 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/contextlib.pyi @@ -33,8 +33,12 @@ _T_co = TypeVar("_T_co", covariant=True) _T_io = TypeVar("_T_io", bound=IO[str] | None) _ExitT_co = TypeVar("_ExitT_co", covariant=True, bound=bool | None, default=bool | None) _F = TypeVar("_F", bound=Callable[..., Any]) +_G = TypeVar("_G", bound=Generator[Any, Any, Any] | AsyncGenerator[Any, Any], covariant=True) _P = ParamSpec("_P") +_SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=None) +_ReturnT_co = TypeVar("_ReturnT_co", covariant=True, default=None) + _ExitFunc: TypeAlias = Callable[[type[BaseException] | None, BaseException | None, TracebackType | None], bool | None] _CM_EF = TypeVar("_CM_EF", bound=AbstractContextManager[Any, Any] | _ExitFunc) @@ -64,16 +68,19 @@ class ContextDecorator: def _recreate_cm(self) -> Self: ... def __call__(self, func: _F) -> _F: ... -class _GeneratorContextManagerBase: ... - -class _GeneratorContextManager(_GeneratorContextManagerBase, AbstractContextManager[_T_co, bool | None], ContextDecorator): - # __init__ and all instance attributes are actually inherited from _GeneratorContextManagerBase - # adding them there is more trouble than it's worth to include in the stub; see #6676 - def __init__(self, func: Callable[..., Iterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ... - gen: Generator[_T_co, Any, Any] - func: Callable[..., Generator[_T_co, Any, Any]] +class _GeneratorContextManagerBase(Generic[_G]): + # Ideally this would use ParamSpec, but that requires (*args, **kwargs), which this isn't. see #6676 + def __init__(self, func: Callable[..., _G], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ... + gen: _G + func: Callable[..., _G] args: tuple[Any, ...] kwds: dict[str, Any] + +class _GeneratorContextManager( + _GeneratorContextManagerBase[Generator[_T_co, _SendT_contra, _ReturnT_co]], + AbstractContextManager[_T_co, bool | None], + ContextDecorator, +): if sys.version_info >= (3, 9): def __exit__( self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None @@ -93,26 +100,18 @@ if sys.version_info >= (3, 10): def __call__(self, func: _AF) -> _AF: ... class _AsyncGeneratorContextManager( - _GeneratorContextManagerBase, AbstractAsyncContextManager[_T_co, bool | None], AsyncContextDecorator + _GeneratorContextManagerBase[AsyncGenerator[_T_co, _SendT_contra]], + AbstractAsyncContextManager[_T_co, bool | None], + AsyncContextDecorator, ): - # __init__ and these attributes are actually defined in the base class _GeneratorContextManagerBase, - # adding them there is more trouble than it's worth to include in the stub (see #6676) - def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ... - gen: AsyncGenerator[_T_co, Any] - func: Callable[..., AsyncGenerator[_T_co, Any]] - args: tuple[Any, ...] - kwds: dict[str, Any] async def __aexit__( self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> bool | None: ... else: - class _AsyncGeneratorContextManager(_GeneratorContextManagerBase, AbstractAsyncContextManager[_T_co, bool | None]): - def __init__(self, func: Callable[..., AsyncIterator[_T_co]], args: tuple[Any, ...], kwds: dict[str, Any]) -> None: ... - gen: AsyncGenerator[_T_co, Any] - func: Callable[..., AsyncGenerator[_T_co, Any]] - args: tuple[Any, ...] - kwds: dict[str, Any] + class _AsyncGeneratorContextManager( + _GeneratorContextManagerBase[AsyncGenerator[_T_co, _SendT_contra]], AbstractAsyncContextManager[_T_co, bool | None] + ): async def __aexit__( self, typ: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None ) -> bool | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi index 3e0e7c45bf15..4f44975d657f 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ctypes/__init__.pyi @@ -24,8 +24,9 @@ from _ctypes import ( set_errno as set_errno, sizeof as sizeof, ) +from _typeshed import StrPath from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure -from typing import Any, ClassVar, Generic, TypeVar +from typing import Any, ClassVar, Generic, TypeVar, type_check_only from typing_extensions import Self, TypeAlias, deprecated if sys.platform == "win32": @@ -45,15 +46,32 @@ DEFAULT_MODE: int class ArgumentError(Exception): ... +# defined within CDLL.__init__ +# Runtime name is ctypes.CDLL.__init__.._FuncPtr +@type_check_only +class _CDLLFuncPointer(_CFuncPtr): + _flags_: ClassVar[int] + _restype_: ClassVar[type[_CDataType]] + +# Not a real class; _CDLLFuncPointer with a __name__ set on it. +@type_check_only +class _NamedFuncPointer(_CDLLFuncPointer): + __name__: str + +if sys.version_info >= (3, 12): + _NameTypes: TypeAlias = StrPath | None +else: + _NameTypes: TypeAlias = str | None + class CDLL: _func_flags_: ClassVar[int] - _func_restype_: ClassVar[_CDataType] + _func_restype_: ClassVar[type[_CDataType]] _name: str _handle: int - _FuncPtr: type[_FuncPointer] + _FuncPtr: type[_CDLLFuncPointer] def __init__( self, - name: str | None, + name: _NameTypes, mode: int = ..., handle: int | None = None, use_errno: bool = False, @@ -84,27 +102,36 @@ if sys.platform == "win32": pydll: LibraryLoader[PyDLL] pythonapi: PyDLL -class _FuncPointer(_CFuncPtr): ... +# Class definition within CFUNCTYPE / WINFUNCTYPE / PYFUNCTYPE +# Names at runtime are +# ctypes.CFUNCTYPE..CFunctionType +# ctypes.WINFUNCTYPE..WinFunctionType +# ctypes.PYFUNCTYPE..CFunctionType +@type_check_only +class _CFunctionType(_CFuncPtr): + _argtypes_: ClassVar[list[type[_CData | _CDataType]]] + _restype_: ClassVar[type[_CData | _CDataType] | None] + _flags_: ClassVar[int] -class _NamedFuncPointer(_FuncPointer): - __name__: str +# Alias for either function pointer type +_FuncPointer: TypeAlias = _CDLLFuncPointer | _CFunctionType # noqa: Y047 # not used here def CFUNCTYPE( restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType], - use_errno: bool = ..., - use_last_error: bool = ..., -) -> type[_FuncPointer]: ... + use_errno: bool = False, + use_last_error: bool = False, +) -> type[_CFunctionType]: ... if sys.platform == "win32": def WINFUNCTYPE( restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType], - use_errno: bool = ..., - use_last_error: bool = ..., - ) -> type[_FuncPointer]: ... + use_errno: bool = False, + use_last_error: bool = False, + ) -> type[_CFunctionType]: ... -def PYFUNCTYPE(restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType]) -> type[_FuncPointer]: ... +def PYFUNCTYPE(restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType]) -> type[_CFunctionType]: ... # Any type that can be implicitly converted to c_void_p when passed as a C function argument. # (bytes is not included here, see below.) @@ -132,10 +159,31 @@ def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to if sys.platform == "win32": def DllCanUnloadNow() -> int: ... def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO not documented - def GetLastError() -> int: ... -def memmove(dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> int: ... -def memset(dst: _CVoidPLike, c: int, count: int) -> int: ... + # Actually just an instance of _NamedFuncPointer (aka _CDLLFuncPointer), + # but we want to set a more specific __call__ + @type_check_only + class _GetLastErrorFunctionType(_NamedFuncPointer): + def __call__(self) -> int: ... + + GetLastError: _GetLastErrorFunctionType + +# Actually just an instance of _CFunctionType, but we want to set a more +# specific __call__. +@type_check_only +class _MemmoveFunctionType(_CFunctionType): + def __call__(self, dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> int: ... + +memmove: _MemmoveFunctionType + +# Actually just an instance of _CFunctionType, but we want to set a more +# specific __call__. +@type_check_only +class _MemsetFunctionType(_CFunctionType): + def __call__(self, dst: _CVoidPLike, c: int, count: int) -> int: ... + +memset: _MemsetFunctionType + def string_at(ptr: _CVoidConstPLike, size: int = -1) -> bytes: ... if sys.platform == "win32": @@ -202,7 +250,10 @@ if sys.platform == "win32": class HRESULT(_SimpleCData[int]): ... # TODO undocumented if sys.version_info >= (3, 12): - c_time_t: type[c_int32 | c_int64] # alias for one or the other at runtime + # At runtime, this is an alias for either c_int32 or c_int64, + # which are themselves an alias for one of c_short, c_int, c_long, or c_longlong + # This covers all our bases. + c_time_t: type[c_int32 | c_int64 | c_short | c_int | c_long | c_longlong] class py_object(_CanCastTo, _SimpleCData[_T]): ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi index 3295b1c1f835..3d89b830352b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi @@ -152,33 +152,37 @@ if sys.version_info >= (3, 10): def field( *, default: _T, + default_factory: Literal[_MISSING_TYPE.MISSING] = ..., init: bool = True, repr: bool = True, hash: bool | None = None, compare: bool = True, metadata: Mapping[Any, Any] | None = None, - kw_only: bool = ..., + kw_only: bool | Literal[_MISSING_TYPE.MISSING] = ..., ) -> _T: ... @overload def field( *, + default: Literal[_MISSING_TYPE.MISSING] = ..., default_factory: Callable[[], _T], init: bool = True, repr: bool = True, hash: bool | None = None, compare: bool = True, metadata: Mapping[Any, Any] | None = None, - kw_only: bool = ..., + kw_only: bool | Literal[_MISSING_TYPE.MISSING] = ..., ) -> _T: ... @overload def field( *, + default: Literal[_MISSING_TYPE.MISSING] = ..., + default_factory: Literal[_MISSING_TYPE.MISSING] = ..., init: bool = True, repr: bool = True, hash: bool | None = None, compare: bool = True, metadata: Mapping[Any, Any] | None = None, - kw_only: bool = ..., + kw_only: bool | Literal[_MISSING_TYPE.MISSING] = ..., ) -> Any: ... else: @@ -186,6 +190,7 @@ else: def field( *, default: _T, + default_factory: Literal[_MISSING_TYPE.MISSING] = ..., init: bool = True, repr: bool = True, hash: bool | None = None, @@ -195,6 +200,7 @@ else: @overload def field( *, + default: Literal[_MISSING_TYPE.MISSING] = ..., default_factory: Callable[[], _T], init: bool = True, repr: bool = True, @@ -205,6 +211,8 @@ else: @overload def field( *, + default: Literal[_MISSING_TYPE.MISSING] = ..., + default_factory: Literal[_MISSING_TYPE.MISSING] = ..., init: bool = True, repr: bool = True, hash: bool | None = None, diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi index 87037ef39be7..4907bf4607c8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/datetime.pyi @@ -29,7 +29,7 @@ class timezone(tzinfo): utc: ClassVar[timezone] min: ClassVar[timezone] max: ClassVar[timezone] - def __init__(self, offset: timedelta, name: str = ...) -> None: ... + def __new__(cls, offset: timedelta, name: str = ...) -> Self: ... def tzname(self, dt: datetime | None, /) -> str: ... def utcoffset(self, dt: datetime | None, /) -> timedelta: ... def dst(self, dt: datetime | None, /) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi index 7f8708a020fd..7eb922c8a7ed 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/decimal.pyi @@ -189,7 +189,6 @@ class Context: clamp: int | None = ..., flags: None | dict[_TrapType, bool] | Container[_TrapType] = ..., traps: None | dict[_TrapType, bool] | Container[_TrapType] = ..., - _ignored_flags: list[_TrapType] | None = ..., ) -> None: ... def __reduce__(self) -> tuple[type[Self], tuple[Any, ...]]: ... def clear_flags(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/email/charset.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/email/charset.pyi index 2939192c9526..683daa468cf3 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/email/charset.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/email/charset.pyi @@ -1,6 +1,6 @@ from collections.abc import Callable, Iterator from email.message import Message -from typing import Final, overload +from typing import ClassVar, Final, overload __all__ = ["Charset", "add_alias", "add_charset", "add_codec"] @@ -24,6 +24,7 @@ class Charset: def body_encode(self, string: None) -> None: ... @overload def body_encode(self, string: str | bytes) -> str: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... def __ne__(self, value: object, /) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/email/header.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/email/header.pyi index 212132c6be18..a26bbb516e09 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/email/header.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/email/header.pyi @@ -1,6 +1,6 @@ from collections.abc import Iterable from email.charset import Charset -from typing import Any +from typing import Any, ClassVar __all__ = ["Header", "decode_header", "make_header"] @@ -16,6 +16,7 @@ class Header: ) -> None: ... def append(self, s: bytes | bytearray | str, charset: Charset | str | None = None, errors: str = "strict") -> None: ... def encode(self, splitchars: str = ";, \t", maxlinelen: int | None = None, linesep: str = "\n") -> str: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... def __ne__(self, value: object, /) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/email/headerregistry.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/email/headerregistry.pyi index 2ffdca9b2f22..dc641c8c952b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/email/headerregistry.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/email/headerregistry.pyi @@ -167,6 +167,7 @@ class Address: def __init__( self, display_name: str = "", username: str | None = "", domain: str | None = "", addr_spec: str | None = None ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... class Group: @@ -175,4 +176,5 @@ class Group: @property def addresses(self) -> tuple[Address, ...]: ... def __init__(self, display_name: str | None = None, addresses: Iterable[Address] | None = None) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/fractions.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/fractions.pyi index fbcfa868cc1b..aaa3a22087fc 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/fractions.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/fractions.pyi @@ -27,11 +27,11 @@ 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: ... + def __new__(cls, numerator: float | Decimal | str) -> Self: ... if sys.version_info >= (3, 14): @overload - def __new__(cls, value: _ConvertibleToIntegerRatio) -> Self: ... + def __new__(cls, numerator: _ConvertibleToIntegerRatio) -> Self: ... @classmethod def from_float(cls, f: float) -> Self: ... @@ -138,7 +138,7 @@ class Fraction(Rational): def __round__(self, ndigits: None = None) -> int: ... @overload def __round__(self, ndigits: int) -> Fraction: ... - def __hash__(self) -> int: ... + def __hash__(self) -> int: ... # type: ignore[override] def __eq__(a, b: object) -> bool: ... def __lt__(a, b: _ComparableNum) -> bool: ... def __gt__(a, b: _ComparableNum) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/gzip.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/gzip.pyi index 9b32008dcbf6..b7fb40fbd82e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/gzip.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/gzip.pyi @@ -2,8 +2,8 @@ import _compression import sys import zlib from _typeshed import ReadableBuffer, SizedBuffer, StrOrBytesPath -from io import FileIO -from typing import Final, Literal, Protocol, TextIO, overload +from io import FileIO, TextIOWrapper +from typing import Final, Literal, Protocol, overload from typing_extensions import TypeAlias __all__ = ["BadGzipFile", "GzipFile", "open", "compress", "decompress"] @@ -57,13 +57,13 @@ def open( ) -> GzipFile: ... @overload def open( - filename: StrOrBytesPath, + filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj, mode: _OpenTextMode, compresslevel: int = 9, encoding: str | None = None, errors: str | None = None, newline: str | None = None, -) -> TextIO: ... +) -> TextIOWrapper: ... @overload def open( filename: StrOrBytesPath | _ReadableFileobj | _WritableFileobj, @@ -72,7 +72,7 @@ def open( encoding: str | None = None, errors: str | None = None, newline: str | None = None, -) -> GzipFile | TextIO: ... +) -> GzipFile | TextIOWrapper: ... class _PaddedFile: file: _ReadableFileobj diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/http/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/http/__init__.pyi index d455283948d1..ef413a349125 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/http/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/http/__init__.pyi @@ -14,9 +14,14 @@ class HTTPStatus(IntEnum): def phrase(self) -> str: ... @property def description(self) -> str: ... + + # Keep these synced with the global constants in http/client.pyi. CONTINUE = 100 SWITCHING_PROTOCOLS = 101 PROCESSING = 102 + if sys.version_info >= (3, 9): + EARLY_HINTS = 103 + OK = 200 CREATED = 201 ACCEPTED = 202 @@ -27,6 +32,7 @@ class HTTPStatus(IntEnum): MULTI_STATUS = 207 ALREADY_REPORTED = 208 IM_USED = 226 + MULTIPLE_CHOICES = 300 MOVED_PERMANENTLY = 301 FOUND = 302 @@ -35,6 +41,7 @@ class HTTPStatus(IntEnum): USE_PROXY = 305 TEMPORARY_REDIRECT = 307 PERMANENT_REDIRECT = 308 + BAD_REQUEST = 400 UNAUTHORIZED = 401 PAYMENT_REQUIRED = 402 @@ -59,15 +66,22 @@ class HTTPStatus(IntEnum): RANGE_NOT_SATISFIABLE = 416 REQUESTED_RANGE_NOT_SATISFIABLE = 416 EXPECTATION_FAILED = 417 + if sys.version_info >= (3, 9): + IM_A_TEAPOT = 418 + MISDIRECTED_REQUEST = 421 if sys.version_info >= (3, 13): UNPROCESSABLE_CONTENT = 422 UNPROCESSABLE_ENTITY = 422 LOCKED = 423 FAILED_DEPENDENCY = 424 + if sys.version_info >= (3, 9): + TOO_EARLY = 425 UPGRADE_REQUIRED = 426 PRECONDITION_REQUIRED = 428 TOO_MANY_REQUESTS = 429 REQUEST_HEADER_FIELDS_TOO_LARGE = 431 + UNAVAILABLE_FOR_LEGAL_REASONS = 451 + INTERNAL_SERVER_ERROR = 500 NOT_IMPLEMENTED = 501 BAD_GATEWAY = 502 @@ -79,12 +93,7 @@ class HTTPStatus(IntEnum): LOOP_DETECTED = 508 NOT_EXTENDED = 510 NETWORK_AUTHENTICATION_REQUIRED = 511 - MISDIRECTED_REQUEST = 421 - UNAVAILABLE_FOR_LEGAL_REASONS = 451 - if sys.version_info >= (3, 9): - EARLY_HINTS = 103 - IM_A_TEAPOT = 418 - TOO_EARLY = 425 + if sys.version_info >= (3, 12): @property def is_informational(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/http/client.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/http/client.pyi index 3db764ef1e7c..cd2fc4f5a652 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/http/client.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/http/client.pyi @@ -6,7 +6,7 @@ import types from _typeshed import MaybeNone, ReadableBuffer, SupportsRead, SupportsReadline, WriteableBuffer from collections.abc import Callable, Iterable, Iterator, Mapping from socket import socket -from typing import BinaryIO, TypeVar, overload +from typing import BinaryIO, Literal, TypeVar, overload from typing_extensions import Self, TypeAlias __all__ = [ @@ -39,63 +39,85 @@ _HeaderValue: TypeAlias = ReadableBuffer | str | int HTTP_PORT: int HTTPS_PORT: int -CONTINUE: int -SWITCHING_PROTOCOLS: int -PROCESSING: int - -OK: int -CREATED: int -ACCEPTED: int -NON_AUTHORITATIVE_INFORMATION: int -NO_CONTENT: int -RESET_CONTENT: int -PARTIAL_CONTENT: int -MULTI_STATUS: int -IM_USED: int - -MULTIPLE_CHOICES: int -MOVED_PERMANENTLY: int -FOUND: int -SEE_OTHER: int -NOT_MODIFIED: int -USE_PROXY: int -TEMPORARY_REDIRECT: int - -BAD_REQUEST: int -UNAUTHORIZED: int -PAYMENT_REQUIRED: int -FORBIDDEN: int -NOT_FOUND: int -METHOD_NOT_ALLOWED: int -NOT_ACCEPTABLE: int -PROXY_AUTHENTICATION_REQUIRED: int -REQUEST_TIMEOUT: int -CONFLICT: int -GONE: int -LENGTH_REQUIRED: int -PRECONDITION_FAILED: int -REQUEST_ENTITY_TOO_LARGE: int -REQUEST_URI_TOO_LONG: int -UNSUPPORTED_MEDIA_TYPE: int -REQUESTED_RANGE_NOT_SATISFIABLE: int -EXPECTATION_FAILED: int -UNPROCESSABLE_ENTITY: int -LOCKED: int -FAILED_DEPENDENCY: int -UPGRADE_REQUIRED: int -PRECONDITION_REQUIRED: int -TOO_MANY_REQUESTS: int -REQUEST_HEADER_FIELDS_TOO_LARGE: int - -INTERNAL_SERVER_ERROR: int -NOT_IMPLEMENTED: int -BAD_GATEWAY: int -SERVICE_UNAVAILABLE: int -GATEWAY_TIMEOUT: int -HTTP_VERSION_NOT_SUPPORTED: int -INSUFFICIENT_STORAGE: int -NOT_EXTENDED: int -NETWORK_AUTHENTICATION_REQUIRED: int +# Keep these global constants in sync with http.HTTPStatus (http/__init__.pyi). +# They are present for backward compatibility reasons. +CONTINUE: Literal[100] +SWITCHING_PROTOCOLS: Literal[101] +PROCESSING: Literal[102] +if sys.version_info >= (3, 9): + EARLY_HINTS: Literal[103] + +OK: Literal[200] +CREATED: Literal[201] +ACCEPTED: Literal[202] +NON_AUTHORITATIVE_INFORMATION: Literal[203] +NO_CONTENT: Literal[204] +RESET_CONTENT: Literal[205] +PARTIAL_CONTENT: Literal[206] +MULTI_STATUS: Literal[207] +ALREADY_REPORTED: Literal[208] +IM_USED: Literal[226] + +MULTIPLE_CHOICES: Literal[300] +MOVED_PERMANENTLY: Literal[301] +FOUND: Literal[302] +SEE_OTHER: Literal[303] +NOT_MODIFIED: Literal[304] +USE_PROXY: Literal[305] +TEMPORARY_REDIRECT: Literal[307] +PERMANENT_REDIRECT: Literal[308] + +BAD_REQUEST: Literal[400] +UNAUTHORIZED: Literal[401] +PAYMENT_REQUIRED: Literal[402] +FORBIDDEN: Literal[403] +NOT_FOUND: Literal[404] +METHOD_NOT_ALLOWED: Literal[405] +NOT_ACCEPTABLE: Literal[406] +PROXY_AUTHENTICATION_REQUIRED: Literal[407] +REQUEST_TIMEOUT: Literal[408] +CONFLICT: Literal[409] +GONE: Literal[410] +LENGTH_REQUIRED: Literal[411] +PRECONDITION_FAILED: Literal[412] +if sys.version_info >= (3, 13): + CONTENT_TOO_LARGE: Literal[413] +REQUEST_ENTITY_TOO_LARGE: Literal[413] +if sys.version_info >= (3, 13): + URI_TOO_LONG: Literal[414] +REQUEST_URI_TOO_LONG: Literal[414] +UNSUPPORTED_MEDIA_TYPE: Literal[415] +if sys.version_info >= (3, 13): + RANGE_NOT_SATISFIABLE: Literal[416] +REQUESTED_RANGE_NOT_SATISFIABLE: Literal[416] +EXPECTATION_FAILED: Literal[417] +if sys.version_info >= (3, 9): + IM_A_TEAPOT: Literal[418] +MISDIRECTED_REQUEST: Literal[421] +if sys.version_info >= (3, 13): + UNPROCESSABLE_CONTENT: Literal[422] +UNPROCESSABLE_ENTITY: Literal[422] +LOCKED: Literal[423] +FAILED_DEPENDENCY: Literal[424] +if sys.version_info >= (3, 9): + TOO_EARLY: Literal[425] +UPGRADE_REQUIRED: Literal[426] +PRECONDITION_REQUIRED: Literal[428] +TOO_MANY_REQUESTS: Literal[429] +REQUEST_HEADER_FIELDS_TOO_LARGE: Literal[431] +UNAVAILABLE_FOR_LEGAL_REASONS: Literal[451] + +INTERNAL_SERVER_ERROR: Literal[500] +NOT_IMPLEMENTED: Literal[501] +BAD_GATEWAY: Literal[502] +SERVICE_UNAVAILABLE: Literal[503] +GATEWAY_TIMEOUT: Literal[504] +HTTP_VERSION_NOT_SUPPORTED: Literal[505] +VARIANT_ALSO_NEGOTIATES: Literal[506] +INSUFFICIENT_STORAGE: Literal[507] +LOOP_DETECTED: Literal[508] +NOT_EXTENDED: Literal[510] +NETWORK_AUTHENTICATION_REQUIRED: Literal[511] responses: dict[int, str] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/inspect.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/inspect.pyi index 1eb9fc502e12..c6836c837eaa 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/inspect.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/inspect.pyi @@ -416,16 +416,16 @@ class BoundArguments: def __init__(self, signature: Signature, arguments: OrderedDict[str, Any]) -> None: ... def apply_defaults(self) -> None: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] # # Classes and functions # -# TODO: The actual return type should be list[_ClassTreeItem] but mypy doesn't -# seem to be supporting this at the moment: -# _ClassTreeItem = list[_ClassTreeItem] | Tuple[type, Tuple[type, ...]] -def getclasstree(classes: list[type], unique: bool = False) -> list[Any]: ... -def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> list[Any]: ... +_ClassTreeItem: TypeAlias = list[tuple[type, ...]] | list[_ClassTreeItem] + +def getclasstree(classes: list[type], unique: bool = False) -> _ClassTreeItem: ... +def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> _ClassTreeItem: ... class Arguments(NamedTuple): args: list[str] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi index f5cee43d6b32..0563ed9b00ba 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ipaddress.pyi @@ -32,7 +32,6 @@ class _IPAddressBase: def version(self) -> int: ... class _BaseAddress(_IPAddressBase): - def __init__(self, address: object) -> None: ... def __add__(self, other: int) -> Self: ... def __hash__(self) -> int: ... def __int__(self) -> int: ... @@ -54,7 +53,6 @@ class _BaseAddress(_IPAddressBase): class _BaseNetwork(_IPAddressBase, Generic[_A]): network_address: _A netmask: _A - def __init__(self, address: object, strict: bool = ...) -> None: ... def __contains__(self, other: Any) -> bool: ... def __getitem__(self, n: int) -> _A: ... def __iter__(self) -> Iterator[_A]: ... @@ -114,6 +112,7 @@ class _BaseV4: def max_prefixlen(self) -> Literal[32]: ... class IPv4Address(_BaseV4, _BaseAddress): + def __init__(self, address: object) -> None: ... @property def is_global(self) -> bool: ... @property @@ -134,7 +133,8 @@ class IPv4Address(_BaseV4, _BaseAddress): @property def ipv6_mapped(self) -> IPv6Address: ... -class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): ... +class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): + def __init__(self, address: object, strict: bool = ...) -> None: ... class IPv4Interface(IPv4Address): netmask: IPv4Address @@ -159,6 +159,7 @@ class _BaseV6: def max_prefixlen(self) -> Literal[128]: ... class IPv6Address(_BaseV6, _BaseAddress): + def __init__(self, address: object) -> None: ... @property def is_global(self) -> bool: ... @property @@ -191,6 +192,7 @@ class IPv6Address(_BaseV6, _BaseAddress): def __eq__(self, other: object) -> bool: ... class IPv6Network(_BaseV6, _BaseNetwork[IPv6Address]): + def __init__(self, address: object, strict: bool = ...) -> None: ... @property def is_site_local(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/itertools.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/itertools.pyi index 013c3cba120f..55b0814ac5e0 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/itertools.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/itertools.pyi @@ -40,29 +40,29 @@ class count(Generic[_N]): def __iter__(self) -> Self: ... class cycle(Generic[_T]): - def __init__(self, iterable: Iterable[_T], /) -> None: ... + def __new__(cls, iterable: Iterable[_T], /) -> Self: ... def __next__(self) -> _T: ... def __iter__(self) -> Self: ... class repeat(Generic[_T]): @overload - def __init__(self, object: _T) -> None: ... + def __new__(cls, object: _T) -> Self: ... @overload - def __init__(self, object: _T, times: int) -> None: ... + def __new__(cls, object: _T, times: int) -> Self: ... def __next__(self) -> _T: ... def __iter__(self) -> Self: ... def __length_hint__(self) -> int: ... class accumulate(Generic[_T]): @overload - def __init__(self, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> None: ... + def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ... @overload - def __init__(self, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> None: ... + def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> Self: ... def __iter__(self) -> Self: ... def __next__(self) -> _T: ... class chain(Generic[_T]): - def __init__(self, *iterables: Iterable[_T]) -> None: ... + def __new__(cls, *iterables: Iterable[_T]) -> Self: ... def __next__(self) -> _T: ... def __iter__(self) -> Self: ... @classmethod @@ -72,17 +72,17 @@ class chain(Generic[_T]): def __class_getitem__(cls, item: Any, /) -> GenericAlias: ... class compress(Generic[_T]): - def __init__(self, data: Iterable[_T], selectors: Iterable[Any]) -> None: ... + def __new__(cls, data: Iterable[_T], selectors: Iterable[Any]) -> Self: ... def __iter__(self) -> Self: ... def __next__(self) -> _T: ... class dropwhile(Generic[_T]): - def __init__(self, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> None: ... + def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ... def __iter__(self) -> Self: ... def __next__(self) -> _T: ... class filterfalse(Generic[_T]): - def __init__(self, predicate: _Predicate[_T] | None, iterable: Iterable[_T], /) -> None: ... + def __new__(cls, function: _Predicate[_T] | None, iterable: Iterable[_T], /) -> Self: ... def __iter__(self) -> Self: ... def __next__(self) -> _T: ... @@ -96,9 +96,9 @@ class groupby(Generic[_T_co, _S_co]): class islice(Generic[_T]): @overload - def __init__(self, iterable: Iterable[_T], stop: int | None, /) -> None: ... + def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ... @overload - def __init__(self, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> None: ... + def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> Self: ... def __iter__(self) -> Self: ... def __next__(self) -> _T: ... @@ -108,7 +108,7 @@ class starmap(Generic[_T_co]): def __next__(self) -> _T_co: ... class takewhile(Generic[_T]): - def __init__(self, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> None: ... + def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ... def __iter__(self) -> Self: ... def __next__(self) -> _T: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi index f3b98996b752..68b42e92d295 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/json/scanner.pyi @@ -1,3 +1,7 @@ from _json import make_scanner as make_scanner +from re import Pattern +from typing import Final __all__ = ["make_scanner"] + +NUMBER_RE: Final[Pattern[str]] # undocumented diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pgen2/pgen.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pgen2/pgen.pyi index 6d9f776c61ae..5776d100d1da 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pgen2/pgen.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pgen2/pgen.pyi @@ -1,6 +1,6 @@ from _typeshed import Incomplete, StrPath from collections.abc import Iterable, Iterator -from typing import IO, NoReturn, overload +from typing import IO, ClassVar, NoReturn, overload from . import grammar from .tokenize import _TokenInfo @@ -46,5 +46,6 @@ class DFAState: def addarc(self, next: DFAState, label: str) -> None: ... def unifystate(self, old: DFAState, new: DFAState) -> None: ... def __eq__(self, other: DFAState) -> bool: ... # type: ignore[override] + __hash__: ClassVar[None] # type: ignore[assignment] def generate_grammar(filename: StrPath = "Grammar.txt") -> PgenGrammar: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pytree.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pytree.pyi index 138333bd58af..51bdbc75e142 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pytree.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/lib2to3/pytree.pyi @@ -1,7 +1,7 @@ from _typeshed import Incomplete, SupportsGetItem, SupportsLenAndGetItem, Unused from abc import abstractmethod from collections.abc import Iterable, Iterator, MutableSequence -from typing import Final +from typing import ClassVar, Final from typing_extensions import Self, TypeAlias from .fixer_base import BaseFix @@ -24,6 +24,7 @@ class Base: was_changed: bool was_checked: bool def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] @abstractmethod def _eq(self, other: Base) -> bool: ... @abstractmethod diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi index f94e876237d1..c9b8358cde6c 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi @@ -35,8 +35,8 @@ class mmap: def __init__(self, fileno: int, length: int, tagname: str | None = ..., access: int = ..., offset: int = ...) -> None: ... else: if sys.version_info >= (3, 13): - def __init__( - self, + def __new__( + cls, fileno: int, length: int, flags: int = ..., @@ -45,11 +45,11 @@ class mmap: offset: int = ..., *, trackfd: bool = True, - ) -> None: ... + ) -> Self: ... else: - def __init__( - self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... - ) -> None: ... + def __new__( + cls, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ... + ) -> Self: ... def close(self) -> None: ... def flush(self, offset: int = ..., size: int = ...) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/managers.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/managers.pyi index 1669c5f09f97..ad5697e0ab1c 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/managers.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/managers.pyi @@ -1,13 +1,14 @@ import queue import sys import threading -from _typeshed import Incomplete, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT +from _typeshed import SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping, MutableSequence, Sequence from types import TracebackType from typing import Any, AnyStr, ClassVar, Generic, SupportsIndex, TypeVar, overload from typing_extensions import Self, TypeAlias -from .connection import Connection +from . import pool +from .connection import Connection, _Address from .context import BaseContext from .shared_memory import _SLT, ShareableList as _ShareableList, SharedMemory as _SharedMemory from .util import Finalize as _Finalize @@ -30,14 +31,14 @@ _Namespace: TypeAlias = Namespace class Token: typeid: str | bytes | None - address: tuple[str | bytes, int] + address: _Address | None id: str | bytes | int | None - def __init__(self, typeid: bytes | str | None, address: tuple[str | bytes, int], id: str | bytes | int | None) -> None: ... + def __init__(self, typeid: bytes | str | None, address: _Address | None, id: str | bytes | int | None) -> None: ... def __getstate__(self) -> tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]: ... def __setstate__(self, state: tuple[str | bytes | None, tuple[str | bytes, int], str | bytes | int | None]) -> None: ... class BaseProxy: - _address_to_local: dict[Any, Any] + _address_to_local: dict[_Address, Any] _mutex: Any def __init__( self, @@ -129,6 +130,7 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]): def __setitem__(self, s: slice, o: Iterable[_T], /) -> None: ... def __mul__(self, n: SupportsIndex, /) -> list[_T]: ... def __rmul__(self, n: SupportsIndex, /) -> list[_T]: ... + def __imul__(self, value: SupportsIndex, /) -> Self: ... def __reversed__(self) -> Iterator[_T]: ... def append(self, object: _T, /) -> None: ... def extend(self, iterable: Iterable[_T], /) -> None: ... @@ -150,22 +152,50 @@ class ListProxy(BaseListProxy[_T]): if sys.version_info >= (3, 13): def __class_getitem__(cls, args: Any, /) -> Any: ... +# Send is (kind, result) +# Receive is (id, methodname, args, kwds) +_ServerConnection: TypeAlias = Connection[tuple[str, Any], tuple[str, str, Iterable[Any], Mapping[str, Any]]] + # Returned by BaseManager.get_server() class Server: - address: Any + address: _Address | None + id_to_obj: dict[str, tuple[Any, set[str], dict[str, str]]] + fallback_mapping: dict[str, Callable[[_ServerConnection, str, Any], Any]] + public: list[str] + # Registry values are (callable, exposed, method_to_typeid, proxytype) def __init__( - self, registry: dict[str, tuple[Callable[..., Any], Any, Any, Any]], address: Any, authkey: bytes, serializer: str + self, + registry: dict[str, tuple[Callable[..., Any], Iterable[str], dict[str, str], Any]], + address: _Address | None, + authkey: bytes, + serializer: str, ) -> None: ... def serve_forever(self) -> None: ... - def accept_connection( - self, c: Connection[tuple[str, str | None], tuple[str, str, Iterable[Incomplete], Mapping[str, Incomplete]]], name: str - ) -> None: ... + def accepter(self) -> None: ... + if sys.version_info >= (3, 10): + def handle_request(self, conn: _ServerConnection) -> None: ... + else: + def handle_request(self, c: _ServerConnection) -> None: ... + + def serve_client(self, conn: _ServerConnection) -> None: ... + def fallback_getvalue(self, conn: _ServerConnection, ident: str, obj: _T) -> _T: ... + def fallback_str(self, conn: _ServerConnection, ident: str, obj: Any) -> str: ... + def fallback_repr(self, conn: _ServerConnection, ident: str, obj: Any) -> str: ... + def dummy(self, c: _ServerConnection) -> None: ... + def debug_info(self, c: _ServerConnection) -> str: ... + def number_of_objects(self, c: _ServerConnection) -> int: ... + def shutdown(self, c: _ServerConnection) -> None: ... + def create(self, c: _ServerConnection, typeid: str, /, *args: Any, **kwds: Any) -> tuple[str, tuple[str, ...]]: ... + def get_methods(self, c: _ServerConnection, token: Token) -> set[str]: ... + def accept_connection(self, c: _ServerConnection, name: str) -> None: ... + def incref(self, c: _ServerConnection, ident: str) -> None: ... + def decref(self, c: _ServerConnection, ident: str) -> None: ... class BaseManager: if sys.version_info >= (3, 11): def __init__( self, - address: Any | None = None, + address: _Address | None = None, authkey: bytes | None = None, serializer: str = "pickle", ctx: BaseContext | None = None, @@ -175,7 +205,7 @@ class BaseManager: else: def __init__( self, - address: Any | None = None, + address: _Address | None = None, authkey: bytes | None = None, serializer: str = "pickle", ctx: BaseContext | None = None, @@ -187,7 +217,7 @@ class BaseManager: shutdown: _Finalize # only available after start() was called def join(self, timeout: float | None = None) -> None: ... # undocumented @property - def address(self) -> Any: ... + def address(self) -> _Address | None: ... @classmethod def register( cls, @@ -204,14 +234,26 @@ class BaseManager: ) -> None: ... class SyncManager(BaseManager): - def BoundedSemaphore(self, value: Any = ...) -> threading.BoundedSemaphore: ... - def Condition(self, lock: Any = ...) -> threading.Condition: ... + def Barrier( + self, parties: int, action: Callable[[], None] | None = None, timeout: float | None = None + ) -> threading.Barrier: ... + def BoundedSemaphore(self, value: int = 1) -> threading.BoundedSemaphore: ... + def Condition(self, lock: threading.Lock | threading._RLock | None = None) -> threading.Condition: ... def Event(self) -> threading.Event: ... def Lock(self) -> threading.Lock: ... def Namespace(self) -> _Namespace: ... + def Pool( + self, + processes: int | None = None, + initializer: Callable[..., object] | None = None, + initargs: Iterable[Any] = (), + maxtasksperchild: int | None = None, + context: Any | None = None, + ) -> pool.Pool: ... def Queue(self, maxsize: int = ...) -> queue.Queue[Any]: ... + def JoinableQueue(self, maxsize: int = ...) -> queue.Queue[Any]: ... def RLock(self) -> threading.RLock: ... - def Semaphore(self, value: Any = ...) -> threading.Semaphore: ... + def Semaphore(self, value: int = 1) -> threading.Semaphore: ... def Array(self, typecode: Any, sequence: Sequence[_T]) -> Sequence[_T]: ... def Value(self, typecode: Any, value: _T) -> ValueProxy[_T]: ... # Overloads are copied from builtins.dict.__init__ @@ -237,7 +279,11 @@ class SyncManager(BaseManager): def list(self) -> ListProxy[Any]: ... class RemoteError(Exception): ... -class SharedMemoryServer(Server): ... + +class SharedMemoryServer(Server): + def track_segment(self, c: _ServerConnection, segment_name: str) -> None: ... + def release_segment(self, c: _ServerConnection, segment_name: str) -> None: ... + def list_segments(self, c: _ServerConnection) -> list[str]: ... class SharedMemoryManager(BaseManager): def get_server(self) -> SharedMemoryServer: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/pool.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/pool.pyi index 61d6d0781213..2937d45e3b03 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/pool.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/pool.pyi @@ -1,5 +1,6 @@ import sys from collections.abc import Callable, Iterable, Mapping +from multiprocessing.context import DefaultContext, Process from types import TracebackType from typing import Any, Final, Generic, TypeVar from typing_extensions import Self @@ -53,6 +54,8 @@ class Pool: maxtasksperchild: int | None = None, context: Any | None = None, ) -> None: ... + @staticmethod + def Process(ctx: DefaultContext, *args: Any, **kwds: Any) -> Process: ... def apply(self, func: Callable[..., _T], args: Iterable[Any] = (), kwds: Mapping[str, Any] = {}) -> _T: ... def apply_async( self, diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/reduction.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/reduction.pyi index 473e90936d71..942e92ce530e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/reduction.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/reduction.pyi @@ -1,12 +1,12 @@ import pickle import sys +from _pickle import _ReducedType from _typeshed import HasFileno, SupportsWrite, Unused from abc import ABCMeta from builtins import type as Type # alias to avoid name clash from collections.abc import Callable from copyreg import _DispatchTableType from multiprocessing import connection -from pickle import _ReducedType from socket import socket from typing import Any, Final diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi index e3cbfbc0ec82..a0d97baa0633 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/synchronize.pyi @@ -54,6 +54,7 @@ class RLock(SemLock): class Semaphore(SemLock): def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ... + def get_value(self) -> int: ... class BoundedSemaphore(Semaphore): def __init__(self, value: int = 1, *, ctx: BaseContext) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/numbers.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/numbers.pyi index e129de2cdc67..f2bca4e58bc5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/numbers.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/numbers.pyi @@ -9,7 +9,7 @@ from _typeshed import Incomplete from abc import ABCMeta, abstractmethod -from typing import Literal, Protocol, overload +from typing import ClassVar, Literal, Protocol, overload __all__ = ["Number", "Complex", "Real", "Rational", "Integral"] @@ -102,6 +102,7 @@ class Complex(Number, _ComplexLike): def conjugate(self) -> _ComplexLike: ... @abstractmethod def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] # See comment at the top of the file # for why some of these return types are purposefully vague diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/operator.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/operator.pyi index b73e037f3ed9..bc2b5e026617 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/operator.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/operator.pyi @@ -54,7 +54,7 @@ from _operator import ( ) from _typeshed import SupportsGetItem from typing import Any, Generic, TypeVar, final, overload -from typing_extensions import TypeVarTuple, Unpack +from typing_extensions import Self, TypeVarTuple, Unpack _T = TypeVar("_T") _T_co = TypeVar("_T_co", covariant=True) @@ -211,5 +211,5 @@ class itemgetter(Generic[_T_co]): @final class methodcaller: - def __init__(self, name: str, /, *args: Any, **kwargs: Any) -> None: ... + def __new__(cls, name: str, /, *args: Any, **kwargs: Any) -> Self: ... def __call__(self, obj: Any) -> Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/optparse.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/optparse.pyi index d6db7a06f291..ff5e83cf26db 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/optparse.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/optparse.pyi @@ -1,7 +1,9 @@ +import builtins from _typeshed import Incomplete, MaybeNone from abc import abstractmethod from collections.abc import Callable, Iterable, Mapping, Sequence -from typing import IO, Any, AnyStr, Literal, NoReturn, overload +from typing import IO, Any, AnyStr, ClassVar, Literal, NoReturn, overload +from typing_extensions import Self __all__ = [ "Option", @@ -27,8 +29,9 @@ NO_DEFAULT: tuple[str, ...] SUPPRESS_HELP: str SUPPRESS_USAGE: str -def check_builtin(option: Option, opt, value: str): ... -def check_choice(option: Option, opt, value: str) -> str: ... +# Can return complex, float, or int depending on the option's type +def check_builtin(option: Option, opt: str, value: str) -> complex: ... +def check_choice(option: Option, opt: str, value: str) -> str: ... class OptParseError(Exception): msg: str @@ -62,9 +65,11 @@ class HelpFormatter: max_help_position: int option_strings: dict[Option, str] parser: OptionParser - short_first: Incomplete + short_first: bool | Literal[0, 1] width: int - def __init__(self, indent_increment: int, max_help_position: int, width: int | None, short_first: int) -> None: ... + def __init__( + self, indent_increment: int, max_help_position: int, width: int | None, short_first: bool | Literal[0, 1] + ) -> None: ... def dedent(self) -> None: ... def expand_default(self, option: Option) -> str: ... def format_description(self, description: str | None) -> str: ... @@ -83,14 +88,22 @@ class HelpFormatter: class IndentedHelpFormatter(HelpFormatter): def __init__( - self, indent_increment: int = 2, max_help_position: int = 24, width: int | None = None, short_first: int = 1 + self, + indent_increment: int = 2, + max_help_position: int = 24, + width: int | None = None, + short_first: bool | Literal[0, 1] = 1, ) -> None: ... def format_heading(self, heading: str) -> str: ... def format_usage(self, usage: str) -> str: ... class TitledHelpFormatter(HelpFormatter): def __init__( - self, indent_increment: int = 0, max_help_position: int = 24, width: int | None = None, short_first: int = 0 + self, + indent_increment: int = 0, + max_help_position: int = 24, + width: int | None = None, + short_first: bool | Literal[0, 1] = 0, ) -> None: ... def format_heading(self, heading: str) -> str: ... def format_usage(self, usage: str) -> str: ... @@ -99,25 +112,46 @@ class Option: ACTIONS: tuple[str, ...] ALWAYS_TYPED_ACTIONS: tuple[str, ...] ATTRS: list[str] - CHECK_METHODS: list[Callable[..., Incomplete]] | None + CHECK_METHODS: list[Callable[[Self], object]] | None CONST_ACTIONS: tuple[str, ...] STORE_ACTIONS: tuple[str, ...] TYPED_ACTIONS: tuple[str, ...] TYPES: tuple[str, ...] - TYPE_CHECKER: dict[str, Callable[[Option, str, Incomplete], Any]] + TYPE_CHECKER: dict[str, Callable[[Option, str, str], object]] _long_opts: list[str] _short_opts: list[str] action: str + type: str | None dest: str | None - default: Incomplete + default: Any # default can be "any" type nargs: int - type: Incomplete - callback: Callable[..., Incomplete] | None - callback_args: tuple[Incomplete, ...] | None - callback_kwargs: dict[str, Incomplete] | None + const: Any | None # const can be "any" type + choices: list[str] | tuple[str, ...] | None + # Callback args and kwargs cannot be expressed in Python's type system. + # Revisit if ParamSpec is ever changed to work with packed args/kwargs. + callback: Callable[..., object] | None + callback_args: tuple[Any, ...] | None + callback_kwargs: dict[str, Any] | None help: str | None metavar: str | None - def __init__(self, *opts: str | None, **attrs) -> None: ... + def __init__( + self, + *opts: str | None, + # The following keywords are handled by the _set_attrs method. All default to + # `None` except for `default`, which defaults to `NO_DEFAULT`. + action: str | None = None, + type: str | builtins.type | None = None, + dest: str | None = None, + default: Any = ..., # = NO_DEFAULT + nargs: int | None = None, + const: Any | None = None, + choices: list[str] | tuple[str, ...] | None = None, + callback: Callable[..., object] | None = None, + callback_args: tuple[Any, ...] | None = None, + callback_kwargs: dict[str, Any] | None = None, + help: str | None = None, + metavar: str | None = None, + ) -> None: ... def _check_action(self) -> None: ... def _check_callback(self) -> None: ... def _check_choice(self) -> None: ... @@ -126,13 +160,14 @@ class Option: def _check_nargs(self) -> None: ... def _check_opt_strings(self, opts: Iterable[str | None]) -> list[str]: ... def _check_type(self) -> None: ... - def _set_attrs(self, attrs: dict[str, Incomplete]) -> None: ... + def _set_attrs(self, attrs: dict[str, Any]) -> None: ... # accepted attrs depend on the ATTRS attribute def _set_opt_strings(self, opts: Iterable[str]) -> None: ... - def check_value(self, opt: str, value): ... - def convert_value(self, opt: str, value): ... + def check_value(self, opt: str, value: str) -> Any: ... # return type cannot be known statically + def convert_value(self, opt: str, value: str | tuple[str, ...] | None) -> Any: ... # return type cannot be known statically def get_opt_string(self) -> str: ... - def process(self, opt, value, values, parser: OptionParser) -> int: ... - def take_action(self, action: str, dest: str, opt, value, values, parser: OptionParser) -> int: ... + def process(self, opt: str, value: str | tuple[str, ...] | None, values: Values, parser: OptionParser) -> int: ... + # value of take_action can be "any" type + def take_action(self, action: str, dest: str, opt: str, value: Any, values: Values, parser: OptionParser) -> int: ... def takes_value(self) -> bool: ... make_option = Option @@ -141,7 +176,7 @@ class OptionContainer: _long_opt: dict[str, Option] _short_opt: dict[str, Option] conflict_handler: str - defaults: dict[str, Incomplete] + defaults: dict[str, Any] # default values can be "any" type description: str | None option_class: type[Option] def __init__( @@ -153,7 +188,25 @@ class OptionContainer: @overload def add_option(self, opt: Option, /) -> Option: ... @overload - def add_option(self, arg: str, /, *args: str | None, **kwargs) -> Option: ... + def add_option( + self, + opt_str: str, + /, + *opts: str | None, + action: str | None = None, + type: str | builtins.type | None = None, + dest: str | None = None, + default: Any = ..., # = NO_DEFAULT + nargs: int | None = None, + const: Any | None = None, + choices: list[str] | tuple[str, ...] | None = None, + callback: Callable[..., object] | None = None, + callback_args: tuple[Any, ...] | None = None, + callback_kwargs: dict[str, Any] | None = None, + help: str | None = None, + metavar: str | None = None, + **kwargs, # Allow arbitrary keyword arguments for user defined option_class + ) -> Option: ... def add_options(self, option_list: Iterable[Option]) -> None: ... def destroy(self) -> None: ... def format_option_help(self, formatter: HelpFormatter) -> str: ... @@ -175,15 +228,19 @@ class OptionGroup(OptionContainer): def set_title(self, title: str) -> None: ... class Values: - def __init__(self, defaults: Mapping[str, Incomplete] | None = None) -> None: ... - def _update(self, dict: Mapping[str, Incomplete], mode) -> None: ... - def _update_careful(self, dict: Mapping[str, Incomplete]) -> None: ... - def _update_loose(self, dict: Mapping[str, Incomplete]) -> None: ... - def ensure_value(self, attr: str, value): ... - def read_file(self, filename: str, mode: str = "careful") -> None: ... - def read_module(self, modname: str, mode: str = "careful") -> None: ... - def __getattr__(self, name: str): ... - def __setattr__(self, name: str, value, /) -> None: ... + def __init__(self, defaults: Mapping[str, object] | None = None) -> None: ... + def _update(self, dict: Mapping[str, object], mode: Literal["careful", "loose"]) -> None: ... + def _update_careful(self, dict: Mapping[str, object]) -> None: ... + def _update_loose(self, dict: Mapping[str, object]) -> None: ... + def ensure_value(self, attr: str, value: object) -> Any: ... # return type cannot be known statically + def read_file(self, filename: str, mode: Literal["careful", "loose"] = "careful") -> None: ... + def read_module(self, modname: str, mode: Literal["careful", "loose"] = "careful") -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] + # __getattr__ doesn't exist, but anything passed as a default to __init__ + # is set on the instance. + def __getattr__(self, name: str) -> Any: ... + # TODO mypy infers -> object for __getattr__ if __setattr__ has `value: object` + def __setattr__(self, name: str, value: Any, /) -> None: ... def __eq__(self, other: object) -> bool: ... class OptionParser(OptionContainer): @@ -227,7 +284,7 @@ class OptionParser(OptionContainer): @overload def add_option_group(self, opt_group: OptionGroup, /) -> OptionGroup: ... @overload - def add_option_group(self, *args, **kwargs) -> OptionGroup: ... + def add_option_group(self, title: str, /, description: str | None = None) -> OptionGroup: ... def check_values(self, values: Values, args: list[str]) -> tuple[Values, list[str]]: ... def disable_interspersed_args(self) -> None: ... def enable_interspersed_args(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi index 98260b14e7ed..64691b514a48 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi @@ -231,6 +231,7 @@ if sys.platform == "linux" and sys.version_info >= (3, 12): "CLONE_NEWNET", "CLONE_NEWNS", "CLONE_NEWPID", + "CLONE_NEWTIME", "CLONE_NEWUSER", "CLONE_NEWUTS", "CLONE_SIGHAND", diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/parser.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/parser.pyi index bafc8015fed9..26140c76248a 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/parser.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/parser.pyi @@ -1,7 +1,7 @@ from _typeshed import StrOrBytesPath from collections.abc import Sequence from types import CodeType -from typing import Any, final +from typing import Any, ClassVar, final def expr(source: str) -> STType: ... def suite(source: str) -> STType: ... @@ -17,6 +17,7 @@ class ParserError(Exception): ... @final class STType: + __hash__: ClassVar[None] # type: ignore[assignment] def compile(self, filename: StrOrBytesPath = ...) -> CodeType: ... def isexpr(self) -> bool: ... def issuite(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/pickle.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/pickle.pyi index 9bea92ef1c9e..2d80d61645e0 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/pickle.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/pickle.pyi @@ -1,7 +1,21 @@ +from _pickle import ( + PickleError as PickleError, + Pickler as Pickler, + PicklingError as PicklingError, + Unpickler as Unpickler, + UnpicklingError as UnpicklingError, + _BufferCallback, + _ReadableFileobj, + _ReducedType, + dump as dump, + dumps as dumps, + load as load, + loads as loads, +) from _typeshed import ReadableBuffer, SupportsWrite -from collections.abc import Callable, Iterable, Iterator, Mapping -from typing import Any, ClassVar, Protocol, SupportsBytes, SupportsIndex, final -from typing_extensions import TypeAlias +from collections.abc import Callable, Iterable, Mapping +from typing import Any, ClassVar, SupportsBytes, SupportsIndex, final +from typing_extensions import Self __all__ = [ "PickleBuffer", @@ -93,96 +107,14 @@ DEFAULT_PROTOCOL: int bytes_types: tuple[type[Any], ...] # undocumented -class _ReadableFileobj(Protocol): - def read(self, n: int, /) -> bytes: ... - def readline(self) -> bytes: ... - @final class PickleBuffer: - def __init__(self, buffer: ReadableBuffer) -> None: ... + def __new__(cls, buffer: ReadableBuffer) -> Self: ... def raw(self) -> memoryview: ... def release(self) -> None: ... def __buffer__(self, flags: int, /) -> memoryview: ... def __release_buffer__(self, buffer: memoryview, /) -> None: ... -_BufferCallback: TypeAlias = Callable[[PickleBuffer], Any] | None - -def dump( - obj: Any, - file: SupportsWrite[bytes], - protocol: int | None = None, - *, - fix_imports: bool = True, - buffer_callback: _BufferCallback = None, -) -> None: ... -def dumps( - obj: Any, protocol: int | None = None, *, fix_imports: bool = True, buffer_callback: _BufferCallback = None -) -> bytes: ... -def load( - file: _ReadableFileobj, - *, - fix_imports: bool = True, - encoding: str = "ASCII", - errors: str = "strict", - buffers: Iterable[Any] | None = (), -) -> Any: ... -def loads( - data: ReadableBuffer, - /, - *, - fix_imports: bool = True, - encoding: str = "ASCII", - errors: str = "strict", - buffers: Iterable[Any] | None = (), -) -> Any: ... - -class PickleError(Exception): ... -class PicklingError(PickleError): ... -class UnpicklingError(PickleError): ... - -_ReducedType: TypeAlias = ( - str - | tuple[Callable[..., Any], tuple[Any, ...]] - | tuple[Callable[..., Any], tuple[Any, ...], Any] - | tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None] - | tuple[Callable[..., Any], tuple[Any, ...], Any, Iterator[Any] | None, Iterator[Any] | None] -) - -class Pickler: - fast: bool - dispatch_table: Mapping[type, Callable[[Any], _ReducedType]] - bin: bool # undocumented - dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only - - def __init__( - self, - file: SupportsWrite[bytes], - protocol: int | None = None, - *, - fix_imports: bool = True, - buffer_callback: _BufferCallback = None, - ) -> None: ... - def reducer_override(self, obj: Any) -> Any: ... - def dump(self, obj: Any, /) -> None: ... - def clear_memo(self) -> None: ... - def persistent_id(self, obj: Any) -> Any: ... - -class Unpickler: - dispatch: ClassVar[dict[int, Callable[[Unpickler], None]]] # undocumented, _Unpickler only - - def __init__( - self, - file: _ReadableFileobj, - *, - fix_imports: bool = True, - encoding: str = "ASCII", - errors: str = "strict", - buffers: Iterable[Any] | None = (), - ) -> None: ... - def load(self) -> Any: ... - def find_class(self, module_name: str, global_name: str, /) -> Any: ... - def persistent_load(self, pid: Any) -> Any: ... - MARK: bytes STOP: bytes POP: bytes @@ -266,6 +198,36 @@ READONLY_BUFFER: bytes def encode_long(x: int) -> bytes: ... # undocumented def decode_long(data: Iterable[SupportsIndex] | SupportsBytes | ReadableBuffer) -> int: ... # undocumented -# pure-Python implementations -_Pickler = Pickler # undocumented -_Unpickler = Unpickler # undocumented +# undocumented pure-Python implementations +class _Pickler: + fast: bool + dispatch_table: Mapping[type, Callable[[Any], _ReducedType]] + bin: bool # undocumented + dispatch: ClassVar[dict[type, Callable[[Unpickler, Any], None]]] # undocumented, _Pickler only + reducer_override: Callable[[Any], Any] + def __init__( + self, + file: SupportsWrite[bytes], + protocol: int | None = None, + *, + fix_imports: bool = True, + buffer_callback: _BufferCallback = None, + ) -> None: ... + def dump(self, obj: Any) -> None: ... + def clear_memo(self) -> None: ... + def persistent_id(self, obj: Any) -> Any: ... + +class _Unpickler: + dispatch: ClassVar[dict[int, Callable[[Unpickler], None]]] # undocumented, _Unpickler only + def __init__( + self, + file: _ReadableFileobj, + *, + fix_imports: bool = True, + encoding: str = "ASCII", + errors: str = "strict", + buffers: Iterable[Any] | None = None, + ) -> None: ... + def load(self) -> Any: ... + def find_class(self, module: str, name: str) -> Any: ... + def persistent_load(self, pid: Any) -> Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/pickletools.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/pickletools.pyi index 542172814926..cdade08d39a8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/pickletools.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/pickletools.pyi @@ -1,3 +1,4 @@ +import sys from collections.abc import Callable, Iterator, MutableMapping from typing import IO, Any from typing_extensions import TypeAlias @@ -40,7 +41,13 @@ def read_uint8(f: IO[bytes]) -> int: ... uint8: ArgumentDescriptor -def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True) -> bytes | str: ... +if sys.version_info >= (3, 12): + def read_stringnl( + f: IO[bytes], decode: bool = True, stripquotes: bool = True, *, encoding: str = "latin-1" + ) -> bytes | str: ... + +else: + def read_stringnl(f: IO[bytes], decode: bool = True, stripquotes: bool = True) -> bytes | str: ... stringnl: ArgumentDescriptor diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/plistlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/plistlib.pyi index 09637673ce21..72b5398f0a52 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/plistlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/plistlib.pyi @@ -3,7 +3,7 @@ from _typeshed import ReadableBuffer from collections.abc import Mapping, MutableMapping from datetime import datetime from enum import Enum -from typing import IO, Any +from typing import IO, Any, ClassVar from typing_extensions import Self __all__ = ["InvalidFileException", "FMT_XML", "FMT_BINARY", "load", "dump", "loads", "dumps", "UID"] @@ -100,6 +100,7 @@ if sys.version_info < (3, 9): class Data: data: bytes def __init__(self, data: bytes) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] class UID: data: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi index ace501430847..52f87ab68ff5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/sched.pyi @@ -1,6 +1,6 @@ import sys from collections.abc import Callable -from typing import Any, NamedTuple, type_check_only +from typing import Any, ClassVar, NamedTuple, type_check_only from typing_extensions import TypeAlias __all__ = ["scheduler"] @@ -25,7 +25,8 @@ else: argument: tuple[Any, ...] kwargs: dict[str, Any] - class Event(_EventBase): ... + class Event(_EventBase): + __hash__: ClassVar[None] # type: ignore[assignment] class scheduler: timefunc: Callable[[], float] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/select.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/select.pyi index 6d4c8d8f4c15..42941b9e41fa 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/select.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/select.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import FileDescriptorLike from collections.abc import Iterable from types import TracebackType -from typing import Any, final +from typing import Any, ClassVar, final from typing_extensions import Self if sys.platform != "win32": @@ -10,7 +10,8 @@ if sys.platform != "win32": POLLERR: int POLLHUP: int POLLIN: int - POLLMSG: int + if sys.platform == "linux": + POLLMSG: int POLLNVAL: int POLLOUT: int POLLPRI: int @@ -21,11 +22,14 @@ if sys.platform != "win32": POLLWRBAND: int POLLWRNORM: int -class poll: - def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... - def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... - def unregister(self, fd: FileDescriptorLike) -> None: ... - def poll(self, timeout: float | None = ...) -> list[tuple[int, int]]: ... + # This is actually a function that returns an instance of a class. + # The class is not accessible directly, and also calls itself select.poll. + class poll: + # default value is select.POLLIN | select.POLLPRI | select.POLLOUT + def register(self, fd: FileDescriptorLike, eventmask: int = 7, /) -> None: ... + def modify(self, fd: FileDescriptorLike, eventmask: int, /) -> None: ... + def unregister(self, fd: FileDescriptorLike, /) -> None: ... + def poll(self, timeout: float | None = None, /) -> list[tuple[int, int]]: ... def select( rlist: Iterable[Any], wlist: Iterable[Any], xlist: Iterable[Any], timeout: float | None = None, / @@ -52,6 +56,7 @@ if sys.platform != "linux" and sys.platform != "win32": data: Any = ..., udata: Any = ..., ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] # BSD only @final @@ -77,7 +82,8 @@ if sys.platform != "linux" and sys.platform != "win32": KQ_EV_ONESHOT: int KQ_EV_SYSFLAGS: int KQ_FILTER_AIO: int - KQ_FILTER_NETDEV: int + if sys.platform != "darwin": + KQ_FILTER_NETDEV: int KQ_FILTER_PROC: int KQ_FILTER_READ: int KQ_FILTER_SIGNAL: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/selectors.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/selectors.pyi index a857d0e242ab..0ba843a403d8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/selectors.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/selectors.pyi @@ -50,10 +50,12 @@ if sys.platform == "linux": class EpollSelector(_PollLikeSelector): def fileno(self) -> int: ... -class DevpollSelector(_PollLikeSelector): - def fileno(self) -> int: ... +if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win32": + # Solaris only + class DevpollSelector(_PollLikeSelector): + def fileno(self) -> int: ... -if sys.platform != "win32": +if sys.platform != "win32" and sys.platform != "linux": class KqueueSelector(_BaseSelectorImpl): def fileno(self) -> int: ... def select(self, timeout: float | None = None) -> list[tuple[SelectorKey, _EventMask]]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/signal.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/signal.pyi index 2e3ac5bf24c3..8fc853b25cc1 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/signal.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/signal.pyi @@ -3,7 +3,7 @@ from _typeshed import structseq from collections.abc import Callable, Iterable from enum import IntEnum from types import FrameType -from typing import Any, Final, final +from typing import Any, Final, Literal, final from typing_extensions import Never, TypeAlias NSIG: int @@ -61,8 +61,8 @@ class Handlers(IntEnum): SIG_DFL = 0 SIG_IGN = 1 -SIG_DFL: Handlers -SIG_IGN: Handlers +SIG_DFL: Literal[Handlers.SIG_DFL] +SIG_IGN: Literal[Handlers.SIG_IGN] _SIGNUM: TypeAlias = int | Signals _HANDLER: TypeAlias = Callable[[int, FrameType | None], Any] | int | Handlers | None @@ -77,45 +77,45 @@ else: def getsignal(signalnum: _SIGNUM, /) -> _HANDLER: ... def signal(signalnum: _SIGNUM, handler: _HANDLER, /) -> _HANDLER: ... -SIGABRT: Signals -SIGFPE: Signals -SIGILL: Signals -SIGINT: Signals -SIGSEGV: Signals -SIGTERM: Signals +SIGABRT: Literal[Signals.SIGABRT] +SIGFPE: Literal[Signals.SIGFPE] +SIGILL: Literal[Signals.SIGILL] +SIGINT: Literal[Signals.SIGINT] +SIGSEGV: Literal[Signals.SIGSEGV] +SIGTERM: Literal[Signals.SIGTERM] if sys.platform == "win32": - SIGBREAK: Signals - CTRL_C_EVENT: Signals - CTRL_BREAK_EVENT: Signals + SIGBREAK: Literal[Signals.SIGBREAK] + CTRL_C_EVENT: Literal[Signals.CTRL_C_EVENT] + CTRL_BREAK_EVENT: Literal[Signals.CTRL_BREAK_EVENT] else: if sys.platform != "linux": - SIGINFO: Signals - SIGEMT: Signals - SIGALRM: Signals - SIGBUS: Signals - SIGCHLD: Signals - SIGCONT: Signals - SIGHUP: Signals - SIGIO: Signals - SIGIOT: Signals - SIGKILL: Signals - SIGPIPE: Signals - SIGPROF: Signals - SIGQUIT: Signals - SIGSTOP: Signals - SIGSYS: Signals - SIGTRAP: Signals - SIGTSTP: Signals - SIGTTIN: Signals - SIGTTOU: Signals - SIGURG: Signals - SIGUSR1: Signals - SIGUSR2: Signals - SIGVTALRM: Signals - SIGWINCH: Signals - SIGXCPU: Signals - SIGXFSZ: Signals + SIGINFO: Literal[Signals.SIGINFO] + SIGEMT: Literal[Signals.SIGEMT] + SIGALRM: Literal[Signals.SIGALRM] + SIGBUS: Literal[Signals.SIGBUS] + SIGCHLD: Literal[Signals.SIGCHLD] + SIGCONT: Literal[Signals.SIGCONT] + SIGHUP: Literal[Signals.SIGHUP] + SIGIO: Literal[Signals.SIGIO] + SIGIOT: Literal[Signals.SIGABRT] # alias + SIGKILL: Literal[Signals.SIGKILL] + SIGPIPE: Literal[Signals.SIGPIPE] + SIGPROF: Literal[Signals.SIGPROF] + SIGQUIT: Literal[Signals.SIGQUIT] + SIGSTOP: Literal[Signals.SIGSTOP] + SIGSYS: Literal[Signals.SIGSYS] + SIGTRAP: Literal[Signals.SIGTRAP] + SIGTSTP: Literal[Signals.SIGTSTP] + SIGTTIN: Literal[Signals.SIGTTIN] + SIGTTOU: Literal[Signals.SIGTTOU] + SIGURG: Literal[Signals.SIGURG] + SIGUSR1: Literal[Signals.SIGUSR1] + SIGUSR2: Literal[Signals.SIGUSR2] + SIGVTALRM: Literal[Signals.SIGVTALRM] + SIGWINCH: Literal[Signals.SIGWINCH] + SIGXCPU: Literal[Signals.SIGXCPU] + SIGXFSZ: Literal[Signals.SIGXFSZ] class ItimerError(OSError): ... ITIMER_PROF: int @@ -127,9 +127,9 @@ else: SIG_UNBLOCK = 1 SIG_SETMASK = 2 - SIG_BLOCK = Sigmasks.SIG_BLOCK - SIG_UNBLOCK = Sigmasks.SIG_UNBLOCK - SIG_SETMASK = Sigmasks.SIG_SETMASK + SIG_BLOCK: Literal[Sigmasks.SIG_BLOCK] + SIG_UNBLOCK: Literal[Sigmasks.SIG_UNBLOCK] + SIG_SETMASK: Literal[Sigmasks.SIG_SETMASK] def alarm(seconds: int, /) -> int: ... def getitimer(which: int, /) -> tuple[float, float]: ... def pause() -> None: ... @@ -147,13 +147,13 @@ else: else: def sigwait(sigset: Iterable[int], /) -> _SIGNUM: ... if sys.platform != "darwin": - SIGCLD: Signals - SIGPOLL: Signals - SIGPWR: Signals - SIGRTMAX: Signals - SIGRTMIN: Signals + SIGCLD: Literal[Signals.SIGCHLD] # alias + SIGPOLL: Literal[Signals.SIGIO] # alias + SIGPWR: Literal[Signals.SIGPWR] + SIGRTMAX: Literal[Signals.SIGRTMAX] + SIGRTMIN: Literal[Signals.SIGRTMIN] if sys.version_info >= (3, 11): - SIGSTKFLT: Signals + SIGSTKFLT: Literal[Signals.SIGSTKFLT] @final class struct_siginfo(structseq[int], tuple[int, int, int, int, int, int, int]): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi index e42bba757fc3..f982c9b893d8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/socket.pyi @@ -367,7 +367,6 @@ if sys.platform != "win32" and sys.platform != "darwin": IP_TRANSPARENT as IP_TRANSPARENT, IPX_TYPE as IPX_TYPE, SCM_CREDENTIALS as SCM_CREDENTIALS, - SO_BINDTODEVICE as SO_BINDTODEVICE, SO_DOMAIN as SO_DOMAIN, SO_MARK as SO_MARK, SO_PASSCRED as SO_PASSCRED, @@ -396,7 +395,6 @@ if sys.platform != "win32" and sys.platform != "darwin": __all__ += [ "IP_TRANSPARENT", "SCM_CREDENTIALS", - "SO_BINDTODEVICE", "SO_DOMAIN", "SO_MARK", "SO_PASSCRED", @@ -517,6 +515,11 @@ if sys.platform != "win32": "IPV6_RTHDRDSTOPTS", ] + if sys.platform != "darwin" or sys.version_info >= (3, 13): + from _socket import SO_BINDTODEVICE as SO_BINDTODEVICE + + __all__ += ["SO_BINDTODEVICE"] + if sys.platform != "darwin" and sys.platform != "linux": if sys.platform != "win32" or sys.version_info >= (3, 9): from _socket import BDADDR_ANY as BDADDR_ANY, BDADDR_LOCAL as BDADDR_LOCAL, BTPROTO_RFCOMM as BTPROTO_RFCOMM @@ -1046,7 +1049,6 @@ class AddressFamily(IntEnum): AF_INET = 2 AF_INET6 = 10 AF_APPLETALK = 5 - AF_DECnet = ... AF_IPX = 4 AF_SNA = 22 AF_UNSPEC = 0 @@ -1096,7 +1098,7 @@ class AddressFamily(IntEnum): AF_INET = AddressFamily.AF_INET AF_INET6 = AddressFamily.AF_INET6 AF_APPLETALK = AddressFamily.AF_APPLETALK -AF_DECnet = AddressFamily.AF_DECnet +AF_DECnet: Literal[12] AF_IPX = AddressFamily.AF_IPX AF_SNA = AddressFamily.AF_SNA AF_UNSPEC = AddressFamily.AF_UNSPEC @@ -1397,7 +1399,7 @@ def create_server( address: _Address, *, family: int = ..., backlog: int | None = None, reuse_port: bool = False, dualstack_ipv6: bool = False ) -> socket: ... -# the 5th tuple item is an address +# The 5th tuple item is the socket address, for IP4, IP6, or IP6 if Python is compiled with --disable-ipv6, respectively. def getaddrinfo( host: bytes | str | None, port: bytes | str | int | None, family: int = 0, type: int = 0, proto: int = 0, flags: int = 0 -) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ... +) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int] | tuple[int, bytes]]]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi index bc0ff6469d5e..b83516b4d4eb 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/sqlite3/__init__.pyi @@ -429,7 +429,7 @@ class PrepareProtocol: def __init__(self, *args: object, **kwargs: object) -> None: ... class Row(Sequence[Any]): - def __init__(self, cursor: Cursor, data: tuple[Any, ...], /) -> None: ... + def __new__(cls, cursor: Cursor, data: tuple[Any, ...], /) -> Self: ... def keys(self) -> list[str]: ... @overload def __getitem__(self, key: int | str, /) -> Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi index f587b51d5ac0..388e521c1ef5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/ssl.pyi @@ -325,6 +325,10 @@ class _ASN1Object(_ASN1ObjectBase): def fromname(cls, name: str) -> Self: ... class Purpose(_ASN1Object, enum.Enum): + # Normally this class would inherit __new__ from _ASN1Object, but + # because this is an enum, the inherited __new__ is replaced at runtime with + # Enum.__new__. + def __new__(cls, value: object) -> Self: ... SERVER_AUTH = (129, "serverAuth", "TLS Web Server Authentication", "1.3.6.1.5.5.7.3.2") # pyright: ignore[reportCallIssue] CLIENT_AUTH = (130, "clientAuth", "TLS Web Client Authentication", "1.3.6.1.5.5.7.3.1") # pyright: ignore[reportCallIssue] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi index c4b1adca9bc6..d11e64d109b5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/sys/__init__.pyi @@ -6,7 +6,7 @@ from collections.abc import AsyncGenerator, Callable, Sequence from io import TextIOWrapper from types import FrameType, ModuleType, TracebackType from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only -from typing_extensions import TypeAlias +from typing_extensions import LiteralString, TypeAlias _T = TypeVar("_T") @@ -45,7 +45,7 @@ if sys.version_info >= (3, 10): path: list[str] path_hooks: list[Callable[[str], PathEntryFinderProtocol]] path_importer_cache: dict[str, PathEntryFinderProtocol | None] -platform: str +platform: LiteralString if sys.version_info >= (3, 9): platlibdir: str prefix: str @@ -73,7 +73,7 @@ if sys.version_info >= (3, 10): __stdin__: Final[TextIOWrapper | None] # Contains the original value of stdin __stdout__: Final[TextIOWrapper | None] # Contains the original value of stdout __stderr__: Final[TextIOWrapper | None] # Contains the original value of stderr -tracebacklimit: int +tracebacklimit: int | None version: str api_version: int warnoptions: Any @@ -393,6 +393,10 @@ if sys.platform == "win32": def getwindowsversion() -> _WinVersion: ... def intern(string: str, /) -> str: ... + +if sys.version_info >= (3, 13): + def _is_gil_enabled() -> bool: ... + def is_finalizing() -> bool: ... def breakpointhook(*args: Any, **kwargs: Any) -> Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi index a7135d8150ee..009aa9070aa8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi @@ -1,7 +1,7 @@ import bz2 import io import sys -from _typeshed import StrOrBytesPath, StrPath, SupportsRead +from _typeshed import ReadableBuffer, StrOrBytesPath, StrPath, SupportsRead, WriteableBuffer 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 @@ -123,7 +123,7 @@ def open( @overload def open( name: StrOrBytesPath | None, - mode: Literal["x", "x:", "a", "a:", "w", "w:"], + mode: Literal["x", "x:", "a", "a:", "w", "w:", "w:tar"], fileobj: _Fileobj | None = None, bufsize: int = 10240, *, @@ -141,7 +141,7 @@ def open( def open( name: StrOrBytesPath | None = None, *, - mode: Literal["x", "x:", "a", "a:", "w", "w:"], + mode: Literal["x", "x:", "a", "a:", "w", "w:", "w:tar"], fileobj: _Fileobj | None = None, bufsize: int = 10240, format: int | None = ..., @@ -226,15 +226,29 @@ def open( errorlevel: int | None = ..., preset: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | None = ..., ) -> TarFile: ... - -# TODO: Temporary fallback for modes containing pipe characters. These don't -# work with mypy 1.10, but this should be fixed with mypy 1.11. -# https://github.com/python/typeshed/issues/12182 @overload def open( - name: StrOrBytesPath | None = None, + name: StrOrBytesPath | ReadableBuffer | None = None, + *, + mode: Literal["r|*", "r|", "r|gz", "r|bz2", "r|xz"], + fileobj: IO[bytes] | None = None, + bufsize: int = 10240, + format: int | None = ..., + tarinfo: type[TarInfo] | None = ..., + dereference: bool | None = ..., + ignore_zeros: bool | None = ..., + encoding: str | None = ..., + errors: str = ..., + pax_headers: Mapping[str, str] | None = ..., + debug: int | None = ..., + errorlevel: int | None = ..., + preset: int | None = ..., +) -> TarFile: ... +@overload +def open( + name: StrOrBytesPath | WriteableBuffer | None = None, *, - mode: str, + mode: Literal["w|", "w|gz", "w|bz2", "w|xz"], fileobj: IO[bytes] | None = None, bufsize: int = 10240, format: int | None = ..., @@ -557,7 +571,7 @@ class TarInfo: self, *, name: str = ..., - mtime: int = ..., + mtime: float = ..., mode: int = ..., linkname: str = ..., uid: int = ..., diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi index 294a1cb12b63..6b599256d17b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi @@ -1,5 +1,5 @@ import socket -from collections.abc import Callable, Sequence +from collections.abc import Callable, MutableSequence, Sequence from re import Match, Pattern from types import TracebackType from typing import Any @@ -114,7 +114,7 @@ class Telnet: def mt_interact(self) -> None: ... def listener(self) -> None: ... def expect( - self, list: Sequence[Pattern[bytes] | bytes], timeout: float | None = None + self, list: MutableSequence[Pattern[bytes] | bytes] | Sequence[Pattern[bytes]], timeout: float | None = None ) -> tuple[int, Match[bytes] | None, bytes]: ... def __enter__(self) -> Self: ... def __exit__( diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/threading.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/threading.pyi index c441a04681e2..efeea69d0234 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/threading.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/threading.pyi @@ -100,30 +100,22 @@ class Thread: class _DummyThread(Thread): def __init__(self) -> None: ... -@final -class Lock: - def __enter__(self) -> bool: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - def acquire(self, blocking: bool = ..., timeout: float = ...) -> bool: ... - def release(self) -> None: ... - def locked(self) -> bool: ... - def acquire_lock(self, blocking: bool = ..., timeout: float = ...) -> bool: ... # undocumented - def release_lock(self) -> None: ... # undocumented - def locked_lock(self) -> bool: ... # undocumented +# This is actually the function _thread.allocate_lock for <= 3.12 +Lock = _thread.LockType +# Python implementation of RLock. @final class _RLock: + _count: int def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ... def release(self) -> None: ... __enter__ = acquire def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ... -RLock = _RLock +RLock = _thread.RLock # Actually a function at runtime. class Condition: - def __init__(self, lock: Lock | _RLock | None = None) -> None: ... + def __init__(self, lock: Lock | _RLock | RLock | None = None) -> None: ... def __enter__(self) -> bool: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi index d6a234d67919..751de523bf7a 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/__init__.pyi @@ -5,7 +5,7 @@ from collections.abc import Callable, Iterable, Mapping, Sequence from tkinter.constants import * from tkinter.font import _FontDescription from types import TracebackType -from typing import Any, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only +from typing import Any, ClassVar, Generic, Literal, NamedTuple, Protocol, TypedDict, TypeVar, overload, type_check_only from typing_extensions import TypeAlias, TypeVarTuple, Unpack, deprecated if sys.version_info >= (3, 11): @@ -330,6 +330,7 @@ class Variable: def trace_vinfo(self): ... def __eq__(self, other: object) -> bool: ... def __del__(self) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] class StringVar(Variable): def __init__(self, master: Misc | None = None, value: str | None = None, name: str | None = None) -> None: ... @@ -370,6 +371,9 @@ class _GridIndexInfo(TypedDict, total=False): uniform: str | None weight: int +class _BusyInfo(TypedDict): + cursor: _Cursor + class Misc: master: Misc | None tk: _tkinter.TkappType @@ -403,7 +407,29 @@ class Misc: # after_idle is essentially partialmethod(after, "idle") def after_idle(self, func: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> str: ... def after_cancel(self, id: str) -> None: ... + if sys.version_info >= (3, 13): + def after_info(self, id: str | None = None) -> tuple[str, ...]: ... + def bell(self, displayof: Literal[0] | Misc | None = 0) -> None: ... + if sys.version_info >= (3, 13): + # Supports options from `_BusyInfo`` + def tk_busy_cget(self, option: Literal["cursor"]) -> _Cursor: ... + busy_cget = tk_busy_cget + def tk_busy_configure(self, cnf: Any = None, **kw: Any) -> Any: ... + tk_busy_config = tk_busy_configure + busy_configure = tk_busy_configure + busy_config = tk_busy_configure + def tk_busy_current(self, pattern: str | None = None) -> list[Misc]: ... + busy_current = tk_busy_current + def tk_busy_forget(self) -> None: ... + busy_forget = tk_busy_forget + def tk_busy_hold(self, **kw: Unpack[_BusyInfo]) -> None: ... + tk_busy = tk_busy_hold + busy_hold = tk_busy_hold + busy = tk_busy_hold + def tk_busy_status(self) -> bool: ... + busy_status = tk_busy_status + def clipboard_get(self, *, displayof: Misc = ..., type: str = ...) -> str: ... def clipboard_clear(self, *, displayof: Misc = ...) -> None: ... def clipboard_append(self, string: str, *, displayof: Misc = ..., format: str = ..., type: str = ...) -> None: ... @@ -659,6 +685,38 @@ class YView: @overload def yview_scroll(self, number: _ScreenUnits, what: Literal["pixels"]) -> None: ... +if sys.platform == "darwin": + @type_check_only + class _WmAttributes(TypedDict): + alpha: float + fullscreen: bool + modified: bool + notify: bool + titlepath: str + topmost: bool + transparent: bool + type: str # Present, but not actually used on darwin + +elif sys.platform == "win32": + @type_check_only + class _WmAttributes(TypedDict): + alpha: float + transparentcolor: str + disabled: bool + fullscreen: bool + toolwindow: bool + topmost: bool + +else: + # X11 + @type_check_only + class _WmAttributes(TypedDict): + alpha: float + topmost: bool + zoomed: bool + fullscreen: bool + type: str + class Wm: @overload def wm_aspect(self, minNumer: int, minDenom: int, maxNumer: int, maxDenom: int) -> None: ... @@ -667,12 +725,144 @@ class Wm: self, minNumer: None = None, minDenom: None = None, maxNumer: None = None, maxDenom: None = None ) -> tuple[int, int, int, int] | None: ... aspect = wm_aspect + if sys.version_info >= (3, 13): + @overload + def wm_attributes(self, *, return_python_dict: Literal[False] = False) -> tuple[Any, ...]: ... + @overload + def wm_attributes(self, *, return_python_dict: Literal[True]) -> _WmAttributes: ... + + else: + @overload + def wm_attributes(self) -> tuple[Any, ...]: ... + + @overload + def wm_attributes(self, option: Literal["-alpha"], /) -> float: ... + @overload + def wm_attributes(self, option: Literal["-fullscreen"], /) -> bool: ... @overload - def wm_attributes(self) -> tuple[Any, ...]: ... + def wm_attributes(self, option: Literal["-topmost"], /) -> bool: ... + if sys.platform == "darwin": + @overload + def wm_attributes(self, option: Literal["-modified"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["-notify"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["-titlepath"], /) -> str: ... + @overload + def wm_attributes(self, option: Literal["-transparent"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["-type"], /) -> str: ... + elif sys.platform == "win32": + @overload + def wm_attributes(self, option: Literal["-transparentcolor"], /) -> str: ... + @overload + def wm_attributes(self, option: Literal["-disabled"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["-toolwindow"], /) -> bool: ... + else: + # X11 + @overload + def wm_attributes(self, option: Literal["-zoomed"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["-type"], /) -> str: ... + if sys.version_info >= (3, 13): + @overload + def wm_attributes(self, option: Literal["alpha"], /) -> float: ... + @overload + def wm_attributes(self, option: Literal["fullscreen"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["topmost"], /) -> bool: ... + if sys.platform == "darwin": + @overload + def wm_attributes(self, option: Literal["modified"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["notify"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["titlepath"], /) -> str: ... + @overload + def wm_attributes(self, option: Literal["transparent"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["type"], /) -> str: ... + elif sys.platform == "win32": + @overload + def wm_attributes(self, option: Literal["transparentcolor"], /) -> str: ... + @overload + def wm_attributes(self, option: Literal["disabled"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["toolwindow"], /) -> bool: ... + else: + # X11 + @overload + def wm_attributes(self, option: Literal["zoomed"], /) -> bool: ... + @overload + def wm_attributes(self, option: Literal["type"], /) -> str: ... + @overload def wm_attributes(self, option: str, /): ... @overload - def wm_attributes(self, option: str, value, /, *__other_option_value_pairs: Any) -> None: ... + def wm_attributes(self, option: Literal["-alpha"], value: float, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-fullscreen"], value: bool, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-topmost"], value: bool, /) -> Literal[""]: ... + if sys.platform == "darwin": + @overload + def wm_attributes(self, option: Literal["-modified"], value: bool, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-notify"], value: bool, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-titlepath"], value: str, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-transparent"], value: bool, /) -> Literal[""]: ... + elif sys.platform == "win32": + @overload + def wm_attributes(self, option: Literal["-transparentcolor"], value: str, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-disabled"], value: bool, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-toolwindow"], value: bool, /) -> Literal[""]: ... + else: + # X11 + @overload + def wm_attributes(self, option: Literal["-zoomed"], value: bool, /) -> Literal[""]: ... + @overload + def wm_attributes(self, option: Literal["-type"], value: str, /) -> Literal[""]: ... + + @overload + def wm_attributes(self, option: str, value, /, *__other_option_value_pairs: Any) -> Literal[""]: ... + if sys.version_info >= (3, 13): + if sys.platform == "darwin": + @overload + def wm_attributes( + self, + *, + alpha: float = ..., + fullscreen: bool = ..., + modified: bool = ..., + notify: bool = ..., + titlepath: str = ..., + topmost: bool = ..., + transparent: bool = ..., + ) -> None: ... + elif sys.platform == "win32": + @overload + def wm_attributes( + self, + *, + alpha: float = ..., + transparentcolor: str = ..., + disabled: bool = ..., + fullscreen: bool = ..., + toolwindow: bool = ..., + topmost: bool = ..., + ) -> None: ... + else: + # X11 + @overload + def wm_attributes( + self, *, alpha: float = ..., topmost: bool = ..., zoomed: bool = ..., fullscreen: bool = ..., type: str = ... + ) -> None: ... + attributes = wm_attributes def wm_client(self, name: str | None = None) -> str: ... client = wm_client diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/filedialog.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/filedialog.pyi index 3d62f079178e..03f89cfbe3e6 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/filedialog.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/filedialog.pyi @@ -80,8 +80,8 @@ class Directory(commondialog.Dialog): # TODO: command kwarg available on macos def asksaveasfilename( *, - confirmoverwrite: bool | None = ..., - defaultextension: str | None = ..., + confirmoverwrite: bool | None = True, + defaultextension: str | None = "", filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., @@ -91,7 +91,7 @@ def asksaveasfilename( ) -> str: ... # can be empty string def askopenfilename( *, - defaultextension: str | None = ..., + defaultextension: str | None = "", filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., @@ -101,7 +101,7 @@ def askopenfilename( ) -> str: ... # can be empty string def askopenfilenames( *, - defaultextension: str | None = ..., + defaultextension: str | None = "", filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., @@ -110,15 +110,15 @@ def askopenfilenames( typevariable: StringVar | str | None = ..., ) -> Literal[""] | tuple[str, ...]: ... def askdirectory( - *, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = ..., parent: Misc | None = ..., title: str | None = ... + *, initialdir: StrOrBytesPath | None = ..., mustexist: bool | None = False, parent: Misc | None = ..., title: str | None = ... ) -> str: ... # can be empty string # TODO: If someone actually uses these, overload to have the actual return type of open(..., mode) def asksaveasfile( mode: str = "w", *, - confirmoverwrite: bool | None = ..., - defaultextension: str | None = ..., + confirmoverwrite: bool | None = True, + defaultextension: str | None = "", filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., @@ -129,7 +129,7 @@ def asksaveasfile( def askopenfile( mode: str = "r", *, - defaultextension: str | None = ..., + defaultextension: str | None = "", filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., @@ -140,7 +140,7 @@ def askopenfile( def askopenfiles( mode: str = "r", *, - defaultextension: str | None = ..., + defaultextension: str | None = "", filetypes: Iterable[tuple[str, str | list[str] | tuple[str, ...]]] | None = ..., initialdir: StrOrBytesPath | None = ..., initialfile: StrOrBytesPath | None = ..., diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi index 097c2e4b4382..3b73f982c4ca 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tkinter/font.pyi @@ -3,7 +3,7 @@ import itertools import sys import tkinter from typing import Any, ClassVar, Final, Literal, TypedDict, overload -from typing_extensions import TypeAlias +from typing_extensions import TypeAlias, Unpack if sys.version_info >= (3, 9): __all__ = ["NORMAL", "ROMAN", "BOLD", "ITALIC", "nametofont", "Font", "families", "names"] @@ -18,9 +18,9 @@ _FontDescription: TypeAlias = ( | Font # A font object constructed in Python | list[Any] # ["Helvetica", 12, BOLD] | tuple[str] # ("Liberation Sans",) needs wrapping in tuple/list to handle spaces - | tuple[str, int] # ("Liberation Sans", 12) - | tuple[str, int, str] # ("Liberation Sans", 12, "bold") - | tuple[str, int, list[str] | tuple[str, ...]] # e.g. bold and italic + # ("Liberation Sans", 12) or ("Liberation Sans", 12, "bold", "italic", "underline") + | tuple[str, int, Unpack[tuple[str, ...]]] # Any number of trailing options is permitted + | tuple[str, int, list[str] | tuple[str, ...]] # Options can also be passed as list/tuple | _tkinter.Tcl_Obj # A font object constructed in Tcl ) @@ -58,6 +58,7 @@ class Font: underline: bool = ..., overstrike: bool = ..., ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __setitem__(self, key: str, value: Any) -> None: ... @overload def cget(self, option: Literal["family"]) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/token.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/token.pyi index 668987d7c2bf..741ce5b035b7 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/token.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/token.pyi @@ -76,7 +76,7 @@ if sys.version_info >= (3, 10): __all__ += ["SOFT_KEYWORD"] if sys.version_info >= (3, 12): - __all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START"] + __all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START", "EXACT_TOKEN_TYPES"] ENDMARKER: int NAME: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi index 7e9a945cdc46..2655f2f0266a 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tokenize.pyi @@ -88,7 +88,7 @@ if sys.version_info >= (3, 10): __all__ += ["SOFT_KEYWORD"] if sys.version_info >= (3, 12): - __all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START"] + __all__ += ["EXCLAMATION", "FSTRING_END", "FSTRING_MIDDLE", "FSTRING_START", "EXACT_TOKEN_TYPES"] if sys.version_info >= (3, 13): __all__ += ["TokenError", "open"] @@ -130,9 +130,8 @@ class Untokenizer: if sys.version_info >= (3, 12): def escape_brackets(self, token: str) -> str: ... -# the docstring says "returns bytes" but is incorrect -- -# if the ENCODING token is missing, it skips the encode -def untokenize(iterable: Iterable[_Token]) -> Any: ... +# Returns str, unless the ENCODING token is present, in which case it returns bytes. +def untokenize(iterable: Iterable[_Token]) -> str | Any: ... def detect_encoding(readline: Callable[[], bytes | bytearray]) -> tuple[str, Sequence[bytes]]: ... def tokenize(readline: Callable[[], bytes | bytearray]) -> Generator[TokenInfo, None, None]: ... def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, None]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/traceback.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/traceback.pyi index 1c4a59de66aa..4f132d51c617 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/traceback.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/traceback.pyi @@ -2,7 +2,7 @@ import sys from _typeshed import SupportsWrite, Unused from collections.abc import Generator, Iterable, Iterator, Mapping from types import FrameType, TracebackType -from typing import Any, Literal, overload +from typing import Any, ClassVar, Literal, overload from typing_extensions import Self, TypeAlias, deprecated __all__ = [ @@ -113,15 +113,26 @@ if sys.version_info >= (3, 11): def emit(self, text_gen: str | Iterable[str], margin_char: str | None = None) -> Generator[str, None, None]: ... class TracebackException: - __cause__: TracebackException - __context__: TracebackException + __cause__: TracebackException | None + __context__: TracebackException | None + if sys.version_info >= (3, 11): + exceptions: list[TracebackException] | None __suppress_context__: bool + if sys.version_info >= (3, 11): + __notes__: list[str] | None stack: StackSummary + + # These fields only exist for `SyntaxError`s, but there is no way to express that in the type system. filename: str - lineno: int + lineno: str | None + if sys.version_info >= (3, 10): + end_lineno: str | None text: str offset: int + if sys.version_info >= (3, 10): + end_offset: int | None msg: str + if sys.version_info >= (3, 13): @property def exc_type_str(self) -> str: ... @@ -218,6 +229,7 @@ class TracebackException: ) -> Self: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] if sys.version_info >= (3, 11): def format(self, *, chain: bool = True, _ctx: _ExceptionPrintContext | None = None) -> Generator[str, None, None]: ... else: @@ -281,6 +293,7 @@ class FrameSummary: def __iter__(self) -> Iterator[Any]: ... def __eq__(self, other: object) -> bool: ... def __len__(self) -> Literal[4]: ... + __hash__: ClassVar[None] # type: ignore[assignment] class StackSummary(list[FrameSummary]): @classmethod diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/types.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/types.pyi index b513bd77468a..d41ca0d1c367 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/types.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/types.pyi @@ -89,14 +89,26 @@ class FunctionType: __type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] __module__: str - def __new__( - cls, - code: CodeType, - globals: dict[str, Any], - name: str | None = ..., - argdefs: tuple[object, ...] | None = ..., - closure: tuple[CellType, ...] | None = ..., - ) -> Self: ... + if sys.version_info >= (3, 13): + def __new__( + cls, + code: CodeType, + globals: dict[str, Any], + name: str | None = None, + argdefs: tuple[object, ...] | None = None, + closure: tuple[CellType, ...] | None = None, + kwdefaults: dict[str, object] | None = None, + ) -> Self: ... + else: + def __new__( + cls, + code: CodeType, + globals: dict[str, Any], + name: str | None = None, + argdefs: tuple[object, ...] | None = None, + closure: tuple[CellType, ...] | None = None, + ) -> Self: ... + def __call__(self, *args: Any, **kwargs: Any) -> Any: ... @overload def __get__(self, instance: None, owner: type, /) -> FunctionType: ... @@ -362,6 +374,12 @@ _ReturnT_co = TypeVar("_ReturnT_co", covariant=True) @final class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]): + @property + def gi_code(self) -> CodeType: ... + @property + def gi_frame(self) -> FrameType: ... + @property + def gi_running(self) -> bool: ... @property def gi_yieldfrom(self) -> GeneratorType[_YieldT_co, _SendT_contra, Any] | None: ... if sys.version_info >= (3, 11): @@ -385,6 +403,12 @@ class GeneratorType(Generator[_YieldT_co, _SendT_contra, _ReturnT_co]): class AsyncGeneratorType(AsyncGenerator[_YieldT_co, _SendT_contra]): @property def ag_await(self) -> Awaitable[Any] | None: ... + @property + def ag_code(self) -> CodeType: ... + @property + def ag_frame(self) -> FrameType: ... + @property + def ag_running(self) -> bool: ... __name__: str __qualname__: str if sys.version_info >= (3, 12): @@ -409,6 +433,14 @@ class CoroutineType(Coroutine[_YieldT_co, _SendT_contra, _ReturnT_co]): __name__: str __qualname__: str @property + def cr_await(self) -> Any | None: ... + @property + def cr_code(self) -> CodeType: ... + @property + def cr_frame(self) -> FrameType: ... + @property + def cr_running(self) -> bool: ... + @property def cr_origin(self) -> tuple[tuple[str, int, str], ...] | None: ... if sys.version_info >= (3, 11): @property @@ -442,7 +474,7 @@ class MethodType: def __name__(self) -> str: ... # inherited from the added function @property def __qualname__(self) -> str: ... # inherited from the added function - def __new__(cls, func: Callable[..., Any], obj: object, /) -> Self: ... + def __new__(cls, func: Callable[..., Any], instance: object, /) -> Self: ... def __call__(self, *args: Any, **kwargs: Any) -> Any: ... def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... @@ -604,10 +636,11 @@ if sys.version_info >= (3, 9): def __args__(self) -> tuple[Any, ...]: ... @property def __parameters__(self) -> tuple[Any, ...]: ... - def __new__(cls, origin: type, args: Any) -> Self: ... + def __new__(cls, origin: type, args: Any, /) -> Self: ... def __getitem__(self, typeargs: Any, /) -> GenericAlias: ... def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... + def __mro_entries__(self, bases: Iterable[object], /) -> tuple[type, ...]: ... if sys.version_info >= (3, 11): @property def __unpacked__(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi index 8f0d4fbb6a02..7c1b171a730b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi @@ -12,7 +12,6 @@ from re import Match as Match, Pattern as Pattern from types import ( BuiltinFunctionType, CodeType, - FrameType, FunctionType, MethodDescriptorType, MethodType, @@ -155,8 +154,8 @@ class TypeVar: @property def __default__(self) -> Any: ... if sys.version_info >= (3, 13): - def __init__( - self, + def __new__( + cls, name: str, *constraints: Any, bound: Any | None = None, @@ -164,17 +163,21 @@ class TypeVar: covariant: bool = False, infer_variance: bool = False, default: Any = ..., - ) -> None: ... + ) -> Self: ... elif sys.version_info >= (3, 12): - def __init__( - self, + def __new__( + cls, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False, infer_variance: bool = False, - ) -> None: ... + ) -> Self: ... + elif sys.version_info >= (3, 11): + def __new__( + cls, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False + ) -> Self: ... else: def __init__( self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False @@ -232,7 +235,9 @@ if sys.version_info >= (3, 11): def __default__(self) -> Any: ... def has_default(self) -> bool: ... if sys.version_info >= (3, 13): - def __init__(self, name: str, *, default: Any = ...) -> None: ... + def __new__(cls, name: str, *, default: Any = ...) -> Self: ... + elif sys.version_info >= (3, 12): + def __new__(cls, name: str) -> Self: ... else: def __init__(self, name: str) -> None: ... @@ -245,15 +250,25 @@ if sys.version_info >= (3, 10): class ParamSpecArgs: @property def __origin__(self) -> ParamSpec: ... - def __init__(self, origin: ParamSpec) -> None: ... + if sys.version_info >= (3, 12): + def __new__(cls, origin: ParamSpec) -> Self: ... + else: + def __init__(self, origin: ParamSpec) -> None: ... + def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] @final class ParamSpecKwargs: @property def __origin__(self) -> ParamSpec: ... - def __init__(self, origin: ParamSpec) -> None: ... + if sys.version_info >= (3, 12): + def __new__(cls, origin: ParamSpec) -> Self: ... + else: + def __init__(self, origin: ParamSpec) -> None: ... + def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] @final class ParamSpec: @@ -272,8 +287,8 @@ if sys.version_info >= (3, 10): @property def __default__(self) -> Any: ... if sys.version_info >= (3, 13): - def __init__( - self, + def __new__( + cls, name: str, *, bound: Any | None = None, @@ -281,17 +296,21 @@ if sys.version_info >= (3, 10): covariant: bool = False, infer_variance: bool = False, default: Any = ..., - ) -> None: ... + ) -> Self: ... elif sys.version_info >= (3, 12): - def __init__( - self, + def __new__( + cls, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False, infer_variance: bool = False, - ) -> None: ... + ) -> Self: ... + elif sys.version_info >= (3, 11): + def __new__( + cls, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False + ) -> Self: ... else: def __init__( self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False @@ -333,6 +352,8 @@ _F = TypeVar("_F", bound=Callable[..., Any]) _P = _ParamSpec("_P") _T = TypeVar("_T") +_FT = TypeVar("_FT", bound=Callable[..., Any] | type) + # These type variables are used by the container types. _S = TypeVar("_S") _KT = TypeVar("_KT") # Key type. @@ -347,7 +368,7 @@ def no_type_check(arg: _F) -> _F: ... def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... # This itself is only available during type checking -def type_check_only(func_or_cls: _F) -> _F: ... +def type_check_only(func_or_cls: _FT) -> _FT: ... # Type aliases and type constructors @@ -451,7 +472,8 @@ _YieldT_co = TypeVar("_YieldT_co", covariant=True) _SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=None) _ReturnT_co = TypeVar("_ReturnT_co", covariant=True, default=None) -class Generator(Iterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra, _ReturnT_co]): +@runtime_checkable +class Generator(Iterator[_YieldT_co], Protocol[_YieldT_co, _SendT_contra, _ReturnT_co]): def __next__(self) -> _YieldT_co: ... @abstractmethod def send(self, value: _SendT_contra, /) -> _YieldT_co: ... @@ -469,14 +491,6 @@ class Generator(Iterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra, _Return def close(self) -> None: ... def __iter__(self) -> Generator[_YieldT_co, _SendT_contra, _ReturnT_co]: ... - @property - def gi_code(self) -> CodeType: ... - @property - def gi_frame(self) -> FrameType: ... - @property - def gi_running(self) -> bool: ... - @property - def gi_yieldfrom(self) -> Generator[Any, Any, Any] | None: ... # NOTE: Prior to Python 3.13 these aliases are lacking the second _ExitT_co parameter if sys.version_info >= (3, 13): @@ -502,14 +516,7 @@ _ReturnT_co_nd = TypeVar("_ReturnT_co_nd", covariant=True) class Coroutine(Awaitable[_ReturnT_co_nd], Generic[_YieldT_co, _SendT_contra_nd, _ReturnT_co_nd]): __name__: str __qualname__: str - @property - def cr_await(self) -> Any | None: ... - @property - def cr_code(self) -> CodeType: ... - @property - def cr_frame(self) -> FrameType | None: ... - @property - def cr_running(self) -> bool: ... + @abstractmethod def send(self, value: _SendT_contra_nd, /) -> _YieldT_co: ... @overload @@ -544,7 +551,8 @@ class AsyncIterator(AsyncIterable[_T_co], Protocol[_T_co]): def __anext__(self) -> Awaitable[_T_co]: ... def __aiter__(self) -> AsyncIterator[_T_co]: ... -class AsyncGenerator(AsyncIterator[_YieldT_co], Generic[_YieldT_co, _SendT_contra]): +@runtime_checkable +class AsyncGenerator(AsyncIterator[_YieldT_co], Protocol[_YieldT_co, _SendT_contra]): def __anext__(self) -> Coroutine[Any, Any, _YieldT_co]: ... @abstractmethod def asend(self, value: _SendT_contra, /) -> Coroutine[Any, Any, _YieldT_co]: ... @@ -559,14 +567,6 @@ class AsyncGenerator(AsyncIterator[_YieldT_co], Generic[_YieldT_co, _SendT_contr self, typ: BaseException, val: None = None, tb: TracebackType | None = None, / ) -> Coroutine[Any, Any, _YieldT_co]: ... def aclose(self) -> Coroutine[Any, Any, None]: ... - @property - def ag_await(self) -> Any: ... - @property - def ag_code(self) -> CodeType: ... - @property - def ag_frame(self) -> FrameType: ... - @property - def ag_running(self) -> bool: ... @runtime_checkable class Container(Protocol[_T_co]): @@ -757,7 +757,7 @@ class MutableMapping(Mapping[_KT, _VT]): Text = str -TYPE_CHECKING: bool +TYPE_CHECKING: Final[bool] # In stubs, the arguments of the IO class are marked as positional-only. # This differs from runtime, but better reflects the fact that in reality @@ -1039,9 +1039,7 @@ if sys.version_info >= (3, 12): def override(method: _F, /) -> _F: ... @final class TypeAliasType: - def __init__( - self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = () - ) -> None: ... + def __new__(cls, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()) -> Self: ... @property def __value__(self) -> Any: ... @property diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi index eec84bdce4c7..8850c5c295ba 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/typing_extensions.pyi @@ -1,3 +1,5 @@ +# Since this module defines "Self" it is not recognized by Ruff as typing_extensions.Self +# ruff: noqa: PYI034 import abc import sys import typing @@ -48,12 +50,6 @@ from typing import ( # noqa: Y022,Y037,Y038,Y039 Sequence as Sequence, Set as Set, Sized as Sized, - SupportsAbs as SupportsAbs, - SupportsBytes as SupportsBytes, - SupportsComplex as SupportsComplex, - SupportsFloat as SupportsFloat, - SupportsInt as SupportsInt, - SupportsRound as SupportsRound, Text as Text, TextIO as TextIO, Tuple as Tuple, @@ -190,6 +186,7 @@ __all__ = [ _T = typing.TypeVar("_T") _F = typing.TypeVar("_F", bound=Callable[..., Any]) _TC = typing.TypeVar("_TC", bound=type[object]) +_T_co = typing.TypeVar("_T_co", covariant=True) # Any type covariant containers. class _Final: ... # This should be imported from typing but that breaks pytype @@ -282,11 +279,6 @@ def get_origin(tp: Any) -> Any | None: ... Annotated: _SpecialForm _AnnotatedAlias: Any # undocumented -@runtime_checkable -class SupportsIndex(Protocol, metaclass=abc.ABCMeta): - @abc.abstractmethod - def __index__(self) -> int: ... - # New and changed things in 3.10 if sys.version_info >= (3, 10): from typing import ( @@ -383,7 +375,17 @@ else: if sys.version_info >= (3, 12): from collections.abc import Buffer as Buffer from types import get_original_bases as get_original_bases - from typing import TypeAliasType as TypeAliasType, override as override + from typing import ( + SupportsAbs as SupportsAbs, + SupportsBytes as SupportsBytes, + SupportsComplex as SupportsComplex, + SupportsFloat as SupportsFloat, + SupportsIndex as SupportsIndex, + SupportsInt as SupportsInt, + SupportsRound as SupportsRound, + TypeAliasType as TypeAliasType, + override as override, + ) else: def override(arg: _F, /) -> _F: ... def get_original_bases(cls: type, /) -> tuple[Any, ...]: ... @@ -418,6 +420,45 @@ else: # https://github.com/python/typeshed/issues/10224 for why we're defining it this way def __buffer__(self, flags: int, /) -> memoryview: ... + @runtime_checkable + class SupportsInt(Protocol, metaclass=abc.ABCMeta): + @abc.abstractmethod + def __int__(self) -> int: ... + + @runtime_checkable + class SupportsFloat(Protocol, metaclass=abc.ABCMeta): + @abc.abstractmethod + def __float__(self) -> float: ... + + @runtime_checkable + class SupportsComplex(Protocol, metaclass=abc.ABCMeta): + @abc.abstractmethod + def __complex__(self) -> complex: ... + + @runtime_checkable + class SupportsBytes(Protocol, metaclass=abc.ABCMeta): + @abc.abstractmethod + def __bytes__(self) -> bytes: ... + + @runtime_checkable + class SupportsIndex(Protocol, metaclass=abc.ABCMeta): + @abc.abstractmethod + def __index__(self) -> int: ... + + @runtime_checkable + class SupportsAbs(Protocol[_T_co]): + @abc.abstractmethod + def __abs__(self) -> _T_co: ... + + @runtime_checkable + class SupportsRound(Protocol[_T_co]): + @overload + @abc.abstractmethod + def __round__(self) -> int: ... + @overload + @abc.abstractmethod + def __round__(self, ndigits: int, /) -> _T_co: ... + if sys.version_info >= (3, 13): from types import CapsuleType as CapsuleType from typing import ( diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/unittest/mock.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/unittest/mock.pyi index 193a4123c395..4b32f15095d6 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/unittest/mock.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/unittest/mock.pyi @@ -2,7 +2,7 @@ import sys from collections.abc import Awaitable, Callable, Coroutine, Iterable, Mapping, Sequence from contextlib import _GeneratorContextManager from types import TracebackType -from typing import Any, Final, Generic, Literal, TypeVar, overload +from typing import Any, ClassVar, Final, Generic, Literal, TypeVar, overload from typing_extensions import ParamSpec, Self, TypeAlias _T = TypeVar("_T") @@ -85,6 +85,7 @@ class _Call(tuple[Any, ...]): two: bool = False, from_kall: bool = True, ) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __eq__(self, other: object) -> bool: ... def __ne__(self, value: object, /) -> bool: ... def __call__(self, *args: Any, **kwargs: Any) -> _Call: ... @@ -403,6 +404,7 @@ class MagicProxy(Base): class _ANY: def __eq__(self, other: object) -> Literal[True]: ... def __ne__(self, other: object) -> Literal[False]: ... + __hash__: ClassVar[None] # type: ignore[assignment] ANY: Any diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/unittest/runner.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/unittest/runner.pyi index 393d03dfa0fc..783764464a53 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/unittest/runner.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/unittest/runner.pyi @@ -6,21 +6,22 @@ from _typeshed import SupportsFlush, SupportsWrite from collections.abc import Callable, Iterable from typing import Any, Generic, Protocol, TypeVar from typing_extensions import Never, TypeAlias +from warnings import _ActionKind -_ResultClassType: TypeAlias = Callable[[_TextTestStream, bool, int], TextTestResult] +_ResultClassType: TypeAlias = Callable[[_TextTestStream, bool, int], TextTestResult[Any]] class _SupportsWriteAndFlush(SupportsWrite[str], SupportsFlush, Protocol): ... # All methods used by unittest.runner.TextTestResult's stream class _TextTestStream(_SupportsWriteAndFlush, Protocol): - def writeln(self, arg: str | None = None, /) -> str: ... + def writeln(self, arg: str | None = None, /) -> None: ... # _WritelnDecorator should have all the same attrs as its stream param. # But that's not feasible to do Generically # We can expand the attributes if requested class _WritelnDecorator: - def __init__(self, stream: _TextTestStream) -> None: ... - def writeln(self, arg: str | None = None) -> str: ... + def __init__(self, stream: _SupportsWriteAndFlush) -> None: ... + def writeln(self, arg: str | None = None) -> None: ... def __getattr__(self, attr: str) -> Any: ... # Any attribute from the stream type passed to __init__ # These attributes are prevented by __getattr__ stream: Never @@ -39,10 +40,8 @@ class TextTestResult(unittest.result.TestResult, Generic[_StreamT]): showAll: bool # undocumented stream: _StreamT # undocumented if sys.version_info >= (3, 12): - durations: unittest.result._DurationsType | None - def __init__( - self, stream: _StreamT, descriptions: bool, verbosity: int, *, durations: unittest.result._DurationsType | None = None - ) -> None: ... + durations: int | None + def __init__(self, stream: _StreamT, descriptions: bool, verbosity: int, *, durations: int | None = None) -> None: ... else: def __init__(self, stream: _StreamT, descriptions: bool, verbosity: int) -> None: ... @@ -56,11 +55,11 @@ class TextTestRunner: verbosity: int failfast: bool buffer: bool - warnings: str | None + warnings: _ActionKind | None tb_locals: bool if sys.version_info >= (3, 12): - durations: unittest.result._DurationsType | None + durations: int | None def __init__( self, stream: _SupportsWriteAndFlush | None = None, @@ -69,10 +68,10 @@ class TextTestRunner: failfast: bool = False, buffer: bool = False, resultclass: _ResultClassType | None = None, - warnings: str | None = None, + warnings: _ActionKind | None = None, *, tb_locals: bool = False, - durations: unittest.result._DurationsType | None = None, + durations: int | None = None, ) -> None: ... else: def __init__( diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/unittest/suite.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/unittest/suite.pyi index ff583d0766a0..443396164b6f 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/unittest/suite.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/unittest/suite.pyi @@ -1,6 +1,7 @@ import unittest.case import unittest.result from collections.abc import Iterable, Iterator +from typing import ClassVar from typing_extensions import TypeAlias _TestType: TypeAlias = unittest.case.TestCase | TestSuite @@ -17,6 +18,7 @@ class BaseTestSuite: def countTestCases(self) -> int: ... def __iter__(self) -> Iterator[_TestType]: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] class TestSuite(BaseTestSuite): def run(self, result: unittest.result.TestResult, debug: bool = False) -> unittest.result.TestResult: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi index 853caf3e8abb..05a7b2bcda66 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi @@ -3,7 +3,7 @@ from _typeshed import SupportsKeysAndGetItem from _weakref import getweakrefcount as getweakrefcount, getweakrefs as getweakrefs, proxy as proxy from _weakrefset import WeakSet as WeakSet from collections.abc import Callable, Iterable, Iterator, Mapping, MutableMapping -from typing import Any, Generic, TypeVar, final, overload +from typing import Any, ClassVar, Generic, TypeVar, final, overload from typing_extensions import ParamSpec, Self if sys.version_info >= (3, 9): @@ -47,11 +47,13 @@ class CallableProxyType(Generic[_CallableT]): # "weakcallableproxy" def __eq__(self, value: object, /) -> bool: ... def __getattr__(self, attr: str) -> Any: ... __call__: _CallableT + __hash__: ClassVar[None] # type: ignore[assignment] @final class ProxyType(Generic[_T]): # "weakproxy" def __eq__(self, value: object, /) -> bool: ... def __getattr__(self, attr: str) -> Any: ... + __hash__: ClassVar[None] # type: ignore[assignment] class ReferenceType(Generic[_T]): # "weakref" __callback__: Callable[[Self], Any] @@ -115,6 +117,12 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def pop(self, key: _KT, default: _VT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _VT | _T: ... + @overload + def update(self, other: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ... + @overload + def update(self, other: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ... + @overload + def update(self, other: None = None, /, **kwargs: _VT) -> None: ... if sys.version_info >= (3, 9): def __or__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ... def __ror__(self, other: Mapping[_T1, _T2]) -> WeakValueDictionary[_KT | _T1, _VT | _T2]: ... @@ -163,6 +171,12 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def pop(self, key: _KT, default: _VT) -> _VT: ... @overload def pop(self, key: _KT, default: _T) -> _VT | _T: ... + @overload + def update(self, dict: SupportsKeysAndGetItem[_KT, _VT], /, **kwargs: _VT) -> None: ... + @overload + def update(self, dict: Iterable[tuple[_KT, _VT]], /, **kwargs: _VT) -> None: ... + @overload + def update(self, dict: None = None, /, **kwargs: _VT) -> None: ... if sys.version_info >= (3, 9): def __or__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ... def __ror__(self, other: Mapping[_T1, _T2]) -> WeakKeyDictionary[_KT | _T1, _VT | _T2]: ... @@ -172,11 +186,11 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): @overload def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ... -class finalize: # TODO: This is a good candidate for to be a `Generic[_P, _T]` class - def __init__(self, obj: object, func: Callable[_P, Any], /, *args: _P.args, **kwargs: _P.kwargs) -> None: ... +class finalize(Generic[_P, _T]): + def __init__(self, obj: _T, func: Callable[_P, Any], /, *args: _P.args, **kwargs: _P.kwargs) -> None: ... def __call__(self, _: Any = None) -> Any | None: ... - def detach(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... - def peek(self) -> tuple[Any, Any, tuple[Any, ...], dict[str, Any]] | None: ... + def detach(self) -> tuple[_T, Callable[_P, Any], tuple[Any, ...], dict[str, Any]] | None: ... + def peek(self) -> tuple[_T, Callable[_P, Any], tuple[Any, ...], dict[str, Any]] | None: ... @property def alive(self) -> bool: ... atexit: bool diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/xml/dom/minidom.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/xml/dom/minidom.pyi index fae2c4d98714..d7da59a7ed4b 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/xml/dom/minidom.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/xml/dom/minidom.pyi @@ -1,7 +1,7 @@ import sys import xml.dom from _typeshed import Incomplete, ReadableBuffer, SupportsRead, SupportsWrite -from typing import Literal, NoReturn, TypeVar, overload +from typing import ClassVar, Literal, NoReturn, TypeVar, overload from typing_extensions import Self from xml.dom.minicompat import NodeList from xml.dom.xmlbuilder import DocumentLS, DOMImplementationLS @@ -151,6 +151,7 @@ class NamedNodeMap: def keysNS(self): ... def values(self): ... def get(self, name: str, value: Incomplete | None = None): ... + __hash__: ClassVar[None] # type: ignore[assignment] def __len__(self) -> int: ... def __eq__(self, other: object) -> bool: ... def __ge__(self, other: NamedNodeMap) -> bool: ... @@ -290,8 +291,8 @@ class ReadOnlySequentialNamedNodeMap: def length(self) -> int: ... class Identified: - publicId: Incomplete - systemId: Incomplete + publicId: str | None + systemId: str | None class DocumentType(Identified, Childless, Node): nodeType: int @@ -330,7 +331,7 @@ class Notation(Identified, Childless, Node): class DOMImplementation(DOMImplementationLS): def hasFeature(self, feature: str, version: str | None) -> bool: ... def createDocument(self, namespaceURI: str | None, qualifiedName: str | None, doctype: DocumentType | None) -> Document: ... - def createDocumentType(self, qualifiedName: str | None, publicId: str, systemId: str) -> DocumentType: ... + def createDocumentType(self, qualifiedName: str | None, publicId: str | None, systemId: str | None) -> DocumentType: ... def getInterface(self, feature: str) -> Self | None: ... class ElementInfo: diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/xml/sax/expatreader.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/xml/sax/expatreader.pyi new file mode 100644 index 000000000000..0f7bda5872c0 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/xml/sax/expatreader.pyi @@ -0,0 +1,53 @@ +import sys +from _typeshed import Unused +from xml.sax import xmlreader + +version: str +AttributesImpl = xmlreader.AttributesImpl +AttributesNSImpl = xmlreader.AttributesNSImpl + +class _ClosedParser: ... + +class ExpatLocator(xmlreader.Locator): + def __init__(self, parser: ExpatParser) -> None: ... + def getColumnNumber(self) -> int: ... + def getLineNumber(self) -> int: ... + def getPublicId(self): ... + def getSystemId(self): ... + +class ExpatParser(xmlreader.IncrementalParser, xmlreader.Locator): + def __init__(self, namespaceHandling: int = 0, bufsize: int = 65516) -> None: ... + def parse(self, source) -> None: ... + def prepareParser(self, source) -> None: ... + def setContentHandler(self, handler) -> None: ... + def getFeature(self, name: str): ... + def setFeature(self, name: str, state) -> None: ... + def getProperty(self, name: str): ... + def setProperty(self, name: str, value) -> None: ... + if sys.version_info >= (3, 9): + def feed(self, data, isFinal: bool = False) -> None: ... + else: + def feed(self, data, isFinal: int = 0) -> None: ... + + def flush(self) -> None: ... + def close(self) -> None: ... + def reset(self) -> None: ... + def getColumnNumber(self) -> int | None: ... + def getLineNumber(self) -> int: ... + def getPublicId(self): ... + def getSystemId(self): ... + def start_element(self, name: str, attrs: xmlreader.AttributesImpl) -> None: ... + def end_element(self, name: str) -> None: ... + def start_element_ns(self, name: str, attrs) -> None: ... + def end_element_ns(self, name: str) -> None: ... + def processing_instruction(self, target: str, data: str) -> None: ... + def character_data(self, data: str) -> None: ... + def start_namespace_decl(self, prefix: str | None, uri: str) -> None: ... + def end_namespace_decl(self, prefix: str | None) -> None: ... + def start_doctype_decl(self, name: str, sysid: str | None, pubid: str | None, has_internal_subset: Unused) -> None: ... + def unparsed_entity_decl(self, name, base, sysid, pubid, notation_name) -> None: ... + def notation_decl(self, name, base, sysid, pubid) -> None: ... + def external_entity_ref(self, context, base, sysid, pubid): ... + def skipped_entity_handler(self, name: str, is_pe: bool) -> None: ... + +def create_parser(namespaceHandling: int = 0, bufsize: int = 65516) -> ExpatParser: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/xmlrpc/client.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/xmlrpc/client.pyi index 5899d1d72a38..6cc4361f4a09 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/xmlrpc/client.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/xmlrpc/client.pyi @@ -6,7 +6,7 @@ from collections.abc import Callable, Iterable, Mapping from datetime import datetime from io import BytesIO from types import TracebackType -from typing import Any, Final, Literal, Protocol, overload +from typing import Any, ClassVar, Final, Literal, Protocol, overload from typing_extensions import Self, TypeAlias class _SupportsTimeTuple(Protocol): @@ -76,6 +76,7 @@ def _strftime(value: _XMLDate) -> str: ... # undocumented class DateTime: value: str # undocumented def __init__(self, value: int | str | datetime | time.struct_time | tuple[int, ...] = 0) -> None: ... + __hash__: ClassVar[None] # type: ignore[assignment] def __lt__(self, other: _DateTimeComparable) -> bool: ... def __le__(self, other: _DateTimeComparable) -> bool: ... def __gt__(self, other: _DateTimeComparable) -> bool: ... @@ -95,6 +96,7 @@ class Binary: def decode(self, data: ReadableBuffer) -> None: ... def encode(self, out: SupportsWrite[str]) -> None: ... def __eq__(self, other: object) -> bool: ... + __hash__: ClassVar[None] # type: ignore[assignment] def _binary(data: ReadableBuffer) -> Binary: ... # undocumented @@ -108,8 +110,7 @@ class ExpatParser: # undocumented _WriteCallback: TypeAlias = Callable[[str], object] class Marshaller: - # TODO: Replace 'Any' with some kind of binding - dispatch: dict[type[Any], Callable[[Marshaller, Any, _WriteCallback], None]] + dispatch: dict[type[_Marshallable] | Literal["_arbitrary_instance"], Callable[[Marshaller, Any, _WriteCallback], None]] memo: dict[Any, None] data: None encoding: str | None diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/xxlimited.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/xxlimited.pyi index 6bae87a8db2a..78a50b85f405 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/xxlimited.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/xxlimited.pyi @@ -1,5 +1,5 @@ import sys -from typing import Any, final +from typing import Any, ClassVar, final class Str(str): ... @@ -17,6 +17,8 @@ if sys.version_info >= (3, 10): else: class error(Exception): ... - class Null: ... + + class Null: + __hash__: ClassVar[None] # type: ignore[assignment] def roj(b: Any, /) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path/__init__.pyi similarity index 100% rename from packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path.pyi rename to packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path/__init__.pyi diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path/glob.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path/glob.pyi new file mode 100644 index 000000000000..f25ae71725c0 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/zipfile/_path/glob.pyi @@ -0,0 +1,22 @@ +import sys +from collections.abc import Iterator +from re import Match + +if sys.version_info >= (3, 13): + class Translator: + def __init__(self, seps: str = ...) -> None: ... + def translate(self, pattern: str) -> str: ... + def extend(self, pattern: str) -> str: ... + def match_dirs(self, pattern: str) -> str: ... + def translate_core(self, pattern: str) -> str: ... + def replace(self, match: Match[str]) -> str: ... + def restrict_rglob(self, pattern: str) -> None: ... + def star_not_empty(self, pattern: str) -> str: ... + +else: + def translate(pattern: str) -> str: ... + def match_dirs(pattern: str) -> str: ... + def translate_core(pattern: str) -> str: ... + def replace(match: Match[str]) -> str: ... + +def separate(pattern: str) -> Iterator[Match[str]]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/zoneinfo/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/zoneinfo/__init__.pyi index cc483afad9ff..fb21b00c45dc 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/zoneinfo/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/zoneinfo/__init__.pyi @@ -21,7 +21,7 @@ if sys.version_info >= (3, 9): class ZoneInfo(tzinfo): @property def key(self) -> str: ... - def __init__(self, key: str) -> None: ... + def __new__(cls, key: str) -> Self: ... @classmethod def no_cache(cls, key: str) -> Self: ... @classmethod diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/METADATA.toml new file mode 100644 index 000000000000..d45cede42927 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/METADATA.toml @@ -0,0 +1,7 @@ +version = "1.4.*" +upstream_repository = "https://github.com/lepture/authlib" +requires = ["cryptography"] +partial_stub = true + +[tool.stubtest] +ignore_missing_stub = true diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/__init__.pyi new file mode 100644 index 000000000000..d1c285f4e6d6 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/__init__.pyi @@ -0,0 +1,4 @@ +from .consts import homepage, version + +__version__ = version +__homepage__ = homepage diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/__init__.pyi similarity index 100% rename from packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/__init__.pyi rename to packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/__init__.pyi diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/encoding.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/encoding.pyi new file mode 100644 index 000000000000..e76f84f033e8 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/encoding.pyi @@ -0,0 +1,10 @@ +def to_bytes(x, charset: str = "utf-8", errors: str = "strict") -> bytes | None: ... +def to_unicode(x, charset: str = "utf-8", errors: str = "strict") -> str | None: ... +def to_native(x, encoding: str = "ascii"): ... +def json_loads(s): ... +def json_dumps(data, ensure_ascii: bool = False): ... +def urlsafe_b64decode(s): ... +def urlsafe_b64encode(s): ... +def base64_to_int(s): ... +def int_to_base64(num): ... +def json_b64encode(text): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/errors.pyi new file mode 100644 index 000000000000..89a45b2d9b4a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/errors.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete + +class AuthlibBaseError(Exception): + error: Incomplete + description: str + uri: Incomplete + def __init__( + self, error: Incomplete | None = None, description: Incomplete | None = None, uri: Incomplete | None = None + ) -> None: ... + +class AuthlibHTTPError(AuthlibBaseError): + status_code: int + def __init__( + self, + error: Incomplete | None = None, + description: Incomplete | None = None, + uri: Incomplete | None = None, + status_code: Incomplete | None = None, + ) -> None: ... + def get_error_description(self): ... + def get_body(self): ... + def get_headers(self): ... + uri: Incomplete + def __call__(self, uri: Incomplete | None = None): ... + +class ContinueIteration(AuthlibBaseError): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/security.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/security.pyi new file mode 100644 index 000000000000..d69563f0e0cb --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/security.pyi @@ -0,0 +1,4 @@ +UNICODE_ASCII_CHARACTER_SET: str + +def generate_token(length: int = 30, chars: str = ...) -> str: ... +def is_secure_transport(uri: str) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/urls.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/urls.pyi new file mode 100644 index 000000000000..1d9bffd42459 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/common/urls.pyi @@ -0,0 +1,19 @@ +from collections.abc import Collection +from re import Pattern +from typing_extensions import TypeAlias + +always_safe: str +urlencoded: Collection[str] +INVALID_HEX_PATTERN: Pattern[str] + +_ExplodedQueryString: TypeAlias = list[tuple[str, str]] + +def url_encode(params: _ExplodedQueryString) -> str: ... +def url_decode(query: str) -> _ExplodedQueryString: ... +def add_params_to_qs(query: str, params: _ExplodedQueryString) -> str: ... +def add_params_to_uri(uri: str, params: _ExplodedQueryString, fragment: bool = False): ... +def quote(s: str, safe: bytes = b"/") -> str: ... +def unquote(s: str) -> str: ... +def quote_url(s: str) -> str: ... +def extract_params(raw: dict[str, str] | _ExplodedQueryString) -> _ExplodedQueryString: ... +def is_valid_url(url: str) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/consts.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/consts.pyi new file mode 100644 index 000000000000..ab047d25406a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/consts.pyi @@ -0,0 +1,8 @@ +from _typeshed import Incomplete + +name: str +version: str +author: str +homepage: str +default_user_agent: Incomplete +default_json_headers: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/deprecate.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/deprecate.pyi new file mode 100644 index 000000000000..c4c5a11b59ce --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/deprecate.pyi @@ -0,0 +1,7 @@ +from _typeshed import Incomplete + +class AuthlibDeprecationWarning(DeprecationWarning): ... + +def deprecate( + message, version: Incomplete | None = None, link_uid: Incomplete | None = None, link_file: Incomplete | None = None +) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/__init__.pyi new file mode 100644 index 000000000000..424bfdf05f60 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/__init__.pyi @@ -0,0 +1,29 @@ +from .errors import ( + InvalidTokenError as InvalidTokenError, + MismatchingStateError as MismatchingStateError, + MissingRequestTokenError as MissingRequestTokenError, + MissingTokenError as MissingTokenError, + OAuthError as OAuthError, + TokenExpiredError as TokenExpiredError, + UnsupportedTokenTypeError as UnsupportedTokenTypeError, +) +from .framework_integration import FrameworkIntegration as FrameworkIntegration +from .registry import BaseOAuth as BaseOAuth +from .sync_app import BaseApp as BaseApp, OAuth1Mixin as OAuth1Mixin, OAuth2Mixin as OAuth2Mixin +from .sync_openid import OpenIDMixin as OpenIDMixin + +__all__ = [ + "BaseOAuth", + "BaseApp", + "OAuth1Mixin", + "OAuth2Mixin", + "OpenIDMixin", + "FrameworkIntegration", + "OAuthError", + "MissingRequestTokenError", + "MissingTokenError", + "TokenExpiredError", + "InvalidTokenError", + "UnsupportedTokenTypeError", + "MismatchingStateError", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/async_app.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/async_app.pyi new file mode 100644 index 000000000000..e32e154bc1be --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/async_app.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete + +from authlib.integrations.base_client.sync_app import OAuth1Base, OAuth2Base + +__all__ = ["AsyncOAuth1Mixin", "AsyncOAuth2Mixin"] + +class AsyncOAuth1Mixin(OAuth1Base): + async def request(self, method, url, token: Incomplete | None = None, **kwargs): ... + async def create_authorization_url(self, redirect_uri: Incomplete | None = None, **kwargs): ... + async def fetch_access_token(self, request_token: Incomplete | None = None, **kwargs): ... + +class AsyncOAuth2Mixin(OAuth2Base): + async def load_server_metadata(self): ... + async def request(self, method, url, token: Incomplete | None = None, **kwargs): ... + async def create_authorization_url(self, redirect_uri: Incomplete | None = None, **kwargs): ... + async def fetch_access_token(self, redirect_uri: Incomplete | None = None, **kwargs): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/async_openid.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/async_openid.pyi new file mode 100644 index 000000000000..1a18fe689f9d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/async_openid.pyi @@ -0,0 +1,8 @@ +from _typeshed import Incomplete + +__all__ = ["AsyncOpenIDMixin"] + +class AsyncOpenIDMixin: + async def fetch_jwk_set(self, force: bool = False): ... + async def userinfo(self, **kwargs): ... + async def parse_id_token(self, token, nonce, claims_options: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/errors.pyi new file mode 100644 index 000000000000..0b5cfd7db6d3 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/errors.pyi @@ -0,0 +1,23 @@ +from authlib.common.errors import AuthlibBaseError + +class OAuthError(AuthlibBaseError): + error: str + +class MissingRequestTokenError(OAuthError): + error: str + +class MissingTokenError(OAuthError): + error: str + +class TokenExpiredError(OAuthError): + error: str + +class InvalidTokenError(OAuthError): + error: str + +class UnsupportedTokenTypeError(OAuthError): + error: str + +class MismatchingStateError(OAuthError): + error: str + description: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/framework_integration.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/framework_integration.pyi new file mode 100644 index 000000000000..dbf68a324fda --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/framework_integration.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +class FrameworkIntegration: + expires_in: int + name: Incomplete + cache: Incomplete + def __init__(self, name, cache: Incomplete | None = None) -> None: ... + def get_state_data(self, session, state): ... + def set_state_data(self, session, state, data): ... + def clear_state_data(self, session, state): ... + def update_token(self, token, refresh_token: Incomplete | None = None, access_token: Incomplete | None = None) -> None: ... + @staticmethod + def load_config(oauth, name, params) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/registry.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/registry.pyi new file mode 100644 index 000000000000..b9cd8de7ce6e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/registry.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete + +from authlib.integrations.base_client import FrameworkIntegration + +__all__ = ["BaseOAuth"] + +class BaseOAuth: + oauth1_client_cls: Incomplete + oauth2_client_cls: Incomplete + framework_integration_cls: type[FrameworkIntegration] = ... + cache: Incomplete + fetch_token: Incomplete + update_token: Incomplete + def __init__( + self, cache: Incomplete | None = None, fetch_token: Incomplete | None = None, update_token: Incomplete | None = None + ) -> None: ... + def create_client(self, name): ... + def register(self, name, overwrite: bool = False, **kwargs): ... + def generate_client_kwargs(self, name, overwrite, **kwargs): ... + def load_config(self, name, params): ... + def __getattr__(self, key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/sync_app.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/sync_app.pyi new file mode 100644 index 000000000000..2497632afb47 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/sync_app.pyi @@ -0,0 +1,93 @@ +from _typeshed import Incomplete + +class BaseApp: + client_cls: Incomplete + OAUTH_APP_CONFIG: Incomplete + def request(self, method, url, token: Incomplete | None = None, **kwargs): ... + def get(self, url, **kwargs): ... + def post(self, url, **kwargs): ... + def patch(self, url, **kwargs): ... + def put(self, url, **kwargs): ... + def delete(self, url, **kwargs): ... + +class _RequestMixin: ... + +class OAuth1Base: + client_cls: Incomplete + framework: Incomplete + name: Incomplete + client_id: Incomplete + client_secret: Incomplete + request_token_url: Incomplete + request_token_params: Incomplete + access_token_url: Incomplete + access_token_params: Incomplete + authorize_url: Incomplete + authorize_params: Incomplete + api_base_url: Incomplete + client_kwargs: Incomplete + def __init__( + self, + framework, + name: Incomplete | None = None, + fetch_token: Incomplete | None = None, + client_id: Incomplete | None = None, + client_secret: Incomplete | None = None, + request_token_url: Incomplete | None = None, + request_token_params: Incomplete | None = None, + access_token_url: Incomplete | None = None, + access_token_params: Incomplete | None = None, + authorize_url: Incomplete | None = None, + authorize_params: Incomplete | None = None, + api_base_url: Incomplete | None = None, + client_kwargs: Incomplete | None = None, + user_agent: Incomplete | None = None, + **kwargs, + ) -> None: ... + +class OAuth1Mixin(_RequestMixin, OAuth1Base): + def request(self, method, url, token: Incomplete | None = None, **kwargs): ... + def create_authorization_url(self, redirect_uri: Incomplete | None = None, **kwargs): ... + def fetch_access_token(self, request_token: Incomplete | None = None, **kwargs): ... + +class OAuth2Base: + client_cls: Incomplete + framework: Incomplete + name: Incomplete + client_id: Incomplete + client_secret: Incomplete + access_token_url: Incomplete + access_token_params: Incomplete + authorize_url: Incomplete + authorize_params: Incomplete + api_base_url: Incomplete + client_kwargs: Incomplete + compliance_fix: Incomplete + client_auth_methods: Incomplete + server_metadata: Incomplete + def __init__( + self, + framework, + name: Incomplete | None = None, + fetch_token: Incomplete | None = None, + update_token: Incomplete | None = None, + client_id: Incomplete | None = None, + client_secret: Incomplete | None = None, + access_token_url: Incomplete | None = None, + access_token_params: Incomplete | None = None, + authorize_url: Incomplete | None = None, + authorize_params: Incomplete | None = None, + api_base_url: Incomplete | None = None, + client_kwargs: Incomplete | None = None, + server_metadata_url: Incomplete | None = None, + compliance_fix: Incomplete | None = None, + client_auth_methods: Incomplete | None = None, + user_agent: Incomplete | None = None, + **kwargs, + ) -> None: ... + +class OAuth2Mixin(_RequestMixin, OAuth2Base): + def request(self, method, url, token: Incomplete | None = None, **kwargs): ... + def load_server_metadata(self): ... + def create_authorization_url(self, redirect_uri: Incomplete | None = None, **kwargs): ... + def fetch_access_token(self, redirect_uri: Incomplete | None = None, **kwargs): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/sync_openid.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/sync_openid.pyi new file mode 100644 index 000000000000..8fa2426a112d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/integrations/base_client/sync_openid.pyi @@ -0,0 +1,7 @@ +from _typeshed import Incomplete + +class OpenIDMixin: + def fetch_jwk_set(self, force: bool = False): ... + def userinfo(self, **kwargs): ... + def parse_id_token(self, token, nonce, claims_options: Incomplete | None = None, leeway: int = 120): ... + def create_load_key(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/__init__.pyi new file mode 100644 index 000000000000..e1c930f3cb2d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/__init__.pyi @@ -0,0 +1,44 @@ +from _typeshed import Incomplete + +from .errors import JoseError as JoseError +from .rfc7515 import ( + JsonWebSignature as JsonWebSignature, + JWSAlgorithm as JWSAlgorithm, + JWSHeader as JWSHeader, + JWSObject as JWSObject, +) +from .rfc7516 import ( + JsonWebEncryption as JsonWebEncryption, + JWEAlgorithm as JWEAlgorithm, + JWEEncAlgorithm as JWEEncAlgorithm, + JWEZipAlgorithm as JWEZipAlgorithm, +) +from .rfc7517 import JsonWebKey as JsonWebKey, Key as Key, KeySet as KeySet +from .rfc7518 import ECKey as ECKey, OctKey as OctKey, RSAKey as RSAKey +from .rfc7519 import BaseClaims as BaseClaims, JsonWebToken as JsonWebToken, JWTClaims as JWTClaims +from .rfc8037 import OKPKey as OKPKey + +__all__ = [ + "JoseError", + "JsonWebSignature", + "JWSAlgorithm", + "JWSHeader", + "JWSObject", + "JsonWebEncryption", + "JWEAlgorithm", + "JWEEncAlgorithm", + "JWEZipAlgorithm", + "JsonWebKey", + "Key", + "KeySet", + "OctKey", + "RSAKey", + "ECKey", + "OKPKey", + "JsonWebToken", + "BaseClaims", + "JWTClaims", + "jwt", +] + +jwt: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/__init__.pyi new file mode 100644 index 000000000000..05af39634dfd --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/__init__.pyi @@ -0,0 +1,3 @@ +__all__ = ["register_jwe_draft"] + +def register_jwe_draft(cls) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_algorithms.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_algorithms.pyi new file mode 100644 index 000000000000..df0f388935d9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_algorithms.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7516 import JWEAlgorithmWithTagAwareKeyAgreement + +class ECDH1PUAlgorithm(JWEAlgorithmWithTagAwareKeyAgreement): + EXTRA_HEADERS: Incomplete + ALLOWED_KEY_CLS: Incomplete + name: str + description: str + key_size: Incomplete + aeskw: Incomplete + def __init__(self, key_size: Incomplete | None = None) -> None: ... + def prepare_key(self, raw_data): ... + def generate_preset(self, enc_alg, key): ... + def compute_shared_key(self, shared_key_e, shared_key_s): ... + def compute_fixed_info(self, headers, bit_size, tag): ... + def compute_derived_key(self, shared_key, fixed_info, bit_size): ... + def deliver_at_sender(self, sender_static_key, sender_ephemeral_key, recipient_pubkey, headers, bit_size, tag): ... + def deliver_at_recipient(self, recipient_key, sender_static_pubkey, sender_ephemeral_pubkey, headers, bit_size, tag): ... + def generate_keys_and_prepare_headers(self, enc_alg, key, sender_key, preset: Incomplete | None = None): ... + def agree_upon_key_and_wrap_cek(self, enc_alg, headers, key, sender_key, epk, cek, tag): ... + def wrap(self, enc_alg, headers, key, sender_key, preset: Incomplete | None = None): ... + def unwrap(self, enc_alg, ek, headers, key, sender_key, tag: Incomplete | None = None): ... + +JWE_DRAFT_ALG_ALGORITHMS: Incomplete + +def register_jwe_alg_draft(cls) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_enc_cryptodome.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_enc_cryptodome.pyi new file mode 100644 index 000000000000..69fea45b85c7 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_enc_cryptodome.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7516 import JWEEncAlgorithm + +class XC20PEncAlgorithm(JWEEncAlgorithm): + IV_SIZE: int + name: str + description: str + key_size: Incomplete + CEK_SIZE: Incomplete + def __init__(self, key_size) -> None: ... + def encrypt(self, msg, aad, iv, key): ... + def decrypt(self, ciphertext, aad, iv, tag, key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_enc_cryptography.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_enc_cryptography.pyi new file mode 100644 index 000000000000..0acb4ebb770e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/drafts/_jwe_enc_cryptography.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7516 import JWEEncAlgorithm + +class C20PEncAlgorithm(JWEEncAlgorithm): + IV_SIZE: int + name: str + description: str + key_size: Incomplete + CEK_SIZE: Incomplete + def __init__(self, key_size) -> None: ... + def encrypt(self, msg, aad, iv, key): ... + def decrypt(self, ciphertext, aad, iv, tag, key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/errors.pyi new file mode 100644 index 000000000000..4a44693b4a32 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/errors.pyi @@ -0,0 +1,72 @@ +from _typeshed import Incomplete + +from authlib.common.errors import AuthlibBaseError + +class JoseError(AuthlibBaseError): ... + +class DecodeError(JoseError): + error: str + +class MissingAlgorithmError(JoseError): + error: str + +class UnsupportedAlgorithmError(JoseError): + error: str + +class BadSignatureError(JoseError): + error: str + result: Incomplete + def __init__(self, result) -> None: ... + +class InvalidHeaderParameterNameError(JoseError): + error: str + def __init__(self, name) -> None: ... + +class InvalidEncryptionAlgorithmForECDH1PUWithKeyWrappingError(JoseError): + error: str + def __init__(self) -> None: ... + +class InvalidAlgorithmForMultipleRecipientsMode(JoseError): + error: str + def __init__(self, alg) -> None: ... + +class KeyMismatchError(JoseError): + error: str + description: str + +class MissingEncryptionAlgorithmError(JoseError): + error: str + description: str + +class UnsupportedEncryptionAlgorithmError(JoseError): + error: str + description: str + +class UnsupportedCompressionAlgorithmError(JoseError): + error: str + description: str + +class InvalidUseError(JoseError): + error: str + description: str + +class InvalidClaimError(JoseError): + error: str + claim_name: Incomplete + def __init__(self, claim) -> None: ... + +class MissingClaimError(JoseError): + error: str + def __init__(self, claim) -> None: ... + +class InsecureClaimError(JoseError): + error: str + def __init__(self, claim) -> None: ... + +class ExpiredTokenError(JoseError): + error: str + description: str + +class InvalidTokenError(JoseError): + error: str + description: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/jwk.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/jwk.pyi new file mode 100644 index 000000000000..0ca658ddc97a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/jwk.pyi @@ -0,0 +1,4 @@ +from _typeshed import Incomplete + +def loads(obj, kid: Incomplete | None = None): ... +def dumps(key, kty: Incomplete | None = None, **params): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/__init__.pyi new file mode 100644 index 000000000000..cac2e167f330 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/__init__.pyi @@ -0,0 +1,4 @@ +from .jws import JsonWebSignature as JsonWebSignature +from .models import JWSAlgorithm as JWSAlgorithm, JWSHeader as JWSHeader, JWSObject as JWSObject + +__all__ = ["JsonWebSignature", "JWSAlgorithm", "JWSHeader", "JWSObject"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/jws.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/jws.pyi new file mode 100644 index 000000000000..2fcd024394a0 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/jws.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete + +class JsonWebSignature: + REGISTERED_HEADER_PARAMETER_NAMES: Incomplete + ALGORITHMS_REGISTRY: Incomplete + def __init__(self, algorithms: Incomplete | None = None, private_headers: Incomplete | None = None) -> None: ... + @classmethod + def register_algorithm(cls, algorithm) -> None: ... + def serialize_compact(self, protected, payload, key): ... + def deserialize_compact(self, s, key, decode: Incomplete | None = None): ... + def serialize_json(self, header_obj, payload, key): ... + def deserialize_json(self, obj, key, decode: Incomplete | None = None): ... + def serialize(self, header, payload, key): ... + def deserialize(self, s, key, decode: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/models.pyi new file mode 100644 index 000000000000..7640c759dbc9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7515/models.pyi @@ -0,0 +1,25 @@ +from _typeshed import Incomplete + +class JWSAlgorithm: + name: Incomplete + description: Incomplete + algorithm_type: str + algorithm_location: str + def prepare_key(self, raw_data) -> None: ... + def sign(self, msg, key) -> None: ... + def verify(self, msg, sig, key) -> None: ... + +class JWSHeader(dict[str, object]): + protected: Incomplete + header: Incomplete + def __init__(self, protected, header) -> None: ... + @classmethod + def from_dict(cls, obj): ... + +class JWSObject(dict[str, object]): + header: Incomplete + payload: Incomplete + type: Incomplete + def __init__(self, header, payload, type: str = "compact") -> None: ... + @property + def headers(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/__init__.pyi new file mode 100644 index 000000000000..84393afbd11b --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/__init__.pyi @@ -0,0 +1,9 @@ +from .jwe import JsonWebEncryption as JsonWebEncryption +from .models import ( + JWEAlgorithm as JWEAlgorithm, + JWEAlgorithmWithTagAwareKeyAgreement as JWEAlgorithmWithTagAwareKeyAgreement, + JWEEncAlgorithm as JWEEncAlgorithm, + JWEZipAlgorithm as JWEZipAlgorithm, +) + +__all__ = ["JsonWebEncryption", "JWEAlgorithm", "JWEAlgorithmWithTagAwareKeyAgreement", "JWEEncAlgorithm", "JWEZipAlgorithm"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/jwe.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/jwe.pyi new file mode 100644 index 000000000000..87de596064f1 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/jwe.pyi @@ -0,0 +1,23 @@ +from _typeshed import Incomplete + +class JsonWebEncryption: + REGISTERED_HEADER_PARAMETER_NAMES: Incomplete + ALG_REGISTRY: Incomplete + ENC_REGISTRY: Incomplete + ZIP_REGISTRY: Incomplete + def __init__(self, algorithms: Incomplete | None = None, private_headers: Incomplete | None = None) -> None: ... + @classmethod + def register_algorithm(cls, algorithm) -> None: ... + def serialize_compact(self, protected, payload, key, sender_key: Incomplete | None = None): ... + def serialize_json(self, header_obj, payload, keys, sender_key: Incomplete | None = None): ... + def serialize(self, header, payload, key, sender_key: Incomplete | None = None): ... + def deserialize_compact(self, s, key, decode: Incomplete | None = None, sender_key: Incomplete | None = None): ... + def deserialize_json(self, obj, key, decode: Incomplete | None = None, sender_key: Incomplete | None = None): ... + def deserialize(self, obj, key, decode: Incomplete | None = None, sender_key: Incomplete | None = None): ... + @staticmethod + def parse_json(obj): ... + def get_header_alg(self, header): ... + def get_header_enc(self, header): ... + def get_header_zip(self, header): ... + +def prepare_key(alg, header, key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/models.pyi new file mode 100644 index 000000000000..77879db640b5 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7516/models.pyi @@ -0,0 +1,56 @@ +from _typeshed import Incomplete +from abc import ABCMeta + +class JWEAlgorithmBase(metaclass=ABCMeta): + EXTRA_HEADERS: Incomplete + name: Incomplete + description: Incomplete + algorithm_type: str + algorithm_location: str + def prepare_key(self, raw_data) -> None: ... + def generate_preset(self, enc_alg, key) -> None: ... + +class JWEAlgorithm(JWEAlgorithmBase, metaclass=ABCMeta): + def wrap(self, enc_alg, headers, key, preset: Incomplete | None = None) -> None: ... + def unwrap(self, enc_alg, ek, headers, key) -> None: ... + +class JWEAlgorithmWithTagAwareKeyAgreement(JWEAlgorithmBase, metaclass=ABCMeta): + def generate_keys_and_prepare_headers(self, enc_alg, key, sender_key, preset: Incomplete | None = None) -> None: ... + def agree_upon_key_and_wrap_cek(self, enc_alg, headers, key, sender_key, epk, cek, tag) -> None: ... + def wrap(self, enc_alg, headers, key, sender_key, preset: Incomplete | None = None) -> None: ... + def unwrap(self, enc_alg, ek, headers, key, sender_key, tag: Incomplete | None = None) -> None: ... + +class JWEEncAlgorithm: + name: Incomplete + description: Incomplete + algorithm_type: str + algorithm_location: str + IV_SIZE: Incomplete + CEK_SIZE: Incomplete + def generate_cek(self): ... + def generate_iv(self): ... + def check_iv(self, iv) -> None: ... + def encrypt(self, msg, aad, iv, key) -> None: ... + def decrypt(self, ciphertext, aad, iv, tag, key) -> None: ... + +class JWEZipAlgorithm: + name: Incomplete + description: Incomplete + algorithm_type: str + algorithm_location: str + def compress(self, s) -> None: ... + def decompress(self, s) -> None: ... + +class JWESharedHeader(dict[str, object]): + protected: Incomplete + unprotected: Incomplete + def __init__(self, protected, unprotected) -> None: ... + def update_protected(self, addition) -> None: ... + @classmethod + def from_dict(cls, obj): ... + +class JWEHeader(dict[str, object]): + protected: Incomplete + unprotected: Incomplete + header: Incomplete + def __init__(self, protected, unprotected, header) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/__init__.pyi new file mode 100644 index 000000000000..7a5ebe6a8eac --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/__init__.pyi @@ -0,0 +1,7 @@ +from ._cryptography_key import load_pem_key as load_pem_key +from .asymmetric_key import AsymmetricKey as AsymmetricKey +from .base_key import Key as Key +from .jwk import JsonWebKey as JsonWebKey +from .key_set import KeySet as KeySet + +__all__ = ["Key", "AsymmetricKey", "KeySet", "JsonWebKey", "load_pem_key"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/_cryptography_key.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/_cryptography_key.pyi new file mode 100644 index 000000000000..efb320af7c3c --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/_cryptography_key.pyi @@ -0,0 +1,5 @@ +from _typeshed import Incomplete + +def load_pem_key( + raw, ssh_type: Incomplete | None = None, key_type: Incomplete | None = None, password: Incomplete | None = None +): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/asymmetric_key.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/asymmetric_key.pyi new file mode 100644 index 000000000000..ee40b4ee58ec --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/asymmetric_key.pyi @@ -0,0 +1,39 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7517 import Key + +class AsymmetricKey(Key): + PUBLIC_KEY_FIELDS: Incomplete + PRIVATE_KEY_FIELDS: Incomplete + PRIVATE_KEY_CLS = Incomplete + PUBLIC_KEY_CLS = Incomplete + SSH_PUBLIC_PREFIX: bytes + private_key: Incomplete + public_key: Incomplete + def __init__( + self, private_key: Incomplete | None = None, public_key: Incomplete | None = None, options: Incomplete | None = None + ) -> None: ... + @property + def public_only(self): ... + def get_op_key(self, operation): ... + def get_public_key(self): ... + def get_private_key(self): ... + def load_raw_key(self) -> None: ... + def load_dict_key(self) -> None: ... + def dumps_private_key(self) -> None: ... + def dumps_public_key(self) -> None: ... + def load_private_key(self) -> None: ... + def load_public_key(self) -> None: ... + def as_dict(self, is_private: bool = False, **params): ... + def as_key(self, is_private: bool = False): ... + def as_bytes(self, encoding: Incomplete | None = None, is_private: bool = False, password: Incomplete | None = None): ... + def as_pem(self, is_private: bool = False, password: Incomplete | None = None): ... + def as_der(self, is_private: bool = False, password: Incomplete | None = None): ... + @classmethod + def import_dict_key(cls, raw, options: Incomplete | None = None): ... + @classmethod + def import_key(cls, raw, options: Incomplete | None = None): ... + @classmethod + def validate_raw_key(cls, key): ... + @classmethod + def generate_key(cls, crv_or_size, options: Incomplete | None = None, is_private: bool = False) -> AsymmetricKey: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/base_key.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/base_key.pyi new file mode 100644 index 000000000000..001944c64841 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/base_key.pyi @@ -0,0 +1,28 @@ +from _typeshed import Incomplete + +class Key: + kty: str + ALLOWED_PARAMS: Incomplete + PRIVATE_KEY_OPS: Incomplete + PUBLIC_KEY_OPS: Incomplete + REQUIRED_JSON_FIELDS: Incomplete + options: Incomplete + def __init__(self, options: Incomplete | None = None) -> None: ... + @property + def tokens(self): ... + @property + def kid(self): ... + def keys(self): ... + def __getitem__(self, item): ... + @property + def public_only(self) -> None: ... + def load_raw_key(self) -> None: ... + def load_dict_key(self) -> None: ... + def check_key_op(self, operation) -> None: ... + def as_dict(self, is_private: bool = False, **params) -> None: ... + def as_json(self, is_private: bool = False, **params): ... + def thumbprint(self): ... + @classmethod + def check_required_fields(cls, data) -> None: ... + @classmethod + def validate_raw_key(cls, key) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/jwk.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/jwk.pyi new file mode 100644 index 000000000000..c386e2d8d856 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/jwk.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete +from collections.abc import Collection, Mapping + +from authlib.jose.rfc7517 import Key, KeySet + +class JsonWebKey: + JWK_KEY_CLS: Incomplete + @classmethod + def generate_key(cls, kty, crv_or_size, options: Incomplete | None = None, is_private: bool = False): ... + @classmethod + def import_key(cls, raw: Mapping[str, object], options: Mapping[str, object] | None = None) -> Key: ... + @classmethod + def import_key_set(cls, raw: str | Collection[str] | dict[str, object]) -> KeySet: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/key_set.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/key_set.pyi new file mode 100644 index 000000000000..11092ee28933 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7517/key_set.pyi @@ -0,0 +1,10 @@ +from collections.abc import Collection + +from authlib.jose.rfc7517 import Key + +class KeySet: + keys: Collection[Key] + def __init__(self, keys) -> None: ... + def as_dict(self, is_private: bool = False, **params): ... + def as_json(self, is_private: bool = False, **params): ... + def find_by_kid(self, kid): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/__init__.pyi new file mode 100644 index 000000000000..362234a1bdd7 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/__init__.pyi @@ -0,0 +1,20 @@ +from .ec_key import ECKey as ECKey +from .jwe_algs import AESAlgorithm as AESAlgorithm, ECDHESAlgorithm as ECDHESAlgorithm, u32be_len_input as u32be_len_input +from .jwe_encs import CBCHS2EncAlgorithm as CBCHS2EncAlgorithm +from .oct_key import OctKey as OctKey +from .rsa_key import RSAKey as RSAKey + +__all__ = [ + "register_jws_rfc7518", + "register_jwe_rfc7518", + "OctKey", + "RSAKey", + "ECKey", + "u32be_len_input", + "AESAlgorithm", + "ECDHESAlgorithm", + "CBCHS2EncAlgorithm", +] + +def register_jws_rfc7518(cls) -> None: ... +def register_jwe_rfc7518(cls) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/ec_key.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/ec_key.pyi new file mode 100644 index 000000000000..dbdf15be2993 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/ec_key.pyi @@ -0,0 +1,24 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7517 import AsymmetricKey +from cryptography.hazmat.primitives.asymmetric.ec import EllipticCurvePrivateKeyWithSerialization, EllipticCurvePublicKey + +class ECKey(AsymmetricKey): + kty: str + DSS_CURVES: Incomplete + CURVES_DSS: Incomplete + REQUIRED_JSON_FIELDS: Incomplete + PUBLIC_KEY_FIELDS = REQUIRED_JSON_FIELDS + PRIVATE_KEY_FIELDS: Incomplete + PUBLIC_KEY_CLS = EllipticCurvePublicKey + PRIVATE_KEY_CLS = EllipticCurvePrivateKeyWithSerialization + SSH_PUBLIC_PREFIX: bytes + def exchange_shared_key(self, pubkey): ... + @property + def curve_key_size(self): ... + def load_private_key(self): ... + def load_public_key(self): ... + def dumps_private_key(self): ... + def dumps_public_key(self): ... + @classmethod + def generate_key(cls, crv: str = "P-256", options: Incomplete | None = None, is_private: bool = False) -> ECKey: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_algs.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_algs.pyi new file mode 100644 index 000000000000..ff4fb5cb27a3 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_algs.pyi @@ -0,0 +1,64 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7516 import JWEAlgorithm + +class DirectAlgorithm(JWEAlgorithm): + name: str + description: str + def prepare_key(self, raw_data): ... + def generate_preset(self, enc_alg, key): ... + def wrap(self, enc_alg, headers, key, preset: Incomplete | None = None): ... + def unwrap(self, enc_alg, ek, headers, key): ... + +class RSAAlgorithm(JWEAlgorithm): + key_size: int + name: Incomplete + description: Incomplete + padding: Incomplete + def __init__(self, name, description, pad_fn) -> None: ... + def prepare_key(self, raw_data): ... + def generate_preset(self, enc_alg, key): ... + def wrap(self, enc_alg, headers, key, preset: Incomplete | None = None): ... + def unwrap(self, enc_alg, ek, headers, key): ... + +class AESAlgorithm(JWEAlgorithm): + name: Incomplete + description: Incomplete + key_size: Incomplete + def __init__(self, key_size) -> None: ... + def prepare_key(self, raw_data): ... + def generate_preset(self, enc_alg, key): ... + def wrap_cek(self, cek, key): ... + def wrap(self, enc_alg, headers, key, preset: Incomplete | None = None): ... + def unwrap(self, enc_alg, ek, headers, key): ... + +class AESGCMAlgorithm(JWEAlgorithm): + EXTRA_HEADERS: Incomplete + name: Incomplete + description: Incomplete + key_size: Incomplete + def __init__(self, key_size) -> None: ... + def prepare_key(self, raw_data): ... + def generate_preset(self, enc_alg, key): ... + def wrap(self, enc_alg, headers, key, preset: Incomplete | None = None): ... + def unwrap(self, enc_alg, ek, headers, key): ... + +class ECDHESAlgorithm(JWEAlgorithm): + EXTRA_HEADERS: Incomplete + ALLOWED_KEY_CLS = Incomplete + name: str + description: str + key_size: Incomplete + aeskw: Incomplete + def __init__(self, key_size: Incomplete | None = None) -> None: ... + def prepare_key(self, raw_data): ... + def generate_preset(self, enc_alg, key): ... + def compute_fixed_info(self, headers, bit_size): ... + def compute_derived_key(self, shared_key, fixed_info, bit_size): ... + def deliver(self, key, pubkey, headers, bit_size): ... + def wrap(self, enc_alg, headers, key, preset: Incomplete | None = None): ... + def unwrap(self, enc_alg, ek, headers, key): ... + +def u32be_len_input(s, base64: bool = False): ... + +JWE_ALG_ALGORITHMS: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_encs.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_encs.pyi new file mode 100644 index 000000000000..6d1dc2d73cd8 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_encs.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7516 import JWEEncAlgorithm + +class CBCHS2EncAlgorithm(JWEEncAlgorithm): + IV_SIZE: int + name: Incomplete + description: Incomplete + key_size: Incomplete + key_len: Incomplete + CEK_SIZE: Incomplete + hash_alg: Incomplete + def __init__(self, key_size, hash_type) -> None: ... + def encrypt(self, msg, aad, iv, key): ... + def decrypt(self, ciphertext, aad, iv, tag, key): ... + +class GCMEncAlgorithm(JWEEncAlgorithm): + IV_SIZE: int + name: Incomplete + description: Incomplete + key_size: Incomplete + CEK_SIZE: Incomplete + def __init__(self, key_size) -> None: ... + def encrypt(self, msg, aad, iv, key): ... + def decrypt(self, ciphertext, aad, iv, tag, key): ... + +JWE_ENC_ALGORITHMS: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_zips.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_zips.pyi new file mode 100644 index 000000000000..bf456649a113 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jwe_zips.pyi @@ -0,0 +1,9 @@ +from authlib.jose.rfc7516 import JWEZipAlgorithm + +class DeflateZipAlgorithm(JWEZipAlgorithm): + name: str + description: str + def compress(self, s): ... + def decompress(self, s): ... + +def register_jwe_rfc7518() -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jws_algs.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jws_algs.pyi new file mode 100644 index 000000000000..5bcca23de4d0 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/jws_algs.pyi @@ -0,0 +1,63 @@ +import hashlib +from _typeshed import Incomplete + +from authlib.jose.rfc7515 import JWSAlgorithm + +class NoneAlgorithm(JWSAlgorithm): + name: str + description: str + def prepare_key(self, raw_data) -> None: ... + def sign(self, msg, key): ... + def verify(self, msg, sig, key): ... + +class HMACAlgorithm(JWSAlgorithm): + SHA256 = hashlib.sha256 + SHA384 = hashlib.sha384 + SHA512 = hashlib.sha512 + name: Incomplete + description: Incomplete + hash_alg: Incomplete + def __init__(self, sha_type) -> None: ... + def prepare_key(self, raw_data): ... + def sign(self, msg, key): ... + def verify(self, msg, sig, key): ... + +class RSAAlgorithm(JWSAlgorithm): + SHA256: Incomplete + SHA384: Incomplete + SHA512: Incomplete + name: Incomplete + description: Incomplete + hash_alg: Incomplete + padding: Incomplete + def __init__(self, sha_type) -> None: ... + def prepare_key(self, raw_data): ... + def sign(self, msg, key): ... + def verify(self, msg, sig, key): ... + +class ECAlgorithm(JWSAlgorithm): + SHA256: Incomplete + SHA384: Incomplete + SHA512: Incomplete + name: Incomplete + curve: Incomplete + description: Incomplete + hash_alg: Incomplete + def __init__(self, name, curve, sha_type) -> None: ... + def prepare_key(self, raw_data): ... + def sign(self, msg, key): ... + def verify(self, msg, sig, key): ... + +class RSAPSSAlgorithm(JWSAlgorithm): + SHA256: Incomplete + SHA384: Incomplete + SHA512: Incomplete + name: Incomplete + description: Incomplete + hash_alg: Incomplete + def __init__(self, sha_type) -> None: ... + def prepare_key(self, raw_data): ... + def sign(self, msg, key): ... + def verify(self, msg, sig, key): ... + +JWS_ALGORITHMS: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/oct_key.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/oct_key.pyi new file mode 100644 index 000000000000..0a7674138585 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/oct_key.pyi @@ -0,0 +1,23 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7517 import Key + +POSSIBLE_UNSAFE_KEYS: Incomplete + +class OctKey(Key): + kty: str + REQUIRED_JSON_FIELDS: Incomplete + raw_key: Incomplete + def __init__(self, raw_key: Incomplete | None = None, options: Incomplete | None = None) -> None: ... + @property + def public_only(self): ... + def get_op_key(self, operation): ... + def load_raw_key(self) -> None: ... + def load_dict_key(self) -> None: ... + def as_dict(self, is_private: bool = False, **params): ... + @classmethod + def validate_raw_key(cls, key): ... + @classmethod + def import_key(cls, raw, options: Incomplete | None = None): ... + @classmethod + def generate_key(cls, key_size: int = 256, options: Incomplete | None = None, is_private: bool = True): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/rsa_key.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/rsa_key.pyi new file mode 100644 index 000000000000..b2c78670128b --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/rsa_key.pyi @@ -0,0 +1,23 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7517 import AsymmetricKey +from cryptography.hazmat.primitives.asymmetric.rsa import RSAPrivateKeyWithSerialization, RSAPublicKey + +class RSAKey(AsymmetricKey): + kty: str + PUBLIC_KEY_CLS = RSAPublicKey + PRIVATE_KEY_CLS = RSAPrivateKeyWithSerialization + PUBLIC_KEY_FIELDS: Incomplete + PRIVATE_KEY_FIELDS: Incomplete + REQUIRED_JSON_FIELDS: Incomplete + SSH_PUBLIC_PREFIX: bytes + def dumps_private_key(self): ... + def dumps_public_key(self): ... + def load_private_key(self): ... + def load_public_key(self): ... + @classmethod + def generate_key(cls, key_size: int = 2048, options: Incomplete | None = None, is_private: bool = False) -> RSAKey: ... + @classmethod + def import_dict_key(cls, raw, options: Incomplete | None = None): ... + +def has_all_prime_factors(obj): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/util.pyi new file mode 100644 index 000000000000..f691a9d274f6 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7518/util.pyi @@ -0,0 +1,2 @@ +def encode_int(num, bits): ... +def decode_int(b): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/__init__.pyi new file mode 100644 index 000000000000..bb053f7d5142 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/__init__.pyi @@ -0,0 +1,4 @@ +from .claims import BaseClaims as BaseClaims, JWTClaims as JWTClaims +from .jwt import JsonWebToken as JsonWebToken + +__all__ = ["JsonWebToken", "BaseClaims", "JWTClaims"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/claims.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/claims.pyi new file mode 100644 index 000000000000..e195536a74b4 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/claims.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete + +class BaseClaims(dict[str, object]): + REGISTERED_CLAIMS: Incomplete + header: Incomplete + options: Incomplete + params: Incomplete + def __init__(self, payload, header, options: Incomplete | None = None, params: Incomplete | None = None) -> None: ... + def __getattr__(self, key): ... + def get_registered_claims(self): ... + +class JWTClaims(BaseClaims): + REGISTERED_CLAIMS: Incomplete + def validate(self, now: Incomplete | None = None, leeway: int = 0) -> None: ... + def validate_iss(self) -> None: ... + def validate_sub(self) -> None: ... + def validate_aud(self) -> None: ... + def validate_exp(self, now, leeway) -> None: ... + def validate_nbf(self, now, leeway) -> None: ... + def validate_iat(self, now, leeway) -> None: ... + def validate_jti(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/jwt.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/jwt.pyi new file mode 100644 index 000000000000..270722ede34f --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc7519/jwt.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete + +class JsonWebToken: + SENSITIVE_NAMES: Incomplete + SENSITIVE_VALUES: Incomplete + def __init__(self, algorithms, private_headers: Incomplete | None = None) -> None: ... + def check_sensitive_data(self, payload) -> None: ... + def encode(self, header, payload, key, check: bool = True): ... + def decode( + self, + s, + key, + claims_cls: Incomplete | None = None, + claims_options: Incomplete | None = None, + claims_params: Incomplete | None = None, + ): ... + +def decode_payload(bytes_payload): ... +def prepare_raw_key(raw): ... +def find_encode_key(key, header): ... +def create_load_key(key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/__init__.pyi new file mode 100644 index 000000000000..915582d47ac5 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/__init__.pyi @@ -0,0 +1,4 @@ +from .jws_eddsa import register_jws_rfc8037 as register_jws_rfc8037 +from .okp_key import OKPKey as OKPKey + +__all__ = ["register_jws_rfc8037", "OKPKey"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/jws_eddsa.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/jws_eddsa.pyi new file mode 100644 index 000000000000..c6f1e628a139 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/jws_eddsa.pyi @@ -0,0 +1,10 @@ +from authlib.jose.rfc7515 import JWSAlgorithm + +class EdDSAAlgorithm(JWSAlgorithm): + name: str + description: str + def prepare_key(self, raw_data): ... + def sign(self, msg, key): ... + def verify(self, msg, sig, key): ... + +def register_jws_rfc8037(cls) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/okp_key.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/okp_key.pyi new file mode 100644 index 000000000000..1b938de4ed8b --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/rfc8037/okp_key.pyi @@ -0,0 +1,24 @@ +from _typeshed import Incomplete + +from authlib.jose.rfc7517 import AsymmetricKey + +PUBLIC_KEYS_MAP: Incomplete +PRIVATE_KEYS_MAP: Incomplete + +class OKPKey(AsymmetricKey): + kty: str + REQUIRED_JSON_FIELDS: Incomplete + PUBLIC_KEY_FIELDS = REQUIRED_JSON_FIELDS + PRIVATE_KEY_FIELDS: Incomplete + PUBLIC_KEY_CLS: Incomplete + PRIVATE_KEY_CLS: Incomplete + SSH_PUBLIC_PREFIX: bytes + def exchange_shared_key(self, pubkey): ... + @staticmethod + def get_key_curve(key): ... + def load_private_key(self): ... + def load_public_key(self): ... + def dumps_private_key(self): ... + def dumps_public_key(self, public_key: Incomplete | None = None): ... + @classmethod + def generate_key(cls, crv: str = "Ed25519", options: Incomplete | None = None, is_private: bool = False) -> OKPKey: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/util.pyi new file mode 100644 index 000000000000..ef9dc7671b67 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/jose/util.pyi @@ -0,0 +1,3 @@ +def extract_header(header_segment, error_cls): ... +def extract_segment(segment, error_cls, name: str = "payload"): ... +def ensure_dict(s, structure_name): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/__init__.pyi new file mode 100644 index 000000000000..053e8f1d2c33 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/__init__.pyi @@ -0,0 +1,33 @@ +from .rfc5849 import ( + SIGNATURE_HMAC_SHA1 as SIGNATURE_HMAC_SHA1, + SIGNATURE_PLAINTEXT as SIGNATURE_PLAINTEXT, + SIGNATURE_RSA_SHA1 as SIGNATURE_RSA_SHA1, + SIGNATURE_TYPE_BODY as SIGNATURE_TYPE_BODY, + SIGNATURE_TYPE_HEADER as SIGNATURE_TYPE_HEADER, + SIGNATURE_TYPE_QUERY as SIGNATURE_TYPE_QUERY, + AuthorizationServer as AuthorizationServer, + ClientAuth as ClientAuth, + ClientMixin as ClientMixin, + OAuth1Request as OAuth1Request, + ResourceProtector as ResourceProtector, + TemporaryCredential as TemporaryCredential, + TemporaryCredentialMixin as TemporaryCredentialMixin, + TokenCredentialMixin as TokenCredentialMixin, +) + +__all__ = [ + "OAuth1Request", + "ClientAuth", + "SIGNATURE_HMAC_SHA1", + "SIGNATURE_RSA_SHA1", + "SIGNATURE_PLAINTEXT", + "SIGNATURE_TYPE_HEADER", + "SIGNATURE_TYPE_QUERY", + "SIGNATURE_TYPE_BODY", + "ClientMixin", + "TemporaryCredentialMixin", + "TokenCredentialMixin", + "TemporaryCredential", + "AuthorizationServer", + "ResourceProtector", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/client.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/client.pyi new file mode 100644 index 000000000000..a7823d5211e9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/client.pyi @@ -0,0 +1,39 @@ +from _typeshed import Incomplete + +from authlib.oauth1 import ClientAuth + +class OAuth1Client: + auth_class: type[ClientAuth] = ... + session: Incomplete + auth: Incomplete + def __init__( + self, + session, + client_id, + client_secret: Incomplete | None = None, + token: Incomplete | None = None, + token_secret: Incomplete | None = None, + redirect_uri: Incomplete | None = None, + rsa_key: Incomplete | None = None, + verifier: Incomplete | None = None, + signature_method="HMAC-SHA1", + signature_type="HEADER", + force_include_body: bool = False, + realm: Incomplete | None = None, + **kwargs, + ) -> None: ... + @property + def redirect_uri(self): ... + @redirect_uri.setter + def redirect_uri(self, uri) -> None: ... + @property + def token(self): ... + @token.setter + def token(self, token) -> None: ... + def create_authorization_url(self, url, request_token: Incomplete | None = None, **kwargs): ... + def fetch_request_token(self, url, **kwargs): ... + def fetch_access_token(self, url, verifier: Incomplete | None = None, **kwargs): ... + def parse_authorization_response(self, url): ... + def parse_response_token(self, status_code, text): ... + @staticmethod + def handle_error(error_type, error_description) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/errors.pyi new file mode 100644 index 000000000000..21c42b76694a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/errors.pyi @@ -0,0 +1 @@ +from authlib.oauth1.rfc5849.errors import * diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/__init__.pyi new file mode 100644 index 000000000000..f6cd313f97d5 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/__init__.pyi @@ -0,0 +1,35 @@ +from .authorization_server import AuthorizationServer as AuthorizationServer +from .client_auth import ClientAuth as ClientAuth +from .models import ( + ClientMixin as ClientMixin, + TemporaryCredential as TemporaryCredential, + TemporaryCredentialMixin as TemporaryCredentialMixin, + TokenCredentialMixin as TokenCredentialMixin, +) +from .resource_protector import ResourceProtector as ResourceProtector +from .signature import ( + SIGNATURE_HMAC_SHA1 as SIGNATURE_HMAC_SHA1, + SIGNATURE_PLAINTEXT as SIGNATURE_PLAINTEXT, + SIGNATURE_RSA_SHA1 as SIGNATURE_RSA_SHA1, + SIGNATURE_TYPE_BODY as SIGNATURE_TYPE_BODY, + SIGNATURE_TYPE_HEADER as SIGNATURE_TYPE_HEADER, + SIGNATURE_TYPE_QUERY as SIGNATURE_TYPE_QUERY, +) +from .wrapper import OAuth1Request as OAuth1Request + +__all__ = [ + "OAuth1Request", + "ClientAuth", + "SIGNATURE_HMAC_SHA1", + "SIGNATURE_RSA_SHA1", + "SIGNATURE_PLAINTEXT", + "SIGNATURE_TYPE_HEADER", + "SIGNATURE_TYPE_QUERY", + "SIGNATURE_TYPE_BODY", + "ClientMixin", + "TemporaryCredentialMixin", + "TokenCredentialMixin", + "TemporaryCredential", + "AuthorizationServer", + "ResourceProtector", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/authorization_server.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/authorization_server.pyi new file mode 100644 index 000000000000..62073bb460f4 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/authorization_server.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete + +from authlib.oauth1.rfc5849.base_server import BaseServer + +class AuthorizationServer(BaseServer): + TOKEN_RESPONSE_HEADER: Incomplete + TEMPORARY_CREDENTIALS_METHOD: str + def create_oauth1_request(self, request) -> None: ... + def handle_response(self, status_code, payload, headers) -> None: ... + def handle_error_response(self, error): ... + def validate_temporary_credentials_request(self, request): ... + def create_temporary_credentials_response(self, request: Incomplete | None = None): ... + def validate_authorization_request(self, request): ... + def create_authorization_response(self, request, grant_user: Incomplete | None = None): ... + def validate_token_request(self, request): ... + def create_token_response(self, request): ... + def create_temporary_credential(self, request) -> None: ... + def get_temporary_credential(self, request) -> None: ... + def delete_temporary_credential(self, request) -> None: ... + def create_authorization_verifier(self, request) -> None: ... + def create_token_credential(self, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/base_server.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/base_server.pyi new file mode 100644 index 000000000000..17f8ad953126 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/base_server.pyi @@ -0,0 +1,12 @@ +from _typeshed import Incomplete + +class BaseServer: + SIGNATURE_METHODS: Incomplete + SUPPORTED_SIGNATURE_METHODS: Incomplete + EXPIRY_TIME: int + @classmethod + def register_signature_method(cls, name, verify) -> None: ... + def validate_timestamp_and_nonce(self, request) -> None: ... + def validate_oauth_signature(self, request) -> None: ... + def get_client_by_id(self, client_id) -> None: ... + def exists_nonce(self, nonce, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/client_auth.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/client_auth.pyi new file mode 100644 index 000000000000..05e033dbb42c --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/client_auth.pyi @@ -0,0 +1,41 @@ +from _typeshed import Incomplete + +CONTENT_TYPE_FORM_URLENCODED: str +CONTENT_TYPE_MULTI_PART: str + +class ClientAuth: + SIGNATURE_METHODS: Incomplete + @classmethod + def register_signature_method(cls, name, sign) -> None: ... + client_id: Incomplete + client_secret: Incomplete + token: Incomplete + token_secret: Incomplete + redirect_uri: Incomplete + signature_method: Incomplete + signature_type: Incomplete + rsa_key: Incomplete + verifier: Incomplete + realm: Incomplete + force_include_body: Incomplete + def __init__( + self, + client_id, + client_secret: Incomplete | None = None, + token: Incomplete | None = None, + token_secret: Incomplete | None = None, + redirect_uri: Incomplete | None = None, + rsa_key: Incomplete | None = None, + verifier: Incomplete | None = None, + signature_method="HMAC-SHA1", + signature_type="HEADER", + realm: Incomplete | None = None, + force_include_body: bool = False, + ) -> None: ... + def get_oauth_signature(self, method, uri, headers, body): ... + def get_oauth_params(self, nonce, timestamp): ... + def sign(self, method, uri, headers, body): ... + def prepare(self, method, uri, headers, body): ... + +def generate_nonce(): ... +def generate_timestamp(): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/errors.pyi new file mode 100644 index 000000000000..9c5f35d53b35 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/errors.pyi @@ -0,0 +1,56 @@ +from _typeshed import Incomplete + +from authlib.common.errors import AuthlibHTTPError + +class OAuth1Error(AuthlibHTTPError): + def __init__( + self, description: Incomplete | None = None, uri: Incomplete | None = None, status_code: Incomplete | None = None + ) -> None: ... + def get_headers(self): ... + +class InsecureTransportError(OAuth1Error): + error: str + description: str + @classmethod + def check(cls, uri) -> None: ... + +class InvalidRequestError(OAuth1Error): + error: str + +class UnsupportedParameterError(OAuth1Error): + error: str + +class UnsupportedSignatureMethodError(OAuth1Error): + error: str + +class MissingRequiredParameterError(OAuth1Error): + error: str + def __init__(self, key) -> None: ... + +class DuplicatedOAuthProtocolParameterError(OAuth1Error): + error: str + +class InvalidClientError(OAuth1Error): + error: str + status_code: int + +class InvalidTokenError(OAuth1Error): + error: str + description: str + status_code: int + +class InvalidSignatureError(OAuth1Error): + error: str + status_code: int + +class InvalidNonceError(OAuth1Error): + error: str + status_code: int + +class AccessDeniedError(OAuth1Error): + error: str + description: str + +class MethodNotAllowedError(OAuth1Error): + error: str + status_code: int diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/models.pyi new file mode 100644 index 000000000000..4deaea6efdfa --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/models.pyi @@ -0,0 +1,21 @@ +class ClientMixin: + def get_default_redirect_uri(self) -> None: ... + def get_client_secret(self) -> None: ... + def get_rsa_public_key(self) -> None: ... + +class TokenCredentialMixin: + def get_oauth_token(self) -> None: ... + def get_oauth_token_secret(self) -> None: ... + +class TemporaryCredentialMixin(TokenCredentialMixin): + def get_client_id(self) -> None: ... + def get_redirect_uri(self) -> None: ... + def check_verifier(self, verifier) -> None: ... + +class TemporaryCredential(dict[str, object], TemporaryCredentialMixin): + def get_client_id(self): ... + def get_user_id(self): ... + def get_redirect_uri(self): ... + def check_verifier(self, verifier): ... + def get_oauth_token(self): ... + def get_oauth_token_secret(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/parameters.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/parameters.pyi new file mode 100644 index 000000000000..98bd2f2ba389 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/parameters.pyi @@ -0,0 +1,5 @@ +from _typeshed import Incomplete + +def prepare_headers(oauth_params, headers: Incomplete | None = None, realm: Incomplete | None = None): ... +def prepare_form_encoded_body(oauth_params, body): ... +def prepare_request_uri_query(oauth_params, uri): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/resource_protector.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/resource_protector.pyi new file mode 100644 index 000000000000..78c3fbe96cb2 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/resource_protector.pyi @@ -0,0 +1,5 @@ +from authlib.oauth1.rfc5849.base_server import BaseServer + +class ResourceProtector(BaseServer): + def validate_request(self, method, uri, body, headers): ... + def get_token_credential(self, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/rsa.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/rsa.pyi new file mode 100644 index 000000000000..c08bb419df93 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/rsa.pyi @@ -0,0 +1,2 @@ +def sign_sha1(msg, rsa_private_key): ... +def verify_sha1(sig, msg, rsa_public_key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/signature.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/signature.pyi new file mode 100644 index 000000000000..8279b465dc09 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/signature.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete + +SIGNATURE_HMAC_SHA1: str +SIGNATURE_RSA_SHA1: str +SIGNATURE_PLAINTEXT: str +SIGNATURE_TYPE_HEADER: str +SIGNATURE_TYPE_QUERY: str +SIGNATURE_TYPE_BODY: str + +def construct_base_string(method, uri, params, host: Incomplete | None = None): ... +def normalize_base_string_uri(uri, host: Incomplete | None = None): ... +def normalize_parameters(params): ... +def generate_signature_base_string(request): ... +def hmac_sha1_signature(base_string, client_secret, token_secret): ... +def rsa_sha1_signature(base_string, rsa_private_key): ... +def plaintext_signature(client_secret, token_secret): ... +def sign_hmac_sha1(client, request): ... +def sign_rsa_sha1(client, request): ... +def sign_plaintext(client, request): ... +def verify_hmac_sha1(request): ... +def verify_rsa_sha1(request): ... +def verify_plaintext(request): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/util.pyi new file mode 100644 index 000000000000..7d64aaa66113 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/util.pyi @@ -0,0 +1,2 @@ +def escape(s): ... +def unescape(s): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/wrapper.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/wrapper.pyi new file mode 100644 index 000000000000..21696ccac9b9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth1/rfc5849/wrapper.pyi @@ -0,0 +1,33 @@ +from _typeshed import Incomplete + +class OAuth1Request: + method: Incomplete + uri: Incomplete + body: Incomplete + headers: Incomplete + client: Incomplete + credential: Incomplete + user: Incomplete + query: Incomplete + query_params: Incomplete + body_params: Incomplete + params: Incomplete + def __init__(self, method, uri, body: Incomplete | None = None, headers: Incomplete | None = None) -> None: ... + @property + def client_id(self): ... + @property + def client_secret(self): ... + @property + def rsa_public_key(self): ... + @property + def timestamp(self): ... + @property + def redirect_uri(self): ... + @property + def signature(self): ... + @property + def signature_method(self): ... + @property + def token(self): ... + @property + def token_secret(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/__init__.pyi new file mode 100644 index 000000000000..716ca9309f0c --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/__init__.pyi @@ -0,0 +1,22 @@ +from .auth import ClientAuth as ClientAuth, TokenAuth as TokenAuth +from .base import OAuth2Error as OAuth2Error +from .client import OAuth2Client as OAuth2Client +from .rfc6749 import ( + AuthorizationServer as AuthorizationServer, + ClientAuthentication as ClientAuthentication, + JsonRequest as JsonRequest, + OAuth2Request as OAuth2Request, + ResourceProtector as ResourceProtector, +) + +__all__ = [ + "OAuth2Error", + "ClientAuth", + "TokenAuth", + "OAuth2Client", + "OAuth2Request", + "JsonRequest", + "AuthorizationServer", + "ClientAuthentication", + "ResourceProtector", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/auth.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/auth.pyi new file mode 100644 index 000000000000..c06c35cafdbc --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/auth.pyi @@ -0,0 +1,24 @@ +from _typeshed import Incomplete + +def encode_client_secret_basic(client, method, uri, headers, body): ... +def encode_client_secret_post(client, method, uri, headers, body): ... +def encode_none(client, method, uri, headers, body): ... + +class ClientAuth: + DEFAULT_AUTH_METHODS: Incomplete + client_id: Incomplete + client_secret: Incomplete + auth_method: Incomplete + def __init__(self, client_id, client_secret, auth_method: Incomplete | None = None) -> None: ... + def prepare(self, method, uri, headers, body): ... + +class TokenAuth: + DEFAULT_TOKEN_TYPE: str + SIGN_METHODS: Incomplete + token: Incomplete + token_placement: Incomplete + client: Incomplete + hooks: Incomplete + def __init__(self, token, token_placement: str = "header", client: Incomplete | None = None) -> None: ... + def set_token(self, token) -> None: ... + def prepare(self, uri, headers, body): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/base.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/base.pyi new file mode 100644 index 000000000000..4359ffb53120 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/base.pyi @@ -0,0 +1,20 @@ +from _typeshed import Incomplete + +from authlib.common.errors import AuthlibHTTPError + +class OAuth2Error(AuthlibHTTPError): + state: Incomplete + redirect_uri: Incomplete + redirect_fragment: Incomplete + def __init__( + self, + description: Incomplete | None = None, + uri: Incomplete | None = None, + status_code: Incomplete | None = None, + state: Incomplete | None = None, + redirect_uri: Incomplete | None = None, + redirect_fragment: bool = False, + error: Incomplete | None = None, + ) -> None: ... + def get_body(self): ... + def __call__(self, uri: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/client.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/client.pyi new file mode 100644 index 000000000000..4656ed8f2b28 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/client.pyi @@ -0,0 +1,96 @@ +from _typeshed import Incomplete + +from authlib.oauth2 import ClientAuth, OAuth2Error, TokenAuth + +DEFAULT_HEADERS: Incomplete + +class OAuth2Client: + client_auth_class = ClientAuth + token_auth_class = TokenAuth + oauth_error_class = OAuth2Error + EXTRA_AUTHORIZE_PARAMS: Incomplete + SESSION_REQUEST_PARAMS: Incomplete + session: Incomplete + client_id: Incomplete + client_secret: Incomplete + state: Incomplete + token_endpoint_auth_method: Incomplete + revocation_endpoint_auth_method: Incomplete + scope: Incomplete + redirect_uri: Incomplete + code_challenge_method: Incomplete + token_auth: Incomplete + update_token: Incomplete + metadata: Incomplete + compliance_hook: Incomplete + leeway: Incomplete + def __init__( + self, + session, + client_id: Incomplete | None = None, + client_secret: Incomplete | None = None, + token_endpoint_auth_method: Incomplete | None = None, + revocation_endpoint_auth_method: Incomplete | None = None, + scope: Incomplete | None = None, + state: Incomplete | None = None, + redirect_uri: Incomplete | None = None, + code_challenge_method: Incomplete | None = None, + token: Incomplete | None = None, + token_placement: str = "header", + update_token: Incomplete | None = None, + leeway: int = 60, + **metadata, + ) -> None: ... + def register_client_auth_method(self, auth) -> None: ... + def client_auth(self, auth_method): ... + @property + def token(self): ... + @token.setter + def token(self, token) -> None: ... + def create_authorization_url( + self, url, state: Incomplete | None = None, code_verifier: Incomplete | None = None, **kwargs + ): ... + def fetch_token( + self, + url: Incomplete | None = None, + body: str = "", + method: str = "POST", + headers: Incomplete | None = None, + auth: Incomplete | None = None, + grant_type: Incomplete | None = None, + state: Incomplete | None = None, + **kwargs, + ): ... + def token_from_fragment(self, authorization_response, state: Incomplete | None = None): ... + def refresh_token( + self, + url: Incomplete | None = None, + refresh_token: Incomplete | None = None, + body: str = "", + auth: Incomplete | None = None, + headers: Incomplete | None = None, + **kwargs, + ): ... + def ensure_active_token(self, token: Incomplete | None = None): ... + def revoke_token( + self, + url, + token: Incomplete | None = None, + token_type_hint: Incomplete | None = None, + body: Incomplete | None = None, + auth: Incomplete | None = None, + headers: Incomplete | None = None, + **kwargs, + ): ... + def introspect_token( + self, + url, + token: Incomplete | None = None, + token_type_hint: Incomplete | None = None, + body: Incomplete | None = None, + auth: Incomplete | None = None, + headers: Incomplete | None = None, + **kwargs, + ): ... + def register_compliance_hook(self, hook_type, hook) -> None: ... + def parse_response_token(self, resp): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/__init__.pyi new file mode 100644 index 000000000000..2e5ddb3a6130 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/__init__.pyi @@ -0,0 +1,76 @@ +from .authenticate_client import ClientAuthentication as ClientAuthentication +from .authorization_server import AuthorizationServer as AuthorizationServer +from .errors import ( + AccessDeniedError as AccessDeniedError, + InsecureTransportError as InsecureTransportError, + InvalidClientError as InvalidClientError, + InvalidGrantError as InvalidGrantError, + InvalidRequestError as InvalidRequestError, + InvalidScopeError as InvalidScopeError, + MismatchingStateException as MismatchingStateException, + MissingAuthorizationError as MissingAuthorizationError, + MissingCodeException as MissingCodeException, + MissingTokenException as MissingTokenException, + MissingTokenTypeException as MissingTokenTypeException, + OAuth2Error as OAuth2Error, + UnauthorizedClientError as UnauthorizedClientError, + UnsupportedGrantTypeError as UnsupportedGrantTypeError, + UnsupportedResponseTypeError as UnsupportedResponseTypeError, + UnsupportedTokenTypeError as UnsupportedTokenTypeError, +) +from .grants import ( + AuthorizationCodeGrant as AuthorizationCodeGrant, + AuthorizationEndpointMixin as AuthorizationEndpointMixin, + BaseGrant as BaseGrant, + ClientCredentialsGrant as ClientCredentialsGrant, + ImplicitGrant as ImplicitGrant, + RefreshTokenGrant as RefreshTokenGrant, + ResourceOwnerPasswordCredentialsGrant as ResourceOwnerPasswordCredentialsGrant, + TokenEndpointMixin as TokenEndpointMixin, +) +from .models import AuthorizationCodeMixin as AuthorizationCodeMixin, ClientMixin as ClientMixin, TokenMixin as TokenMixin +from .requests import JsonRequest as JsonRequest, OAuth2Request as OAuth2Request +from .resource_protector import ResourceProtector as ResourceProtector, TokenValidator as TokenValidator +from .token_endpoint import TokenEndpoint as TokenEndpoint +from .util import list_to_scope as list_to_scope, scope_to_list as scope_to_list +from .wrappers import OAuth2Token as OAuth2Token + +__all__ = [ + "OAuth2Token", + "OAuth2Request", + "JsonRequest", + "OAuth2Error", + "AccessDeniedError", + "MissingAuthorizationError", + "InvalidGrantError", + "InvalidClientError", + "InvalidRequestError", + "InvalidScopeError", + "InsecureTransportError", + "UnauthorizedClientError", + "UnsupportedResponseTypeError", + "UnsupportedGrantTypeError", + "UnsupportedTokenTypeError", + "MissingCodeException", + "MissingTokenException", + "MissingTokenTypeException", + "MismatchingStateException", + "ClientMixin", + "AuthorizationCodeMixin", + "TokenMixin", + "ClientAuthentication", + "AuthorizationServer", + "ResourceProtector", + "TokenValidator", + "TokenEndpoint", + "BaseGrant", + "AuthorizationEndpointMixin", + "TokenEndpointMixin", + "AuthorizationCodeGrant", + "ImplicitGrant", + "ResourceOwnerPasswordCredentialsGrant", + "ClientCredentialsGrant", + "RefreshTokenGrant", + "scope_to_list", + "list_to_scope", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/authenticate_client.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/authenticate_client.pyi new file mode 100644 index 000000000000..01af6828efd2 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/authenticate_client.pyi @@ -0,0 +1,13 @@ +from collections.abc import Callable, Collection + +from authlib.oauth2 import OAuth2Request +from authlib.oauth2.rfc6749 import ClientMixin + +__all__ = ["ClientAuthentication"] + +class ClientAuthentication: + query_client: Callable[[str], ClientMixin] + def __init__(self, query_client: Callable[[str], ClientMixin]) -> None: ... + def register(self, method: str, func: Callable[[Callable[[str], ClientMixin], OAuth2Request], ClientMixin]) -> None: ... + def authenticate(self, request: OAuth2Request, methods: Collection[str], endpoint: str) -> ClientMixin: ... + def __call__(self, request: OAuth2Request, methods: Collection[str], endpoint: str = "token") -> ClientMixin: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/authorization_server.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/authorization_server.pyi new file mode 100644 index 000000000000..69c1d6ee50dd --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/authorization_server.pyi @@ -0,0 +1,46 @@ +from _typeshed import Incomplete +from collections.abc import Callable, Collection, Mapping +from typing_extensions import TypeAlias + +from authlib.oauth2 import JsonRequest, OAuth2Error, OAuth2Request +from authlib.oauth2.rfc6749 import BaseGrant, ClientMixin +from authlib.oauth2.rfc6750 import BearerTokenGenerator + +_ServerResponse: TypeAlias = tuple[int, str, list[tuple[str, str]]] + +class AuthorizationServer: + scopes_supported: Collection[str] | None + def __init__(self, scopes_supported: Collection[str] | None = None) -> None: ... + def query_client(self, client_id: str) -> ClientMixin: ... + def save_token(self, token: dict[str, str | int], request: OAuth2Request) -> None: ... + def generate_token( + self, + grant_type: str, + client: ClientMixin, + user: Incomplete | None = None, + scope: str | None = None, + expires_in: int | None = None, + include_refresh_token: bool = True, + ) -> dict[str, str | int]: ... + def register_token_generator(self, grant_type: str, func: BearerTokenGenerator) -> None: ... + def authenticate_client(self, request: OAuth2Request, methods: Collection[str], endpoint: str = "token") -> ClientMixin: ... + def register_client_auth_method(self, method, func) -> None: ... + def get_error_uri(self, request, error) -> None: ... + def send_signal(self, name, *args: object, **kwargs: object) -> None: ... + def create_oauth2_request(self, request) -> OAuth2Request: ... + def create_json_request(self, request) -> JsonRequest: ... + def handle_response(self, status: int, body: Mapping[str, object], headers: Mapping[str, str]) -> object: ... + def validate_requested_scope(self, scope: str, state: str | None = None) -> None: ... + def register_grant( + self, grant_cls: type[BaseGrant], extensions: Collection[Callable[[BaseGrant], None]] | None = None + ) -> None: ... + def register_endpoint(self, endpoint) -> None: ... + def get_authorization_grant(self, request: OAuth2Request) -> BaseGrant: ... + def get_consent_grant(self, request: Incomplete | None = None, end_user: Incomplete | None = None): ... + def get_token_grant(self, request: OAuth2Request) -> BaseGrant: ... + def create_endpoint_response(self, name, request: Incomplete | None = None): ... + def create_authorization_response( + self, request: Incomplete | None = None, grant_user: Incomplete | None = None + ) -> object: ... + def create_token_response(self, request: Incomplete | None = None) -> _ServerResponse: ... + def handle_error_response(self, request: OAuth2Request, error: OAuth2Error) -> object: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/errors.pyi new file mode 100644 index 000000000000..c5be5e1368dc --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/errors.pyi @@ -0,0 +1,92 @@ +from _typeshed import Incomplete + +from authlib.oauth2 import OAuth2Error as OAuth2Error + +__all__ = [ + "OAuth2Error", + "InsecureTransportError", + "InvalidRequestError", + "InvalidClientError", + "UnauthorizedClientError", + "InvalidGrantError", + "UnsupportedResponseTypeError", + "UnsupportedGrantTypeError", + "InvalidScopeError", + "AccessDeniedError", + "MissingAuthorizationError", + "UnsupportedTokenTypeError", + "MissingCodeException", + "MissingTokenException", + "MissingTokenTypeException", + "MismatchingStateException", +] + +class InsecureTransportError(OAuth2Error): + error: str + description: str + @classmethod + def check(cls, uri) -> None: ... + +class InvalidRequestError(OAuth2Error): + error: str + +class InvalidClientError(OAuth2Error): + error: str + status_code: int + def get_headers(self): ... + +class InvalidGrantError(OAuth2Error): + error: str + +class UnauthorizedClientError(OAuth2Error): + error: str + +class UnsupportedResponseTypeError(OAuth2Error): + error: str + response_type: Incomplete + def __init__(self, response_type) -> None: ... + def get_error_description(self): ... + +class UnsupportedGrantTypeError(OAuth2Error): + error: str + grant_type: Incomplete + def __init__(self, grant_type) -> None: ... + def get_error_description(self): ... + +class InvalidScopeError(OAuth2Error): + error: str + description: str + +class AccessDeniedError(OAuth2Error): + error: str + description: str + +class ForbiddenError(OAuth2Error): + status_code: int + auth_type: Incomplete + realm: Incomplete + def __init__(self, auth_type: Incomplete | None = None, realm: Incomplete | None = None) -> None: ... + def get_headers(self): ... + +class MissingAuthorizationError(ForbiddenError): + error: str + description: str + +class UnsupportedTokenTypeError(ForbiddenError): + error: str + +class MissingCodeException(OAuth2Error): + error: str + description: str + +class MissingTokenException(OAuth2Error): + error: str + description: str + +class MissingTokenTypeException(OAuth2Error): + error: str + description: str + +class MismatchingStateException(OAuth2Error): + error: str + description: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/__init__.pyi new file mode 100644 index 000000000000..b0300118a192 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/__init__.pyi @@ -0,0 +1,21 @@ +from .authorization_code import AuthorizationCodeGrant as AuthorizationCodeGrant +from .base import ( + AuthorizationEndpointMixin as AuthorizationEndpointMixin, + BaseGrant as BaseGrant, + TokenEndpointMixin as TokenEndpointMixin, +) +from .client_credentials import ClientCredentialsGrant as ClientCredentialsGrant +from .implicit import ImplicitGrant as ImplicitGrant +from .refresh_token import RefreshTokenGrant as RefreshTokenGrant +from .resource_owner_password_credentials import ResourceOwnerPasswordCredentialsGrant as ResourceOwnerPasswordCredentialsGrant + +__all__ = [ + "BaseGrant", + "AuthorizationEndpointMixin", + "TokenEndpointMixin", + "AuthorizationCodeGrant", + "ImplicitGrant", + "ResourceOwnerPasswordCredentialsGrant", + "ClientCredentialsGrant", + "RefreshTokenGrant", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/authorization_code.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/authorization_code.pyi new file mode 100644 index 000000000000..5db449f98a86 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/authorization_code.pyi @@ -0,0 +1,24 @@ +from collections.abc import Collection +from typing_extensions import TypeAlias + +from authlib.oauth2 import OAuth2Request +from authlib.oauth2.rfc6749 import AuthorizationEndpointMixin, BaseGrant, ClientMixin, TokenEndpointMixin + +_ServerResponse: TypeAlias = tuple[int, str, list[tuple[str, str]]] + +class AuthorizationCodeGrant(BaseGrant, AuthorizationEndpointMixin, TokenEndpointMixin): + TOKEN_ENDPOINT_AUTH_METHODS: Collection[str] + AUTHORIZATION_CODE_LENGTH: int + RESPONSE_TYPES: Collection[str] + GRANT_TYPE: str + def validate_authorization_request(self) -> str: ... + def create_authorization_response(self, redirect_uri: str, grant_user) -> _ServerResponse: ... + def validate_token_request(self) -> None: ... + def create_token_response(self) -> _ServerResponse: ... + def generate_authorization_code(self) -> str: ... + def save_authorization_code(self, code: str, request: OAuth2Request) -> None: ... + def query_authorization_code(self, code: str, client: ClientMixin): ... + def delete_authorization_code(self, authorization_code) -> None: ... + def authenticate_user(self, authorization_code): ... + +def validate_code_authorization_request(grant: AuthorizationCodeGrant) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/base.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/base.pyi new file mode 100644 index 000000000000..5aea41fe8096 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/base.pyi @@ -0,0 +1,55 @@ +from _typeshed import Incomplete +from collections.abc import Callable, Collection +from typing_extensions import TypeAlias + +from authlib.oauth2 import OAuth2Request +from authlib.oauth2.rfc6749 import ClientMixin + +_ServerResponse: TypeAlias = tuple[int, str, list[tuple[str, str]]] + +class BaseGrant: + TOKEN_ENDPOINT_AUTH_METHODS: Collection[str] + GRANT_TYPE: str | None + TOKEN_RESPONSE_HEADER: Collection[tuple[str, str]] + prompt: Incomplete + redirect_uri: Incomplete + request: OAuth2Request + server: Incomplete + def __init__(self, request: OAuth2Request, server) -> None: ... + @property + def client(self): ... + def generate_token( + self, + user: Incomplete | None = None, + scope: str | None = None, + grant_type: str | None = None, + expires_in: int | None = None, + include_refresh_token: bool = True, + ) -> dict[str, str | int]: ... + def authenticate_token_endpoint_client(self) -> ClientMixin: ... + def save_token(self, token): ... + def validate_requested_scope(self) -> None: ... + def register_hook(self, hook_type: str, hook: Callable[..., Incomplete]) -> None: ... + def execute_hook(self, hook_type: str, *args: object, **kwargs: object) -> None: ... + +class TokenEndpointMixin: + TOKEN_ENDPOINT_HTTP_METHODS: Incomplete + GRANT_TYPE: Incomplete + @classmethod + def check_token_endpoint(cls, request: OAuth2Request): ... + def validate_token_request(self) -> None: ... + def create_token_response(self) -> _ServerResponse: ... + +class AuthorizationEndpointMixin: + RESPONSE_TYPES: Collection[str] + ERROR_RESPONSE_FRAGMENT: bool + @classmethod + def check_authorization_endpoint(cls, request: OAuth2Request) -> bool: ... + @staticmethod + def validate_authorization_redirect_uri(request: OAuth2Request, client: ClientMixin) -> str: ... + @staticmethod + def validate_no_multiple_request_parameter(request: OAuth2Request): ... + redirect_uri: Incomplete + def validate_consent_request(self) -> None: ... + def validate_authorization_request(self) -> str: ... + def create_authorization_response(self, redirect_uri: str, grant_user) -> _ServerResponse: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/client_credentials.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/client_credentials.pyi new file mode 100644 index 000000000000..b7f090ef5d63 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/client_credentials.pyi @@ -0,0 +1,6 @@ +from authlib.oauth2.rfc6749 import BaseGrant, TokenEndpointMixin + +class ClientCredentialsGrant(BaseGrant, TokenEndpointMixin): + GRANT_TYPE: str + def validate_token_request(self) -> None: ... + def create_token_response(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/implicit.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/implicit.pyi new file mode 100644 index 000000000000..b106bf654967 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/implicit.pyi @@ -0,0 +1,12 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc6749 import AuthorizationEndpointMixin, BaseGrant + +class ImplicitGrant(BaseGrant, AuthorizationEndpointMixin): + AUTHORIZATION_ENDPOINT: bool + TOKEN_ENDPOINT_AUTH_METHODS: Incomplete + RESPONSE_TYPES: Incomplete + GRANT_TYPE: str + ERROR_RESPONSE_FRAGMENT: bool + def validate_authorization_request(self): ... + def create_authorization_response(self, redirect_uri, grant_user): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/refresh_token.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/refresh_token.pyi new file mode 100644 index 000000000000..9d23ebed4089 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/refresh_token.pyi @@ -0,0 +1,15 @@ +from typing_extensions import TypeAlias + +from authlib.oauth2.rfc6749 import BaseGrant, TokenEndpointMixin, TokenMixin + +_ServerResponse: TypeAlias = tuple[int, str, list[tuple[str, str]]] + +class RefreshTokenGrant(BaseGrant, TokenEndpointMixin): + GRANT_TYPE: str + INCLUDE_NEW_REFRESH_TOKEN: bool + def validate_token_request(self) -> None: ... + def create_token_response(self) -> _ServerResponse: ... + def issue_token(self, user, refresh_token: TokenMixin) -> dict[str, str | int]: ... + def authenticate_refresh_token(self, refresh_token: str) -> TokenMixin: ... + def authenticate_user(self, refresh_token): ... + def revoke_old_credential(self, refresh_token: TokenMixin) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/resource_owner_password_credentials.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/resource_owner_password_credentials.pyi new file mode 100644 index 000000000000..4637a8064e21 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/grants/resource_owner_password_credentials.pyi @@ -0,0 +1,7 @@ +from authlib.oauth2.rfc6749 import BaseGrant, TokenEndpointMixin + +class ResourceOwnerPasswordCredentialsGrant(BaseGrant, TokenEndpointMixin): + GRANT_TYPE: str + def validate_token_request(self) -> None: ... + def create_token_response(self): ... + def authenticate_user(self, username, password) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/models.pyi new file mode 100644 index 000000000000..87649d102cef --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/models.pyi @@ -0,0 +1,22 @@ +from collections.abc import Collection + +class ClientMixin: + def get_client_id(self) -> str: ... + def get_default_redirect_uri(self) -> str: ... + def get_allowed_scope(self, scope: Collection[str] | str) -> str: ... + def check_redirect_uri(self, redirect_uri: str) -> bool: ... + def check_client_secret(self, client_secret: str) -> bool: ... + def check_endpoint_auth_method(self, method: str, endpoint: str) -> bool: ... + def check_response_type(self, response_type: str) -> bool: ... + def check_grant_type(self, grant_type: str) -> bool: ... + +class AuthorizationCodeMixin: + def get_redirect_uri(self) -> str: ... + def get_scope(self) -> str: ... + +class TokenMixin: + def check_client(self, client) -> bool: ... + def get_scope(self) -> str: ... + def get_expires_in(self) -> int: ... + def is_expired(self) -> bool: ... + def is_revoked(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/parameters.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/parameters.pyi new file mode 100644 index 000000000000..2ee2fd5361ea --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/parameters.pyi @@ -0,0 +1,14 @@ +from _typeshed import Incomplete + +def prepare_grant_uri( + uri, + client_id, + response_type, + redirect_uri: Incomplete | None = None, + scope: Incomplete | None = None, + state: Incomplete | None = None, + **kwargs, +): ... +def prepare_token_request(grant_type, body: str = "", redirect_uri: Incomplete | None = None, **kwargs): ... +def parse_authorization_code_response(uri, state: Incomplete | None = None): ... +def parse_implicit_response(uri, state: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/requests.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/requests.pyi new file mode 100644 index 000000000000..505c61e06802 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/requests.pyi @@ -0,0 +1,48 @@ +from _typeshed import Incomplete +from collections.abc import Mapping + +from authlib.oauth2.rfc6749 import ClientMixin + +class OAuth2Request: + method: str + uri: str + body: Mapping[str, str] | None + headers: Mapping[str, str] | None + client: ClientMixin | None + auth_method: str | None + user: Incomplete | None + authorization_code: Incomplete | None + refresh_token: Incomplete | None + credential: Incomplete | None + def __init__( + self, method: str, uri: str, body: Mapping[str, str] | None = None, headers: Mapping[str, str] | None = None + ) -> None: ... + @property + def args(self) -> dict[str, str | None]: ... + @property + def form(self) -> dict[str, str]: ... + @property + def data(self) -> dict[str, str]: ... + @property + def datalist(self) -> dict[str, list[Incomplete]]: ... + @property + def client_id(self) -> str: ... + @property + def response_type(self) -> str: ... + @property + def grant_type(self) -> str: ... + @property + def redirect_uri(self) -> str: ... + @property + def scope(self) -> str: ... + @property + def state(self) -> str | None: ... + +class JsonRequest: + method: Incomplete + uri: Incomplete + body: Incomplete + headers: Incomplete + def __init__(self, method, uri, body: Incomplete | None = None, headers: Incomplete | None = None) -> None: ... + @property + def data(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/resource_protector.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/resource_protector.pyi new file mode 100644 index 000000000000..27ab2765730a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/resource_protector.pyi @@ -0,0 +1,19 @@ +from _typeshed import Incomplete + +class TokenValidator: + TOKEN_TYPE: str + realm: Incomplete + extra_attributes: Incomplete + def __init__(self, realm: Incomplete | None = None, **extra_attributes) -> None: ... + @staticmethod + def scope_insufficient(token_scopes, required_scopes): ... + def authenticate_token(self, token_string) -> None: ... + def validate_request(self, request) -> None: ... + def validate_token(self, token, scopes, request) -> None: ... + +class ResourceProtector: + def __init__(self) -> None: ... + def register_token_validator(self, validator: TokenValidator): ... + def get_token_validator(self, token_type): ... + def parse_request_authorization(self, request): ... + def validate_request(self, scopes, request, **kwargs): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/token_endpoint.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/token_endpoint.pyi new file mode 100644 index 000000000000..72fcae8f9f73 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/token_endpoint.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +class TokenEndpoint: + ENDPOINT_NAME: Incomplete + SUPPORTED_TOKEN_TYPES: Incomplete + CLIENT_AUTH_METHODS: Incomplete + server: Incomplete + def __init__(self, server) -> None: ... + def __call__(self, request): ... + def create_endpoint_request(self, request): ... + def authenticate_endpoint_client(self, request): ... + def authenticate_token(self, request, client) -> None: ... + def create_endpoint_response(self, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/util.pyi new file mode 100644 index 000000000000..89ba8a33c9b1 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/util.pyi @@ -0,0 +1,5 @@ +from collections.abc import Collection + +def list_to_scope(scope: Collection[str] | str | None) -> str: ... +def scope_to_list(scope: Collection[str] | str | None) -> list[str]: ... +def extract_basic_authorization(headers: dict[str, str]) -> tuple[str, str]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/wrappers.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/wrappers.pyi new file mode 100644 index 000000000000..54a40f05a1f7 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6749/wrappers.pyi @@ -0,0 +1,5 @@ +class OAuth2Token(dict[str, object]): + def __init__(self, params) -> None: ... + def is_expired(self, leeway: int = 60): ... + @classmethod + def from_dict(cls, token): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/__init__.pyi new file mode 100644 index 000000000000..5c9b3d97670c --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/__init__.pyi @@ -0,0 +1,15 @@ +from .errors import InsufficientScopeError as InsufficientScopeError, InvalidTokenError as InvalidTokenError +from .parameters import add_bearer_token as add_bearer_token +from .token import BearerTokenGenerator as BearerTokenGenerator +from .validator import BearerTokenValidator as BearerTokenValidator + +__all__ = [ + "InvalidTokenError", + "InsufficientScopeError", + "add_bearer_token", + "BearerToken", + "BearerTokenGenerator", + "BearerTokenValidator", +] + +BearerToken = BearerTokenGenerator diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/errors.pyi new file mode 100644 index 000000000000..2c4fdca5115a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/errors.pyi @@ -0,0 +1,27 @@ +from _typeshed import Incomplete + +from authlib.oauth2 import OAuth2Error + +__all__ = ["InvalidTokenError", "InsufficientScopeError"] + +class InvalidTokenError(OAuth2Error): + error: str + description: str + status_code: int + realm: Incomplete + extra_attributes: Incomplete + def __init__( + self, + description: Incomplete | None = None, + uri: Incomplete | None = None, + status_code: Incomplete | None = None, + state: Incomplete | None = None, + realm: Incomplete | None = None, + **extra_attributes, + ) -> None: ... + def get_headers(self): ... + +class InsufficientScopeError(OAuth2Error): + error: str + description: str + status_code: int diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/parameters.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/parameters.pyi new file mode 100644 index 000000000000..de547a8a9797 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/parameters.pyi @@ -0,0 +1,6 @@ +from _typeshed import Incomplete + +def add_to_uri(token, uri): ... +def add_to_headers(token, headers: Incomplete | None = None): ... +def add_to_body(token, body: Incomplete | None = None): ... +def add_bearer_token(token, uri, headers, body, placement: str = "header"): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/token.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/token.pyi new file mode 100644 index 000000000000..44955fba002a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/token.pyi @@ -0,0 +1,41 @@ +from _typeshed import Incomplete +from collections.abc import Callable +from typing import Protocol + +from authlib.oauth2.rfc6749 import ClientMixin + +class _TokenGenerator(Protocol): + def __call__(self, *, client: ClientMixin, grant_type: str, user, scope: str) -> str: ... + +class BearerTokenGenerator: + DEFAULT_EXPIRES_IN: int + GRANT_TYPES_EXPIRES_IN: dict[str, int] + access_token_generator: _TokenGenerator + refresh_token_generator: _TokenGenerator + expires_generator: Callable[[ClientMixin, str], int] + def __init__( + self, + access_token_generator: _TokenGenerator, + refresh_token_generator: _TokenGenerator | None = None, + expires_generator: Callable[[ClientMixin, str], int] | None = None, + ) -> None: ... + @staticmethod + def get_allowed_scope(client: ClientMixin, scope: str) -> str: ... + def generate( + self, + grant_type: str, + client: ClientMixin, + user: Incomplete | None = None, + scope: str | None = None, + expires_in: int | None = None, + include_refresh_token: bool = True, + ) -> dict[str, str | int]: ... + def __call__( + self, + grant_type: str, + client: ClientMixin, + user: Incomplete | None = None, + scope: str | None = None, + expires_in: int | None = None, + include_refresh_token: bool = True, + ) -> dict[str, str | int]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/validator.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/validator.pyi new file mode 100644 index 000000000000..19686a94113d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc6750/validator.pyi @@ -0,0 +1,6 @@ +from authlib.oauth2.rfc6749 import TokenValidator + +class BearerTokenValidator(TokenValidator): + TOKEN_TYPE: str + def authenticate_token(self, token_string) -> None: ... + def validate_token(self, token, scopes, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/__init__.pyi new file mode 100644 index 000000000000..845277693e1f --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/__init__.pyi @@ -0,0 +1,4 @@ +from .parameters import prepare_revoke_token_request as prepare_revoke_token_request +from .revocation import RevocationEndpoint as RevocationEndpoint + +__all__ = ["prepare_revoke_token_request", "RevocationEndpoint"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/parameters.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/parameters.pyi new file mode 100644 index 000000000000..75b11c378ffa --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/parameters.pyi @@ -0,0 +1,5 @@ +from _typeshed import Incomplete + +def prepare_revoke_token_request( + token, token_type_hint: Incomplete | None = None, body: Incomplete | None = None, headers: Incomplete | None = None +): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/revocation.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/revocation.pyi new file mode 100644 index 000000000000..93e53aedc7f8 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7009/revocation.pyi @@ -0,0 +1,9 @@ +from authlib.oauth2.rfc6749 import TokenEndpoint + +class RevocationEndpoint(TokenEndpoint): + ENDPOINT_NAME: str + def authenticate_token(self, request, client): ... + def check_params(self, request, client) -> None: ... + def create_endpoint_response(self, request): ... + def query_token(self, token_string, token_type_hint) -> None: ... + def revoke_token(self, token, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7521/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7521/__init__.pyi new file mode 100644 index 000000000000..5c15a9779df8 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7521/__init__.pyi @@ -0,0 +1,3 @@ +from .client import AssertionClient as AssertionClient + +__all__ = ["AssertionClient"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7521/client.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7521/client.pyi new file mode 100644 index 000000000000..e2be7fece77f --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7521/client.pyi @@ -0,0 +1,39 @@ +from _typeshed import Incomplete + +from authlib.oauth2 import OAuth2Error + +class AssertionClient: + DEFAULT_GRANT_TYPE: Incomplete + ASSERTION_METHODS: Incomplete + token_auth_class: Incomplete + oauth_error_class = OAuth2Error + session: Incomplete + token_endpoint: Incomplete + grant_type: Incomplete + issuer: Incomplete + subject: Incomplete + audience: Incomplete + claims: Incomplete + scope: Incomplete + token_auth: Incomplete + leeway: Incomplete + def __init__( + self, + session, + token_endpoint, + issuer, + subject, + audience: Incomplete | None = None, + grant_type: Incomplete | None = None, + claims: Incomplete | None = None, + token_placement: str = "header", + scope: Incomplete | None = None, + leeway: int = 60, + **kwargs, + ) -> None: ... + @property + def token(self): ... + @token.setter + def token(self, token) -> None: ... + def refresh_token(self): ... + def parse_response_token(self, resp): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/__init__.pyi new file mode 100644 index 000000000000..693cfd64285d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/__init__.pyi @@ -0,0 +1,18 @@ +from .assertion import client_secret_jwt_sign as client_secret_jwt_sign, private_key_jwt_sign as private_key_jwt_sign +from .auth import ClientSecretJWT as ClientSecretJWT, PrivateKeyJWT as PrivateKeyJWT +from .client import JWTBearerClientAssertion as JWTBearerClientAssertion +from .jwt_bearer import JWTBearerGrant as JWTBearerGrant +from .token import JWTBearerTokenGenerator as JWTBearerTokenGenerator +from .validator import JWTBearerToken as JWTBearerToken, JWTBearerTokenValidator as JWTBearerTokenValidator + +__all__ = [ + "JWTBearerGrant", + "JWTBearerClientAssertion", + "client_secret_jwt_sign", + "private_key_jwt_sign", + "ClientSecretJWT", + "PrivateKeyJWT", + "JWTBearerToken", + "JWTBearerTokenGenerator", + "JWTBearerTokenValidator", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/assertion.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/assertion.pyi new file mode 100644 index 000000000000..059422d8da34 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/assertion.pyi @@ -0,0 +1,19 @@ +from _typeshed import Incomplete + +def sign_jwt_bearer_assertion( + key, + issuer, + audience, + subject: Incomplete | None = None, + issued_at: Incomplete | None = None, + expires_at: Incomplete | None = None, + claims: Incomplete | None = None, + header: Incomplete | None = None, + **kwargs, +): ... +def client_secret_jwt_sign( + client_secret, client_id, token_endpoint, alg: str = "HS256", claims: Incomplete | None = None, **kwargs +): ... +def private_key_jwt_sign( + private_key, client_id, token_endpoint, alg: str = "RS256", claims: Incomplete | None = None, **kwargs +): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/auth.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/auth.pyi new file mode 100644 index 000000000000..d346c96f2210 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/auth.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete + +class ClientSecretJWT: + name: str + alg: str + token_endpoint: Incomplete + claims: Incomplete + headers: Incomplete + def __init__( + self, + token_endpoint: Incomplete | None = None, + claims: Incomplete | None = None, + headers: Incomplete | None = None, + alg: Incomplete | None = None, + ) -> None: ... + def sign(self, auth, token_endpoint): ... + def __call__(self, auth, method, uri, headers, body): ... + +class PrivateKeyJWT(ClientSecretJWT): + name: str + alg: str + def sign(self, auth, token_endpoint): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/client.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/client.pyi new file mode 100644 index 000000000000..7e5d18b6c823 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/client.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete + +ASSERTION_TYPE: str + +class JWTBearerClientAssertion: + CLIENT_ASSERTION_TYPE = ASSERTION_TYPE + CLIENT_AUTH_METHOD: str + token_url: Incomplete + def __init__(self, token_url, validate_jti: bool = True) -> None: ... + def __call__(self, query_client, request): ... + def create_claims_options(self): ... + def process_assertion_claims(self, assertion, resolve_key): ... + def authenticate_client(self, client): ... + def create_resolve_key_func(self, query_client, request): ... + def validate_jti(self, claims, jti) -> None: ... + def resolve_client_public_key(self, client, headers) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/jwt_bearer.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/jwt_bearer.pyi new file mode 100644 index 000000000000..b78a2f639904 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/jwt_bearer.pyi @@ -0,0 +1,28 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc6749 import BaseGrant, TokenEndpointMixin + +JWT_BEARER_GRANT_TYPE: str + +class JWTBearerGrant(BaseGrant, TokenEndpointMixin): + GRANT_TYPE = JWT_BEARER_GRANT_TYPE + CLAIMS_OPTIONS: Incomplete + @staticmethod + def sign( + key, + issuer, + audience, + subject: Incomplete | None = None, + issued_at: Incomplete | None = None, + expires_at: Incomplete | None = None, + claims: Incomplete | None = None, + **kwargs, + ): ... + def process_assertion_claims(self, assertion): ... + def resolve_public_key(self, headers, payload): ... + def validate_token_request(self) -> None: ... + def create_token_response(self): ... + def resolve_issuer_client(self, issuer) -> None: ... + def resolve_client_key(self, client, headers, payload) -> None: ... + def authenticate_user(self, subject) -> None: ... + def has_granted_permission(self, client, user) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/token.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/token.pyi new file mode 100644 index 000000000000..d505d608fb82 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/token.pyi @@ -0,0 +1,30 @@ +from _typeshed import Incomplete + +class JWTBearerTokenGenerator: + DEFAULT_EXPIRES_IN: int + secret_key: Incomplete + issuer: Incomplete + alg: Incomplete + def __init__(self, secret_key, issuer: Incomplete | None = None, alg: str = "RS256") -> None: ... + @staticmethod + def get_allowed_scope(client, scope): ... + @staticmethod + def get_sub_value(user): ... + def get_token_data(self, grant_type, client, expires_in, user: Incomplete | None = None, scope: Incomplete | None = None): ... + def generate( + self, + grant_type, + client, + user: Incomplete | None = None, + scope: Incomplete | None = None, + expires_in: Incomplete | None = None, + ): ... + def __call__( + self, + grant_type, + client, + user: Incomplete | None = None, + scope: Incomplete | None = None, + expires_in: Incomplete | None = None, + include_refresh_token: bool = True, + ): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/validator.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/validator.pyi new file mode 100644 index 000000000000..561b7219b59e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7523/validator.pyi @@ -0,0 +1,24 @@ +from _typeshed import Incomplete + +from authlib.jose import JWTClaims +from authlib.oauth2.rfc6749 import TokenMixin +from authlib.oauth2.rfc6750 import BearerTokenValidator + +logger: Incomplete + +class JWTBearerToken(TokenMixin, JWTClaims): + def check_client(self, client): ... + def get_scope(self): ... + def get_expires_in(self): ... + def is_expired(self): ... + def is_revoked(self): ... + +class JWTBearerTokenValidator(BearerTokenValidator): + TOKEN_TYPE: str + token_cls = JWTBearerToken + public_key: Incomplete + claims_options: Incomplete + def __init__( + self, public_key, issuer: Incomplete | None = None, realm: Incomplete | None = None, **extra_attributes + ) -> None: ... + def authenticate_token(self, token_string): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/__init__.pyi new file mode 100644 index 000000000000..5cd9f6b3ac5a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/__init__.pyi @@ -0,0 +1,17 @@ +from .claims import ClientMetadataClaims as ClientMetadataClaims +from .endpoint import ClientRegistrationEndpoint as ClientRegistrationEndpoint +from .errors import ( + InvalidClientMetadataError as InvalidClientMetadataError, + InvalidRedirectURIError as InvalidRedirectURIError, + InvalidSoftwareStatementError as InvalidSoftwareStatementError, + UnapprovedSoftwareStatementError as UnapprovedSoftwareStatementError, +) + +__all__ = [ + "ClientMetadataClaims", + "ClientRegistrationEndpoint", + "InvalidRedirectURIError", + "InvalidClientMetadataError", + "InvalidSoftwareStatementError", + "UnapprovedSoftwareStatementError", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/claims.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/claims.pyi new file mode 100644 index 000000000000..8145438834dd --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/claims.pyi @@ -0,0 +1,22 @@ +from _typeshed import Incomplete + +from authlib.jose import BaseClaims + +class ClientMetadataClaims(BaseClaims): + REGISTERED_CLAIMS: Incomplete + def validate(self) -> None: ... + def validate_redirect_uris(self) -> None: ... + def validate_token_endpoint_auth_method(self) -> None: ... + def validate_grant_types(self) -> None: ... + def validate_response_types(self) -> None: ... + def validate_client_name(self) -> None: ... + def validate_client_uri(self) -> None: ... + def validate_logo_uri(self) -> None: ... + def validate_scope(self) -> None: ... + def validate_contacts(self) -> None: ... + def validate_tos_uri(self) -> None: ... + def validate_policy_uri(self) -> None: ... + def validate_jwks_uri(self) -> None: ... + def validate_jwks(self) -> None: ... + def validate_software_id(self) -> None: ... + def validate_software_version(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/endpoint.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/endpoint.pyi new file mode 100644 index 000000000000..36e0bf6a2c70 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/endpoint.pyi @@ -0,0 +1,24 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc7591 import ClientMetadataClaims + +class ClientRegistrationEndpoint: + ENDPOINT_NAME: str + claims_class = ClientMetadataClaims + software_statement_alg_values_supported: Incomplete + server: Incomplete + def __init__(self, server) -> None: ... + def __call__(self, request): ... + def create_registration_response(self, request): ... + def extract_client_metadata(self, request): ... + def extract_software_statement(self, software_statement, request): ... + def get_claims_options(self): ... + def generate_client_info(self): ... + def generate_client_registration_info(self, client, request) -> None: ... + def create_endpoint_request(self, request): ... + def generate_client_id(self): ... + def generate_client_secret(self): ... + def get_server_metadata(self) -> None: ... + def authenticate_token(self, request) -> None: ... + def resolve_public_key(self, request) -> None: ... + def save_client(self, client_info, client_metadata, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/errors.pyi new file mode 100644 index 000000000000..7229ef4e6ede --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7591/errors.pyi @@ -0,0 +1,13 @@ +from authlib.oauth2 import OAuth2Error + +class InvalidRedirectURIError(OAuth2Error): + error: str + +class InvalidClientMetadataError(OAuth2Error): + error: str + +class InvalidSoftwareStatementError(OAuth2Error): + error: str + +class UnapprovedSoftwareStatementError(OAuth2Error): + error: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7592/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7592/__init__.pyi new file mode 100644 index 000000000000..e4ff814ea64e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7592/__init__.pyi @@ -0,0 +1,3 @@ +from .endpoint import ClientConfigurationEndpoint as ClientConfigurationEndpoint + +__all__ = ["ClientConfigurationEndpoint"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7592/endpoint.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7592/endpoint.pyi new file mode 100644 index 000000000000..e5cf2ac32311 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7592/endpoint.pyi @@ -0,0 +1,26 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc7591 import ClientMetadataClaims + +class ClientConfigurationEndpoint: + ENDPOINT_NAME: str + claims_class = ClientMetadataClaims + server: Incomplete + def __init__(self, server) -> None: ... + def __call__(self, request): ... + def create_configuration_response(self, request): ... + def create_endpoint_request(self, request): ... + def create_read_client_response(self, client, request): ... + def create_delete_client_response(self, client, request): ... + def create_update_client_response(self, client, request): ... + def extract_client_metadata(self, request): ... + def get_claims_options(self): ... + def introspect_client(self, client): ... + def generate_client_registration_info(self, client, request) -> None: ... + def authenticate_token(self, request) -> None: ... + def authenticate_client(self, request) -> None: ... + def revoke_access_token(self, token, request) -> None: ... + def check_permission(self, client, request) -> None: ... + def delete_client(self, client, request) -> None: ... + def update_client(self, client, client_metadata, request) -> None: ... + def get_server_metadata(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7636/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7636/__init__.pyi new file mode 100644 index 000000000000..18a2be1b0e43 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7636/__init__.pyi @@ -0,0 +1,3 @@ +from .challenge import CodeChallenge as CodeChallenge, create_s256_code_challenge as create_s256_code_challenge + +__all__ = ["CodeChallenge", "create_s256_code_challenge"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7636/challenge.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7636/challenge.pyi new file mode 100644 index 000000000000..71b92213b6a2 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7636/challenge.pyi @@ -0,0 +1,20 @@ +from _typeshed import Incomplete + +CODE_VERIFIER_PATTERN: Incomplete +CODE_CHALLENGE_PATTERN: Incomplete + +def create_s256_code_challenge(code_verifier): ... +def compare_plain_code_challenge(code_verifier, code_challenge): ... +def compare_s256_code_challenge(code_verifier, code_challenge): ... + +class CodeChallenge: + DEFAULT_CODE_CHALLENGE_METHOD: str + SUPPORTED_CODE_CHALLENGE_METHOD: Incomplete + CODE_CHALLENGE_METHODS: Incomplete + required: Incomplete + def __init__(self, required: bool = True) -> None: ... + def __call__(self, grant) -> None: ... + def validate_code_challenge(self, grant) -> None: ... + def validate_code_verifier(self, grant) -> None: ... + def get_authorization_code_challenge(self, authorization_code): ... + def get_authorization_code_challenge_method(self, authorization_code): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/__init__.pyi new file mode 100644 index 000000000000..8b48b0ce9476 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/__init__.pyi @@ -0,0 +1,5 @@ +from .introspection import IntrospectionEndpoint as IntrospectionEndpoint +from .models import IntrospectionToken as IntrospectionToken +from .token_validator import IntrospectTokenValidator as IntrospectTokenValidator + +__all__ = ["IntrospectionEndpoint", "IntrospectionToken", "IntrospectTokenValidator"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/introspection.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/introspection.pyi new file mode 100644 index 000000000000..56766e27be11 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/introspection.pyi @@ -0,0 +1,11 @@ +from authlib.oauth2.rfc6749 import TokenEndpoint + +class IntrospectionEndpoint(TokenEndpoint): + ENDPOINT_NAME: str + def authenticate_token(self, request, client): ... + def check_params(self, request, client) -> None: ... + def create_endpoint_response(self, request): ... + def create_introspection_payload(self, token): ... + def check_permission(self, token, client, request) -> None: ... + def query_token(self, token_string, token_type_hint) -> None: ... + def introspect_token(self, token) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/models.pyi new file mode 100644 index 000000000000..bb583baaa4f4 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/models.pyi @@ -0,0 +1,8 @@ +from authlib.oauth2.rfc6749 import TokenMixin + +class IntrospectionToken(dict[str, object], TokenMixin): + def get_client_id(self): ... + def get_scope(self): ... + def get_expires_in(self): ... + def get_expires_at(self): ... + def __getattr__(self, key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/token_validator.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/token_validator.pyi new file mode 100644 index 000000000000..897e7ec54881 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc7662/token_validator.pyi @@ -0,0 +1,7 @@ +from authlib.oauth2.rfc6749 import TokenValidator + +class IntrospectTokenValidator(TokenValidator): + TOKEN_TYPE: str + def introspect_token(self, token_string) -> None: ... + def authenticate_token(self, token_string): ... + def validate_token(self, token, scopes, request) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/__init__.pyi new file mode 100644 index 000000000000..b7b5b3a03967 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/__init__.pyi @@ -0,0 +1,4 @@ +from .models import AuthorizationServerMetadata as AuthorizationServerMetadata +from .well_known import get_well_known_url as get_well_known_url + +__all__ = ["AuthorizationServerMetadata", "get_well_known_url"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/models.pyi new file mode 100644 index 000000000000..2c3b593ae2ca --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/models.pyi @@ -0,0 +1,40 @@ +from _typeshed import Incomplete + +class AuthorizationServerMetadata(dict[str, object]): + REGISTRY_KEYS: Incomplete + def validate_issuer(self) -> None: ... + def validate_authorization_endpoint(self) -> None: ... + def validate_token_endpoint(self) -> None: ... + def validate_jwks_uri(self) -> None: ... + def validate_registration_endpoint(self) -> None: ... + def validate_scopes_supported(self) -> None: ... + def validate_response_types_supported(self) -> None: ... + def validate_response_modes_supported(self) -> None: ... + def validate_grant_types_supported(self) -> None: ... + def validate_token_endpoint_auth_methods_supported(self) -> None: ... + def validate_token_endpoint_auth_signing_alg_values_supported(self) -> None: ... + def validate_service_documentation(self) -> None: ... + def validate_ui_locales_supported(self) -> None: ... + def validate_op_policy_uri(self) -> None: ... + def validate_op_tos_uri(self) -> None: ... + def validate_revocation_endpoint(self) -> None: ... + def validate_revocation_endpoint_auth_methods_supported(self) -> None: ... + def validate_revocation_endpoint_auth_signing_alg_values_supported(self) -> None: ... + def validate_introspection_endpoint(self) -> None: ... + def validate_introspection_endpoint_auth_methods_supported(self) -> None: ... + def validate_introspection_endpoint_auth_signing_alg_values_supported(self) -> None: ... + def validate_code_challenge_methods_supported(self) -> None: ... + @property + def response_modes_supported(self): ... + @property + def grant_types_supported(self): ... + @property + def token_endpoint_auth_methods_supported(self): ... + @property + def revocation_endpoint_auth_methods_supported(self): ... + @property + def introspection_endpoint_auth_methods_supported(self): ... + def validate(self) -> None: ... + def __getattr__(self, key): ... + +def validate_array_value(metadata, key) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/well_known.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/well_known.pyi new file mode 100644 index 000000000000..9289f0d478bf --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8414/well_known.pyi @@ -0,0 +1 @@ +def get_well_known_url(issuer, external: bool = False, suffix: str = "oauth-authorization-server"): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/__init__.pyi new file mode 100644 index 000000000000..669437e26bb9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/__init__.pyi @@ -0,0 +1,19 @@ +from .device_code import DEVICE_CODE_GRANT_TYPE as DEVICE_CODE_GRANT_TYPE, DeviceCodeGrant as DeviceCodeGrant +from .endpoint import DeviceAuthorizationEndpoint as DeviceAuthorizationEndpoint +from .errors import ( + AuthorizationPendingError as AuthorizationPendingError, + ExpiredTokenError as ExpiredTokenError, + SlowDownError as SlowDownError, +) +from .models import DeviceCredentialDict as DeviceCredentialDict, DeviceCredentialMixin as DeviceCredentialMixin + +__all__ = [ + "DeviceAuthorizationEndpoint", + "DeviceCodeGrant", + "DEVICE_CODE_GRANT_TYPE", + "DeviceCredentialMixin", + "DeviceCredentialDict", + "AuthorizationPendingError", + "SlowDownError", + "ExpiredTokenError", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/device_code.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/device_code.pyi new file mode 100644 index 000000000000..931b40dd3f1f --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/device_code.pyi @@ -0,0 +1,15 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc6749 import BaseGrant, TokenEndpointMixin + +DEVICE_CODE_GRANT_TYPE: str + +class DeviceCodeGrant(BaseGrant, TokenEndpointMixin): + GRANT_TYPE = DEVICE_CODE_GRANT_TYPE + TOKEN_ENDPOINT_AUTH_METHODS: Incomplete + def validate_token_request(self) -> None: ... + def create_token_response(self): ... + def validate_device_credential(self, credential): ... + def query_device_credential(self, device_code) -> None: ... + def query_user_grant(self, user_code) -> None: ... + def should_slow_down(self, credential) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/endpoint.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/endpoint.pyi new file mode 100644 index 000000000000..5d0718e54846 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/endpoint.pyi @@ -0,0 +1,21 @@ +from _typeshed import Incomplete + +class DeviceAuthorizationEndpoint: + ENDPOINT_NAME: str + CLIENT_AUTH_METHODS: Incomplete + USER_CODE_TYPE: str + EXPIRES_IN: int + INTERVAL: int + server: Incomplete + def __init__(self, server) -> None: ... + def __call__(self, request): ... + def create_endpoint_request(self, request): ... + def authenticate_client(self, request): ... + def create_endpoint_response(self, request): ... + def generate_user_code(self): ... + def generate_device_code(self): ... + def get_verification_uri(self) -> None: ... + def save_device_credential(self, client_id, scope, data) -> None: ... + +def create_string_user_code(): ... +def create_digital_user_code(): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/errors.pyi new file mode 100644 index 000000000000..dc3803877039 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/errors.pyi @@ -0,0 +1,10 @@ +from authlib.oauth2 import OAuth2Error + +class AuthorizationPendingError(OAuth2Error): + error: str + +class SlowDownError(OAuth2Error): + error: str + +class ExpiredTokenError(OAuth2Error): + error: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/models.pyi new file mode 100644 index 000000000000..7da0cca1e106 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8628/models.pyi @@ -0,0 +1,13 @@ +class DeviceCredentialMixin: + def get_client_id(self) -> None: ... + def get_scope(self) -> None: ... + def get_user_code(self) -> None: ... + def is_expired(self) -> None: ... + +class DeviceCredentialDict(dict[str, object], DeviceCredentialMixin): + def get_client_id(self): ... + def get_scope(self): ... + def get_user_code(self): ... + def get_nonce(self): ... + def get_auth_time(self): ... + def is_expired(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8693/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc8693/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/__init__.pyi new file mode 100644 index 000000000000..f8a3418f836d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/__init__.pyi @@ -0,0 +1,6 @@ +from .introspection import JWTIntrospectionEndpoint as JWTIntrospectionEndpoint +from .revocation import JWTRevocationEndpoint as JWTRevocationEndpoint +from .token import JWTBearerTokenGenerator as JWTBearerTokenGenerator +from .token_validator import JWTBearerTokenValidator as JWTBearerTokenValidator + +__all__ = ["JWTBearerTokenGenerator", "JWTBearerTokenValidator", "JWTIntrospectionEndpoint", "JWTRevocationEndpoint"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/claims.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/claims.pyi new file mode 100644 index 000000000000..405ba4c103e9 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/claims.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete + +from authlib.jose import JWTClaims + +class JWTAccessTokenClaims(JWTClaims): + REGISTERED_CLAIMS: Incomplete + def validate(self, now: Incomplete | None = None, leeway: int = 0, **kwargs) -> None: ... + def validate_typ(self) -> None: ... + def validate_client_id(self): ... + def validate_auth_time(self) -> None: ... + def validate_acr(self): ... + def validate_amr(self) -> None: ... + def validate_scope(self): ... + def validate_groups(self): ... + def validate_roles(self): ... + def validate_entitlements(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/introspection.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/introspection.pyi new file mode 100644 index 000000000000..01b9140d6a18 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/introspection.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc7662 import IntrospectionEndpoint + +class JWTIntrospectionEndpoint(IntrospectionEndpoint): + ENDPOINT_NAME: str + issuer: Incomplete + def __init__(self, issuer, server: Incomplete | None = None, *args, **kwargs) -> None: ... + def create_endpoint_response(self, request): ... + def authenticate_token(self, request, client): ... + def create_introspection_payload(self, token): ... + def get_jwks(self) -> None: ... + def get_username(self, user_id: str) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/revocation.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/revocation.pyi new file mode 100644 index 000000000000..263a06c72d2e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/revocation.pyi @@ -0,0 +1,9 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc7009 import RevocationEndpoint + +class JWTRevocationEndpoint(RevocationEndpoint): + issuer: Incomplete + def __init__(self, issuer, server: Incomplete | None = None, *args, **kwargs) -> None: ... + def authenticate_token(self, request, client) -> None: ... + def get_jwks(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/token.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/token.pyi new file mode 100644 index 000000000000..84e438df0b66 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/token.pyi @@ -0,0 +1,23 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc6750 import BearerTokenGenerator + +class JWTBearerTokenGenerator(BearerTokenGenerator): + issuer: Incomplete + alg: Incomplete + def __init__( + self, + issuer, + alg: str = "RS256", + refresh_token_generator: Incomplete | None = None, + expires_generator: Incomplete | None = None, + ) -> None: ... + def get_jwks(self) -> None: ... + def get_extra_claims(self, client, grant_type, user, scope): ... + def get_audiences(self, client, user, scope) -> str | list[str]: ... + def get_acr(self, user) -> str | None: ... + def get_auth_time(self, user) -> int | None: ... + def get_amr(self, user) -> list[str] | None: ... + def get_jti(self, client, grant_type, user, scope) -> str: ... + # Override seems safe, but mypy doesn't like that it's a callabe protocol in the base + def access_token_generator(self, client, grant_type, user, scope): ... # type: ignore[override] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/token_validator.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/token_validator.pyi new file mode 100644 index 000000000000..6b5a58f9ca81 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oauth2/rfc9068/token_validator.pyi @@ -0,0 +1,20 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc6750 import BearerTokenValidator + +class JWTBearerTokenValidator(BearerTokenValidator): + issuer: Incomplete + resource_server: Incomplete + def __init__(self, issuer, resource_server, *args, **kwargs) -> None: ... + def get_jwks(self) -> None: ... + def validate_iss(self, claims, iss: str) -> bool: ... + def authenticate_token(self, token_string): ... + def validate_token( + self, + token, + scopes, + request, + groups: Incomplete | None = None, + roles: Incomplete | None = None, + entitlements: Incomplete | None = None, + ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/__init__.pyi new file mode 100644 index 000000000000..00a6e700d31d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/__init__.pyi @@ -0,0 +1,29 @@ +from .claims import ( + CodeIDToken as CodeIDToken, + HybridIDToken as HybridIDToken, + IDToken as IDToken, + ImplicitIDToken as ImplicitIDToken, + UserInfo as UserInfo, + get_claim_cls_by_response_type as get_claim_cls_by_response_type, +) +from .grants import ( + OpenIDCode as OpenIDCode, + OpenIDHybridGrant as OpenIDHybridGrant, + OpenIDImplicitGrant as OpenIDImplicitGrant, + OpenIDToken as OpenIDToken, +) +from .models import AuthorizationCodeMixin as AuthorizationCodeMixin + +__all__ = [ + "AuthorizationCodeMixin", + "IDToken", + "CodeIDToken", + "ImplicitIDToken", + "HybridIDToken", + "UserInfo", + "get_claim_cls_by_response_type", + "OpenIDToken", + "OpenIDCode", + "OpenIDHybridGrant", + "OpenIDImplicitGrant", +] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/claims.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/claims.pyi new file mode 100644 index 000000000000..b4452f6d636d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/claims.pyi @@ -0,0 +1,37 @@ +from _typeshed import Incomplete + +from authlib.jose import JWTClaims + +__all__ = ["IDToken", "CodeIDToken", "ImplicitIDToken", "HybridIDToken", "UserInfo", "get_claim_cls_by_response_type"] + +class IDToken(JWTClaims): + ESSENTIAL_CLAIMS: Incomplete + def validate(self, now: Incomplete | None = None, leeway: int = 0) -> None: ... + def validate_auth_time(self) -> None: ... + def validate_nonce(self) -> None: ... + def validate_acr(self): ... + def validate_amr(self) -> None: ... + def validate_azp(self) -> None: ... + def validate_at_hash(self) -> None: ... + +class CodeIDToken(IDToken): + RESPONSE_TYPES: Incomplete + REGISTERED_CLAIMS: Incomplete + +class ImplicitIDToken(IDToken): + RESPONSE_TYPES: Incomplete + ESSENTIAL_CLAIMS: Incomplete + REGISTERED_CLAIMS: Incomplete + def validate_at_hash(self) -> None: ... + +class HybridIDToken(ImplicitIDToken): + RESPONSE_TYPES: Incomplete + REGISTERED_CLAIMS: Incomplete + def validate(self, now: Incomplete | None = None, leeway: int = 0) -> None: ... + def validate_c_hash(self) -> None: ... + +class UserInfo(dict[str, object]): + REGISTERED_CLAIMS: Incomplete + def __getattr__(self, key): ... + +def get_claim_cls_by_response_type(response_type): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/errors.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/errors.pyi new file mode 100644 index 000000000000..a7132d25fd7a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/errors.pyi @@ -0,0 +1,28 @@ +from authlib.oauth2 import OAuth2Error + +class InteractionRequiredError(OAuth2Error): + error: str + +class LoginRequiredError(OAuth2Error): + error: str + +class AccountSelectionRequiredError(OAuth2Error): + error: str + +class ConsentRequiredError(OAuth2Error): + error: str + +class InvalidRequestURIError(OAuth2Error): + error: str + +class InvalidRequestObjectError(OAuth2Error): + error: str + +class RequestNotSupportedError(OAuth2Error): + error: str + +class RequestURINotSupportedError(OAuth2Error): + error: str + +class RegistrationNotSupportedError(OAuth2Error): + error: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/__init__.pyi new file mode 100644 index 000000000000..d4bc9d9b42e7 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/__init__.pyi @@ -0,0 +1,5 @@ +from .code import OpenIDCode as OpenIDCode, OpenIDToken as OpenIDToken +from .hybrid import OpenIDHybridGrant as OpenIDHybridGrant +from .implicit import OpenIDImplicitGrant as OpenIDImplicitGrant + +__all__ = ["OpenIDToken", "OpenIDCode", "OpenIDImplicitGrant", "OpenIDHybridGrant"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/code.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/code.pyi new file mode 100644 index 000000000000..3ad0e20e3b80 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/code.pyi @@ -0,0 +1,17 @@ +from authlib.oauth2 import OAuth2Request +from authlib.oauth2.rfc6749 import BaseGrant +from authlib.oidc.core import UserInfo + +class OpenIDToken: + def get_jwt_config(self, grant: BaseGrant) -> dict[str, str | int]: ... + def generate_user_info(self, user, scope: str) -> UserInfo: ... + def get_audiences(self, request: OAuth2Request) -> list[str]: ... + def process_token(self, grant: BaseGrant, token: dict[str, str | int]) -> dict[str, str | int]: ... + def __call__(self, grant: BaseGrant) -> None: ... + +class OpenIDCode(OpenIDToken): + require_nonce: bool + def __init__(self, require_nonce: bool = False) -> None: ... + def exists_nonce(self, nonce: str, request: OAuth2Request) -> bool: ... + def validate_openid_authorization_request(self, grant: BaseGrant) -> None: ... + def __call__(self, grant: BaseGrant) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/hybrid.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/hybrid.pyi new file mode 100644 index 000000000000..c3a3a7b03def --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/hybrid.pyi @@ -0,0 +1,13 @@ +from _typeshed import Incomplete + +from authlib.oidc.core import OpenIDImplicitGrant + +class OpenIDHybridGrant(OpenIDImplicitGrant): + AUTHORIZATION_CODE_LENGTH: int + RESPONSE_TYPES: Incomplete + GRANT_TYPE: str + DEFAULT_RESPONSE_MODE: str + def generate_authorization_code(self): ... + def save_authorization_code(self, code, request) -> None: ... + def validate_authorization_request(self): ... + def create_granted_params(self, grant_user): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/implicit.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/implicit.pyi new file mode 100644 index 000000000000..cc0e4dec23d4 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/implicit.pyi @@ -0,0 +1,16 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc6749 import ImplicitGrant + +class OpenIDImplicitGrant(ImplicitGrant): + RESPONSE_TYPES: Incomplete + DEFAULT_RESPONSE_MODE: str + def exists_nonce(self, nonce, request) -> None: ... + def get_jwt_config(self) -> None: ... + def generate_user_info(self, user, scope) -> None: ... + def get_audiences(self, request): ... + def validate_authorization_request(self): ... + def validate_consent_request(self) -> None: ... + def create_authorization_response(self, redirect_uri, grant_user): ... + def create_granted_params(self, grant_user): ... + def process_implicit_token(self, token, code: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/util.pyi new file mode 100644 index 000000000000..d93f15590e43 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/grants/util.pyi @@ -0,0 +1,18 @@ +from authlib.oidc.core import UserInfo + +def is_openid_scope(scope: str | None) -> bool: ... +def validate_request_prompt(grant, redirect_uri, redirect_fragment: bool = False): ... +def validate_nonce(request, exists_nonce, required: bool = False): ... +def generate_id_token( + token: dict[str, str | int], + user_info: UserInfo, + key: str, + iss: str, + aud: list[str], + alg: str = "RS256", + exp: int = 3600, + nonce: str | None = None, + auth_time: int | None = None, + code: str | None = None, +) -> str: ... +def create_response_mode_response(redirect_uri, params, response_mode): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/models.pyi new file mode 100644 index 000000000000..f081a20b9e44 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/models.pyi @@ -0,0 +1,5 @@ +from authlib.oauth2.rfc6749 import AuthorizationCodeMixin as _AuthorizationCodeMixin + +class AuthorizationCodeMixin(_AuthorizationCodeMixin): + def get_nonce(self) -> str | None: ... + def get_auth_time(self) -> int | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/util.pyi new file mode 100644 index 000000000000..542c8c7a316b --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/core/util.pyi @@ -0,0 +1 @@ +def create_half_hash(s: str, alg: str) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/__init__.pyi new file mode 100644 index 000000000000..84d76b371134 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/__init__.pyi @@ -0,0 +1,4 @@ +from .models import OpenIDProviderMetadata as OpenIDProviderMetadata +from .well_known import get_well_known_url as get_well_known_url + +__all__ = ["OpenIDProviderMetadata", "get_well_known_url"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/models.pyi new file mode 100644 index 000000000000..5891822ec366 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/models.pyi @@ -0,0 +1,36 @@ +from _typeshed import Incomplete + +from authlib.oauth2.rfc8414 import AuthorizationServerMetadata + +class OpenIDProviderMetadata(AuthorizationServerMetadata): + REGISTRY_KEYS: Incomplete + def validate_jwks_uri(self): ... + def validate_acr_values_supported(self) -> None: ... + def validate_subject_types_supported(self) -> None: ... + def validate_id_token_signing_alg_values_supported(self) -> None: ... + def validate_id_token_encryption_alg_values_supported(self) -> None: ... + def validate_id_token_encryption_enc_values_supported(self) -> None: ... + def validate_userinfo_signing_alg_values_supported(self) -> None: ... + def validate_userinfo_encryption_alg_values_supported(self) -> None: ... + def validate_userinfo_encryption_enc_values_supported(self) -> None: ... + def validate_request_object_signing_alg_values_supported(self) -> None: ... + def validate_request_object_encryption_alg_values_supported(self) -> None: ... + def validate_request_object_encryption_enc_values_supported(self) -> None: ... + def validate_display_values_supported(self) -> None: ... + def validate_claim_types_supported(self) -> None: ... + def validate_claims_supported(self) -> None: ... + def validate_claims_locales_supported(self) -> None: ... + def validate_claims_parameter_supported(self) -> None: ... + def validate_request_parameter_supported(self) -> None: ... + def validate_request_uri_parameter_supported(self) -> None: ... + def validate_require_request_uri_registration(self) -> None: ... + @property + def claim_types_supported(self): ... + @property + def claims_parameter_supported(self): ... + @property + def request_parameter_supported(self): ... + @property + def request_uri_parameter_supported(self): ... + @property + def require_request_uri_registration(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/well_known.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/well_known.pyi new file mode 100644 index 000000000000..3a294ec4314f --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/Authlib/authlib/oidc/discovery/well_known.pyi @@ -0,0 +1 @@ +def get_well_known_url(issuer, external: bool = False): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/METADATA.toml index be7b27d0a509..6c2b99083ced 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/METADATA.toml @@ -1,4 +1,4 @@ -version = "4.0.*" +version = "4.1.*" upstream_repository = "https://github.com/miguelgrinberg/Flask-Migrate" # Requires versions of flask and Flask-SQLAlchemy with `py.typed` files requires = ["Flask-SQLAlchemy>=3.0.1", "Flask>=2.0.0"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/flask_migrate/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/flask_migrate/__init__.pyi index a83f7f783b69..4d7664402c46 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/flask_migrate/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/Flask-Migrate/flask_migrate/__init__.pyi @@ -1,7 +1,7 @@ # pyright: reportInvalidStubStatement=none import sys -from _typeshed import StrPath, SupportsKeysAndGetItem, SupportsWrite +from _typeshed import StrPath, SupportsFlush, SupportsKeysAndGetItem, SupportsWrite from argparse import Namespace from collections.abc import Callable, Iterable, Sequence from logging import Logger @@ -20,9 +20,7 @@ _AlembicConfigValue: TypeAlias = Any alembic_version: tuple[int, int, int] log: Logger -# TODO: Use _typeshed.SupportsFlush when it's available in type checkers. -class _SupportsWriteAndFlush(SupportsWrite[_T_contra], Protocol): - def flush(self) -> object: ... +class _SupportsWriteAndFlush(SupportsWrite[_T_contra], SupportsFlush, Protocol): ... class Config: # should inherit from alembic.config.Config which is not possible yet template_directory: str | None diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/METADATA.toml index ac5b6febe117..658dde445b55 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/METADATA.toml @@ -1,3 +1,3 @@ -version = "5.4.*" +version = "5.5.*" requires = ["Flask>=0.9"] upstream_repository = "https://github.com/miguelgrinberg/flask-socketio" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/flask_socketio/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/flask_socketio/__init__.pyi index 68fdd4cf9583..1b20806fda6c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/flask_socketio/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/Flask-SocketIO/flask_socketio/__init__.pyi @@ -1,8 +1,9 @@ from _typeshed import Incomplete from collections.abc import Callable +from logging import Logger from threading import Thread -from typing import Any, Protocol, TypeVar, overload -from typing_extensions import ParamSpec, TypeAlias +from typing import Any, Literal, Protocol, TypedDict, TypeVar, overload +from typing_extensions import ParamSpec, TypeAlias, Unpack from flask import Flask from flask.testing import FlaskClient @@ -21,7 +22,32 @@ class _HandlerDecorator(Protocol): class _ExceptionHandlerDecorator(Protocol): def __call__(self, exception_handler: _ExceptionHandler[_R_co]) -> _ExceptionHandler[_R_co]: ... +class _SocketIOServerOptions(TypedDict, total=False): + client_manager: Incomplete + logger: Logger | bool + json: Incomplete + async_handlers: bool + always_connect: bool + +class _EngineIOServerConfig(TypedDict, total=False): + async_mode: Literal["threading", "eventlet", "gevent", "gevent_uwsgi"] + ping_interval: float | tuple[float, float] # seconds + ping_timeout: float # seconds + max_http_buffer_size: int + allow_upgrades: bool + http_compression: bool + compression_threshold: int + cookie: str | dict[str, Any] | None + cors_allowed_origins: str | list[str] + cors_credentials: bool + monitor_clients: bool + engineio_logger: Logger | bool + +class _SocketIOKwargs(_SocketIOServerOptions, _EngineIOServerConfig): ... + class SocketIO: + # This is an alias for `socketio.Server.reason` in `python-socketio`, which is not typed. + reason: Incomplete # Many instance attributes are deliberately not included here, # as the maintainer of Flask-SocketIO considers them private, internal details: # https://github.com/python/typeshed/pull/10735#discussion_r1330768869 @@ -35,7 +61,7 @@ class SocketIO: channel: str = "flask-socketio", path: str = "socket.io", resource: str = "socket.io", - **kwargs, # TODO: Socket.IO server options, Engine.IO server config + **kwargs: Unpack[_SocketIOKwargs], ) -> None: ... def init_app( self, @@ -47,7 +73,7 @@ class SocketIO: channel: str = "flask-socketio", path: str = "socket.io", resource: str = "socket.io", - **kwargs, # TODO: Socket.IO server options, Engine.IO server config: ... + **kwargs: Unpack[_SocketIOKwargs], ) -> None: ... def on(self, message: str, namespace: str | None = None) -> _HandlerDecorator: ... def on_error(self, namespace: str | None = None) -> _ExceptionHandlerDecorator: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Markdown/markdown/core.pyi b/packages/pyright-internal/typeshed-fallback/stubs/Markdown/markdown/core.pyi index cc0cb34ce5a1..48d3bac6dd1c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Markdown/markdown/core.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/Markdown/markdown/core.pyi @@ -1,5 +1,6 @@ +from codecs import _ReadableStream, _WritableStream from collections.abc import Callable, Mapping, Sequence -from typing import Any, ClassVar, Literal, Protocol +from typing import Any, ClassVar, Literal from typing_extensions import Self from xml.etree.ElementTree import Element @@ -7,18 +8,6 @@ from . import blockparser, inlinepatterns, postprocessors, preprocessors, treepr from .extensions import Extension from .util import HtmlStash, Registry -# TODO: The following protocols can be replaced by their counterparts from -# codecs, once they have been propagated to all type checkers. -class _WritableStream(Protocol): - def write(self, data: bytes, /) -> object: ... - def seek(self, offset: int, whence: int, /) -> object: ... - def close(self) -> object: ... - -class _ReadableStream(Protocol): - def read(self, size: int = ..., /) -> bytes: ... - def seek(self, offset: int, whence: int, /) -> object: ... - def close(self) -> object: ... - class Markdown: preprocessors: Registry[preprocessors.Preprocessor] inlinePatterns: Registry[inlinepatterns.Pattern] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/PyAutoGUI/pyautogui/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/PyAutoGUI/pyautogui/__init__.pyi index 7b868e4caa1d..08bb2b7b9529 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/PyAutoGUI/pyautogui/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/PyAutoGUI/pyautogui/__init__.pyi @@ -60,8 +60,8 @@ def useImageNotFoundException(value: bool | None = None) -> None: ... def isShiftCharacter(character: str) -> bool: ... class Point(NamedTuple): - x: float - y: float + x: int + y: int class Size(NamedTuple): width: int diff --git a/packages/pyright-internal/typeshed-fallback/stubs/PyYAML/yaml/constructor.pyi b/packages/pyright-internal/typeshed-fallback/stubs/PyYAML/yaml/constructor.pyi index 7342690789c5..14aeb646f68a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/PyYAML/yaml/constructor.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/PyYAML/yaml/constructor.pyi @@ -39,7 +39,7 @@ class BaseConstructor: def add_multi_constructor(cls, tag_prefix, multi_constructor): ... class SafeConstructor(BaseConstructor): - def construct_scalar(self, node: ScalarNode) -> str: ... + def construct_scalar(self, node: ScalarNode | MappingNode) -> str: ... def flatten_mapping(self, node: MappingNode) -> None: ... def construct_mapping(self, node: MappingNode, deep: bool = False) -> dict[Hashable, Any]: ... def construct_yaml_null(self, node: ScalarNode) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/Pygments/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/Pygments/METADATA.toml index 9577e4460ca7..6d0e6326d02c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/Pygments/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/Pygments/METADATA.toml @@ -1,4 +1,4 @@ -version = "2.18.*" +version = "2.19.*" upstream_repository = "https://github.com/pygments/pygments" requires = ["types-docutils", "types-setuptools"] partial_stub = true diff --git a/packages/pyright-internal/typeshed-fallback/stubs/WebOb/webob/exc.pyi b/packages/pyright-internal/typeshed-fallback/stubs/WebOb/webob/exc.pyi index e3f9e4b36810..5316b33cb081 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/WebOb/webob/exc.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/WebOb/webob/exc.pyi @@ -123,4 +123,4 @@ class HTTPExceptionMiddleware: def __init__(self, application: WSGIApplication) -> None: ... def __call__(self, environ: WSGIEnvironment, start_response: StartResponse) -> Iterable[bytes]: ... -status_map: dict[int, WSGIHTTPException] +status_map: dict[int, type[WSGIHTTPException]] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-log/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/click-log/METADATA.toml new file mode 100644 index 000000000000..c1548cdc2f5b --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-log/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.4.*" +requires = ["click>=8.0.0"] +upstream_repository = "https://github.com/click-contrib/click-log" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/__init__.pyi new file mode 100644 index 000000000000..b3d38f6720c0 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/__init__.pyi @@ -0,0 +1,4 @@ +from .core import ClickHandler as ClickHandler, ColorFormatter as ColorFormatter, basic_config as basic_config +from .options import simple_verbosity_option as simple_verbosity_option + +__version__: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/core.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/core.pyi new file mode 100644 index 000000000000..8ee5d99e3596 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/core.pyi @@ -0,0 +1,15 @@ +import logging + +LOGGER_KEY: str +DEFAULT_LEVEL: int +PY2: bool +text_type: type + +class ColorFormatter(logging.Formatter): + colors: dict[str, dict[str, str]] + def format(self, record: logging.LogRecord) -> str: ... + +class ClickHandler(logging.Handler): + def emit(self, record: logging.LogRecord) -> None: ... + +def basic_config(logger: logging.Logger | str | None = None) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/options.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/options.pyi new file mode 100644 index 000000000000..e1310ab8ea44 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-log/click_log/options.pyi @@ -0,0 +1,12 @@ +import logging +import typing as t +from typing_extensions import TypeAlias + +import click + +_AnyCallable: TypeAlias = t.Callable[..., t.Any] +_FC = t.TypeVar("_FC", bound=_AnyCallable | click.Command) + +def simple_verbosity_option( + logger: logging.Logger | str | None = None, *names: str, **kwargs: t.Any +) -> t.Callable[[_FC], _FC]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/click-web/METADATA.toml new file mode 100644 index 000000000000..1f42748d42a5 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/METADATA.toml @@ -0,0 +1,3 @@ +version = "0.8.*" +requires = ["click>=8.0.0", "Flask>=2.3.2"] +upstream_repository = "https://github.com/fredrik-corneliusson/click-web" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/__init__.pyi new file mode 100644 index 000000000000..3761937200df --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/__init__.pyi @@ -0,0 +1,16 @@ +import logging +import types +from _typeshed import Incomplete + +import click +import flask + +# This should be jinja2.Environment, but it does not have stubs and forbidden for requires in METADATA.toml +jinja_env: Incomplete +script_file: str | None +click_root_cmd: str | None +OUTPUT_FOLDER: str +_flask_app: flask.Flask | None +logger: logging.Logger | None + +def create_click_web_app(module: types.ModuleType, command: click.BaseCommand, root: str = "/") -> flask.Flask: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/exceptions.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/exceptions.pyi new file mode 100644 index 000000000000..172a2026a871 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/exceptions.pyi @@ -0,0 +1,2 @@ +class ClickWebException(Exception): ... +class CommandNotFound(ClickWebException): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/cmd_exec.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/cmd_exec.pyi new file mode 100644 index 000000000000..1c616c6782b6 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/cmd_exec.pyi @@ -0,0 +1,79 @@ +import logging + +from flask import Response + +from .input_fields import FieldId + +logger: logging.Logger | None + +HTML_HEAD: str +HTML_TAIL: str + +class Executor: + RAW_CMD_PATH: str + + def __init__(self) -> None: ... + def exec(self, command_path: str) -> Response: ... + def _exec_raw(self, command: list[str]) -> Response: ... # undocumented + def _exec_html(self, command_path: str) -> Response: ... # undocumented + def _run_script_and_generate_stream(self) -> None: ... # undocumented + def _create_cmd_header(self, commands: list[CmdPart]) -> str: ... # undocumented + def _create_result_footer(self) -> str: ... # undocumented + +def _get_download_link(field_info: FieldFileInfo) -> str: ... # undocumented + +class CommandLineRaw: + def __init__(self, script_file_path: str, command: str) -> None: ... + def append(self, part: str, secret: bool = False) -> None: ... + def get_commandline(self, obfuscate: bool = False) -> list[str]: ... + def get_download_field_infos(self) -> list[FieldInfo]: ... + def after_script_executed(self) -> None: ... + +class CommandLineForm: + def __init__(self, script_file_path: str, commands: list[str]) -> None: ... + def append(self, part: str, secret: bool = False) -> None: ... + def get_commandline(self, obfuscate: bool = False) -> list[str]: ... + def get_download_field_infos(self) -> list[FieldInfo]: ... + def after_script_executed(self) -> None: ... + +def _get_python_interpreter() -> str: ... + +class CmdPart: + def __init__(self, part: str, secret: bool = False) -> None: ... + +class FormToCommandLineBuilder: + def __init__(self, command_line: CommandLineForm) -> None: ... + def add_command_args(self, command_index: int) -> None: ... + @staticmethod + def _is_option(cmd_option: str) -> bool: ... + def _process_option(self, field_info: FieldInfo) -> None: ... + +class FieldInfo: + @staticmethod + def factory(key: str) -> FieldInfo: ... + def __init__(self, param: FieldId) -> None: ... + def before_script_execute(self) -> None: ... + def after_script_executed(self) -> None: ... + def __lt__(self, other: object) -> bool: ... + def __eq__(self, other: object) -> bool: ... + +class FieldFileInfo(FieldInfo): + def __init__(self, fimeta: FieldId) -> None: ... + def before_script_execute(self) -> None: ... + @classmethod + def temp_dir(cls) -> str: ... + def save(self) -> None: ... + +class FieldOutFileInfo(FieldFileInfo): + def __init__(self, fimeta: FieldId) -> None: ... + def save(self) -> None: ... + +class FieldPathInfo(FieldFileInfo): + def save(self) -> None: ... + def after_script_executed(self) -> None: ... + +class FieldPathOutInfo(FieldOutFileInfo): + def save(self) -> None: ... + def after_script_executed(self) -> None: ... + +def zip_folder(folder_path: str, out_folder: str, out_prefix: str) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/cmd_form.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/cmd_form.pyi new file mode 100644 index 000000000000..fff80bd290ee --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/cmd_form.pyi @@ -0,0 +1,6 @@ +import click + +def get_form_for(command_path: str) -> str: ... +def _get_commands_by_path(command_path: str) -> list[tuple[click.Context, click.Command]]: ... +def _generate_form_data(ctx_and_commands: list[tuple[click.Context, click.Command]]): ... +def _process_help(help_text: bool) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/index.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/index.pyi new file mode 100644 index 000000000000..c932a5a7e7b0 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/index.pyi @@ -0,0 +1,6 @@ +from typing import Any + +import click + +def index() -> str: ... +def _click_to_tree(ctx: click.Context, node: click.Command, ancestors: list[click.Command] | None = None) -> dict[str, Any]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/input_fields.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/input_fields.pyi new file mode 100644 index 000000000000..65b3018982eb --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/resources/input_fields.pyi @@ -0,0 +1,49 @@ +from typing import Any + +import click + +class FieldId: + SEPARATOR: str + + def __init__( + self, + command_index: int, + param_index: int, + param_type: str, + click_type: str, + nargs: int, + form_type: str, + name: str, + key: str | None = None, + ): ... + @classmethod + def from_string(cls, field_info_as_string: str) -> FieldId: ... + +class NotSupported(ValueError): ... + +class BaseInput: + param_type_cls: type | None + def __init__(self, ctx: click.Context, param: click.Parameter, command_index: int, param_index: int) -> None: ... + def is_supported(self) -> bool: ... + @property + def fields(self) -> dict[str, Any]: ... + @property + def type_attrs(self) -> dict[str, Any]: ... + def _to_cmd_line_name(self, name: str) -> str: ... + def _build_name(self, name: str): ... + +class ChoiceInput(BaseInput): ... +class FlagInput(BaseInput): ... +class IntInput(BaseInput): ... +class FloatInput(BaseInput): ... +class FolderInput(BaseInput): ... +class FileInput(BaseInput): ... +class EmailInput(BaseInput): ... +class PasswordInput(BaseInput): ... +class TextAreaInput(BaseInput): ... +class DefaultInput(BaseInput): ... + +INPUT_TYPES: list[type] +_DEFAULT_INPUT: list[type] + +def get_input_field(ctx: click.Context, param: click.Parameter, command_index, param_index) -> dict[str, Any]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/web_click_types.pyi b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/web_click_types.pyi new file mode 100644 index 000000000000..1546f7e7d7d1 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/click-web/click_web/web_click_types.pyi @@ -0,0 +1,18 @@ +import re +import typing as t + +import click + +class EmailParamType(click.ParamType): + EMAIL_REGEX: re.Pattern[str] + def convert(self, value: t.Any, param: click.Parameter | None, ctx: click.Context | None) -> t.Any: ... + +class PasswordParamType(click.ParamType): + def convert(self, value: t.Any, param: click.Parameter | None, ctx: click.Context | None) -> t.Any: ... + +class TextAreaParamType(click.ParamType): + def convert(self, value: t.Any, param: click.Parameter | None, ctx: click.Context | None) -> t.Any: ... + +EMAIL_TYPE: EmailParamType +PASSWORD_TYPE: PasswordParamType +TEXTAREA_TYPE: TextAreaParamType diff --git a/packages/pyright-internal/typeshed-fallback/stubs/croniter/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/croniter/METADATA.toml index bbe361be9a13..238b0e38b807 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/croniter/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/croniter/METADATA.toml @@ -1,2 +1,2 @@ -version = "4.0.0" +version = "5.0.1" upstream_repository = "https://github.com/kiorky/croniter" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/croniter/croniter/croniter.pyi b/packages/pyright-internal/typeshed-fallback/stubs/croniter/croniter/croniter.pyi index 3f1da330f018..e92a633debeb 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/croniter/croniter/croniter.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/croniter/croniter/croniter.pyi @@ -162,6 +162,13 @@ class croniter(Iterator[Any]): def iter(self, ret_type: _RetType | None = ...) -> Iterator[Any]: ... def is_leap(self, year: int) -> bool: ... @classmethod + def value_alias( + cls, + val: int, + field: Literal[0, 1, 2, 3, 4, 5, 6], + len_expressions: int | list[Any] | dict[Any, Any] | tuple[Any, ...] | set[Any] = 5, + ) -> int: ... + @classmethod def expand( cls, expr_format: str, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/METADATA.toml new file mode 100644 index 000000000000..2f719571620a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/METADATA.toml @@ -0,0 +1,6 @@ +version = "3.3.*" +upstream_repository = "https://github.com/django-import-export/django-import-export" +requires = ["django-stubs"] # Add tablib when typed, and update _Incomplete aliases in stubs + +[tool.stubtest] +skip = true # Django requires configured settings at runtime diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/__init__.pyi new file mode 100644 index 000000000000..bda5b5a7f4cc --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/__init__.pyi @@ -0,0 +1 @@ +__version__: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/admin.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/admin.pyi new file mode 100644 index 000000000000..6578d569f8b8 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/admin.pyi @@ -0,0 +1,114 @@ +from _typeshed import Incomplete +from collections.abc import Callable +from logging import Logger +from typing import Any, TypeVar +from typing_extensions import TypeAlias, deprecated + +from django.contrib import admin +from django.contrib.admin.helpers import ActionForm +from django.core.files import File +from django.db.models import Model, QuerySet +from django.forms import Form, Media +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.template.response import TemplateResponse +from django.urls import URLPattern + +from .formats.base_formats import Format +from .mixins import BaseExportMixin, BaseImportMixin +from .results import Result +from .tmp_storages import BaseStorage + +Dataset: TypeAlias = Incomplete # tablib.Dataset +logger: Logger + +_ModelT = TypeVar("_ModelT", bound=Model) + +class ImportExportMixinBase: + base_change_list_template: str + change_list_template: str + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def init_change_list_template(self) -> None: ... + def get_model_info(self) -> tuple[str, str]: ... + def changelist_view(self, request: HttpRequest, extra_context: dict[str, Any] | None = None) -> HttpResponse: ... + +class ImportMixin(BaseImportMixin[_ModelT], ImportExportMixinBase): + import_export_change_list_template: str + import_template_name: str + import_form_class: type[Form] = ... + confirm_form_class: type[Form] = ... + from_encoding: str + skip_admin_log: bool | None + tmp_storage_class: str | type[BaseStorage] + def get_skip_admin_log(self) -> bool: ... + def get_tmp_storage_class(self) -> type[BaseStorage]: ... + def has_import_permission(self, request: HttpRequest) -> bool: ... + def get_urls(self) -> list[URLPattern]: ... + def process_import(self, request: HttpRequest, *args: Any, **kwargs: Any) -> HttpResponse: ... + def process_dataset( + self, + dataset: Dataset, + confirm_form: Form, + request: HttpRequest, + *args: Any, + rollback_on_validation_errors: bool = False, + **kwargs: Any, + ) -> Result: ... + def process_result(self, result: Result, request: HttpRequest) -> HttpResponse: ... + def generate_log_entries(self, result: Result, request: HttpRequest) -> None: ... + def add_success_message(self, result: Result, request: HttpRequest) -> None: ... + def get_import_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + @deprecated("Use get_import_form_class instead") + def get_import_form(self) -> type[Form]: ... + @deprecated("Use get_confirm_form_class instead") + def get_confirm_import_form(self) -> type[Form]: ... + @deprecated("Use get_import_form_kwargs or get_confirm_form_kwargs") + def get_form_kwargs(self, form: Form, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def create_import_form(self, request: HttpRequest) -> Form: ... + def get_import_form_class(self, request: HttpRequest) -> type[Form]: ... + def get_import_form_kwargs(self, request: HttpRequest) -> dict[str, Any]: ... + def get_import_form_initial(self, request: HttpRequest) -> dict[str, Any]: ... + def create_confirm_form(self, request: HttpRequest, import_form: Form | None = None) -> Form: ... + def get_confirm_form_class(self, request: HttpRequest) -> type[Form]: ... + def get_confirm_form_kwargs(self, request: HttpRequest, import_form: Form | None = None) -> dict[str, Any]: ... + def get_confirm_form_initial(self, request: HttpRequest, import_form: Form | None) -> dict[str, Any]: ... + def get_import_data_kwargs(self, request: HttpRequest, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def write_to_tmp_storage(self, import_file: File[bytes], input_format: Format) -> BaseStorage: ... + def add_data_read_fail_error_to_form(self, form: Form, e: Exception) -> None: ... + def import_action(self, request: HttpRequest, *args: Any, **kwargs: Any) -> TemplateResponse: ... + def changelist_view(self, request: HttpRequest, extra_context: dict[str, Any] | None = None) -> HttpResponse: ... + +class ExportMixin(BaseExportMixin[_ModelT], ImportExportMixinBase): + import_export_change_list_template: str | None + export_template_name: str + to_encoding: str | None + export_form_class: type[Form] = ... + def get_urls(self) -> list[URLPattern]: ... + def has_export_permission(self, request: HttpRequest) -> bool: ... + def get_export_queryset(self, request: HttpRequest) -> QuerySet[_ModelT]: ... + def get_export_data(self, file_format: Format, queryset: QuerySet[_ModelT], *args: Any, **kwargs: Any) -> str | bytes: ... + def get_export_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + @deprecated("Use get_export_form_class or use the export_form_class attribute") + def get_export_form(self) -> Form: ... + def get_export_form_class(self) -> type[Form]: ... + def export_action(self, request: HttpRequest, *args: Any, **kwargs: Any) -> TemplateResponse: ... + def changelist_view(self, request: HttpRequest, extra_context: dict[str, Any] | None = None) -> HttpResponse: ... + def get_export_filename(self, request: HttpRequest, queryset: QuerySet[_ModelT], file_format: Format) -> str: ... # type: ignore[override] + +class ImportExportMixin(ImportMixin[_ModelT], ExportMixin[_ModelT]): + import_export_change_list_template: str + +class ImportExportModelAdmin(ImportExportMixin[_ModelT], admin.ModelAdmin[_ModelT]): ... # type: ignore[misc] + +class ExportActionMixin(ExportMixin[_ModelT]): + action_form: type[ActionForm] + def __init__(self, *args: Any, **kwargs: Any) -> None: ... + def export_admin_action(self, request: HttpRequest, queryset: QuerySet[_ModelT]) -> HttpResponse: ... + def get_actions(self, request: HttpRequest) -> dict[str, tuple[Callable[..., str], str, str] | None]: ... + @property + def media(self) -> Media: ... + +class ExportActionModelAdmin(ExportActionMixin[_ModelT], admin.ModelAdmin[_ModelT]): ... # type: ignore[misc] +class ImportExportActionModelAdmin(ImportMixin[_ModelT], ExportActionModelAdmin[_ModelT]): ... # type: ignore[misc] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/exceptions.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/exceptions.pyi new file mode 100644 index 000000000000..f8a69dfbb6d4 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/exceptions.pyi @@ -0,0 +1,2 @@ +class ImportExportError(Exception): ... +class FieldError(ImportExportError): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/fields.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/fields.pyi new file mode 100644 index 000000000000..5520ffe6a517 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/fields.pyi @@ -0,0 +1,34 @@ +from collections.abc import Callable, Mapping +from typing import Any, ClassVar + +from django.db.models import Model +from django.db.models.fields import NOT_PROVIDED + +from .widgets import Widget + +class Field: + empty_values: ClassVar[list[str | None]] + attribute: str | None + default: type[NOT_PROVIDED] | Callable[[], Any] | Any + column_name: str | None + widget: Widget + readonly: bool + saves_null_values: bool + dehydrate_method: str + m2m_add: bool + def __init__( + self, + attribute: str | None = None, + column_name: str | None = None, + widget: Widget | None = None, + default: type[NOT_PROVIDED] | Callable[[], Any] | Any = ..., + readonly: bool = False, + saves_null_values: bool = True, + dehydrate_method: str | None = None, + m2m_add: bool = False, + ) -> None: ... + def clean(self, data: Mapping[str, Any], **kwargs: Any) -> Any: ... + def get_value(self, obj: Model) -> Any: ... + def save(self, obj: Model, data: Mapping[str, Any], is_m2m: bool = False, **kwargs: Any) -> None: ... + def export(self, obj: Model) -> str: ... + def get_dehydrate_method(self, field_name: str | None = None) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/formats/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/formats/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/formats/base_formats.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/formats/base_formats.pyi new file mode 100644 index 000000000000..fdc77740b4e3 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/formats/base_formats.pyi @@ -0,0 +1,57 @@ +from _typeshed import Incomplete, ReadableBuffer +from typing import IO, Any, ClassVar +from typing_extensions import Self, TypeAlias + +Dataset: TypeAlias = Incomplete # tablib.Dataset + +class Format: + def get_title(self) -> type[Self]: ... + def create_dataset(self, in_stream: str | bytes | IO[Any]) -> Dataset: ... + def export_data(self, dataset: Dataset, **kwargs: Any) -> Any: ... + def is_binary(self) -> bool: ... + def get_read_mode(self) -> str: ... + def get_extension(self) -> str: ... + def get_content_type(self) -> str: ... + @classmethod + def is_available(cls) -> bool: ... + def can_import(self) -> bool: ... + def can_export(self) -> bool: ... + +class TablibFormat(Format): + TABLIB_MODULE: ClassVar[str] + CONTENT_TYPE: ClassVar[str] + encoding: str | None + def __init__(self, encoding: str | None = None) -> None: ... + def get_format(self) -> type[Any]: ... + def get_title(self) -> str: ... # type: ignore[override] + def create_dataset(self, in_stream: str | bytes | IO[Any], **kwargs: Any) -> Dataset: ... # type: ignore[override] + +class TextFormat(TablibFormat): ... + +class CSV(TextFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> str: ... + +class JSON(TextFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> str: ... + +class YAML(TextFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> str: ... + +class TSV(TextFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> str: ... + +class ODS(TextFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> bytes: ... + +class HTML(TextFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> str: ... + +class XLS(TablibFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> bytes: ... + def create_dataset(self, in_stream: bytes) -> Dataset: ... # type: ignore[override] + +class XLSX(TablibFormat): + def export_data(self, dataset: Dataset, **kwargs: Any) -> bytes: ... + def create_dataset(self, in_stream: ReadableBuffer) -> Dataset: ... # type: ignore[override] + +DEFAULT_FORMATS: list[type[Format]] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/forms.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/forms.pyi new file mode 100644 index 000000000000..333ad58e896f --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/forms.pyi @@ -0,0 +1,31 @@ +from typing import Any + +from django import forms +from django.contrib.admin.helpers import ActionForm + +from .formats.base_formats import Format +from .resources import Resource + +class ImportExportFormBase(forms.Form): + resource: forms.ChoiceField + def __init__(self, *args: Any, resources: list[type[Resource[Any]]] | None = None, **kwargs: Any) -> None: ... + +class ImportForm(ImportExportFormBase): + import_file: forms.FileField + input_format: forms.ChoiceField + def __init__(self, import_formats: list[Format], *args: Any, **kwargs: Any) -> None: ... + @property + def media(self) -> forms.Media: ... + +class ConfirmImportForm(forms.Form): + import_file_name: forms.CharField + original_file_name: forms.CharField + input_format: forms.CharField + resource: forms.CharField + def clean_import_file_name(self) -> str: ... + +class ExportForm(ImportExportFormBase): + file_format: forms.ChoiceField + def __init__(self, formats: list[Format], *args: Any, **kwargs: Any) -> None: ... + +def export_action_form_factory(formats: list[tuple[str, str]]) -> type[ActionForm]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/instance_loaders.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/instance_loaders.pyi new file mode 100644 index 000000000000..433eb9f71796 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/instance_loaders.pyi @@ -0,0 +1,23 @@ +from _typeshed import Incomplete +from typing import Any +from typing_extensions import TypeAlias + +from django.db.models import Model, QuerySet + +from .fields import Field +from .resources import Resource + +Dataset: TypeAlias = Incomplete # tablib.Dataset + +class BaseInstanceLoader: + resource: Resource[Any] + dataset: Dataset | None + def __init__(self, resource: Resource[Any], dataset: Dataset | None = None) -> None: ... + def get_instance(self, row: dict[str, Any]) -> Model | None: ... + +class ModelInstanceLoader(BaseInstanceLoader): + def get_queryset(self) -> QuerySet[Any]: ... + +class CachedInstanceLoader(ModelInstanceLoader): + pk_field: Field + all_instances: dict[Any, Model] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/mixins.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/mixins.pyi new file mode 100644 index 000000000000..ac60a5a7ffef --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/mixins.pyi @@ -0,0 +1,66 @@ +from _typeshed import Incomplete, SupportsGetItem +from logging import Logger +from typing import Any, Generic, TypeVar +from typing_extensions import TypeAlias + +from django.db.models import Model, QuerySet +from django.forms import BaseForm, Form +from django.http.request import HttpRequest +from django.http.response import HttpResponse +from django.views.generic.edit import FormView + +from .formats.base_formats import Format +from .resources import Resource + +Dataset: TypeAlias = Incomplete # tablib.Dataset + +logger: Logger + +_ModelT = TypeVar("_ModelT", bound=Model) + +class BaseImportExportMixin(Generic[_ModelT]): + resource_class: type[Resource[_ModelT]] + resource_classes: SupportsGetItem[int, type[Resource[_ModelT]]] + @property + def formats(self) -> list[type[Format]]: ... + @property + def export_formats(self) -> list[type[Format]]: ... + @property + def import_formats(self) -> list[type[Format]]: ... + def check_resource_classes(self, resource_classes: SupportsGetItem[int, type[Resource[_ModelT]]]) -> None: ... + def get_resource_classes(self) -> list[type[Resource[_ModelT]]]: ... + def get_resource_kwargs(self, request: HttpRequest, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def get_resource_index(self, form: Form) -> int: ... + +class BaseImportMixin(BaseImportExportMixin[_ModelT]): + def get_import_resource_classes(self) -> list[type[Resource[_ModelT]]]: ... + def get_import_formats(self) -> list[Format]: ... + def get_import_resource_kwargs(self, request: HttpRequest, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def choose_import_resource_class(self, form: Form) -> type[Resource[_ModelT]]: ... + +class BaseExportMixin(BaseImportExportMixin[_ModelT]): + model: Model + escape_exported_data: bool + escape_html: bool + escape_formulae: bool + @property + def should_escape_html(self) -> bool: ... + @property + def should_escape_formulae(self) -> bool: ... + def get_export_formats(self) -> list[Format]: ... + def get_export_resource_classes(self) -> list[Resource[_ModelT]]: ... + def choose_export_resource_class(self, form: Form) -> Resource[_ModelT]: ... + def get_export_resource_kwargs(self, request: HttpRequest, *args: Any, **kwargs: Any) -> dict[str, Any]: ... + def get_data_for_export(self, request: HttpRequest, queryset: QuerySet[_ModelT], *args: Any, **kwargs: Any) -> Dataset: ... + def get_export_filename(self, file_format: Format) -> str: ... + +class ExportViewMixin(BaseExportMixin[_ModelT]): + form_class: type[BaseForm] = ... + def get_export_data(self, file_format: Format, queryset: QuerySet[_ModelT], *args: Any, **kwargs: Any) -> str | bytes: ... + def get_context_data(self, **kwargs: Any) -> dict[str, Any]: ... + def get_form_kwargs(self) -> dict[str, Any]: ... + +_FormT = TypeVar("_FormT", bound=BaseForm) + +class ExportViewFormMixin(ExportViewMixin[_ModelT], FormView[_FormT]): # type: ignore[misc] + def form_valid(self, form: _FormT) -> HttpResponse: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/resources.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/resources.pyi new file mode 100644 index 000000000000..895b430ccf9d --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/resources.pyi @@ -0,0 +1,232 @@ +import _typeshed +from collections import OrderedDict +from collections.abc import Iterator, Sequence +from functools import partial +from logging import Logger +from typing import Any, ClassVar, Generic, Literal, NoReturn, TypeVar, overload +from typing_extensions import TypeAlias, deprecated + +from django.db.models import Field as DjangoField, ForeignObjectRel, Model, QuerySet +from django.utils.safestring import SafeString + +from .fields import Field +from .instance_loaders import BaseInstanceLoader +from .results import Error, Result, RowResult +from .widgets import ForeignKeyWidget, ManyToManyWidget, Widget + +Dataset: TypeAlias = _typeshed.Incomplete # tablib.Dataset +logger: Logger + +@overload +def get_related_model(field: ForeignObjectRel) -> Model: ... +@overload +def get_related_model(field: DjangoField[Any, Any]) -> Model | None: ... +def has_natural_foreign_key(model: Model) -> bool: ... + +class ResourceOptions(Generic[_ModelT]): + model: _ModelT + fields: Sequence[str] | None + exclude: Sequence[str] | None + instance_loader_class: type[BaseInstanceLoader] | None + import_id_fields: Sequence[str] + export_order: Sequence[str] | None + widgets: dict[str, Any] | None + use_transactions: bool | None + skip_unchanged: bool + report_skipped: bool + clean_model_instances: bool + chunk_size: int | None + skip_diff: bool + skip_html_diff: bool + use_bulk: bool + batch_size: int + force_init_instance: bool + using_db: str | None + store_row_values: bool + store_instance: bool + use_natural_foreign_keys: bool + +class DeclarativeMetaclass(type): + def __new__(cls: type[_typeshed.Self], name: str, bases: tuple[type[Any], ...], attrs: dict[str, Any]) -> _typeshed.Self: ... + +class Diff: + left: list[str] + right: list[str] + new: bool + def __init__(self, resource: Resource[_ModelT], instance: _ModelT, new: bool) -> None: ... + def compare_with(self, resource: Resource[_ModelT], instance: _ModelT, dry_run: bool = False) -> None: ... + def as_html(self) -> list[SafeString]: ... + +_ModelT = TypeVar("_ModelT", bound=Model) + +class Resource(Generic[_ModelT], metaclass=DeclarativeMetaclass): + _meta: ResourceOptions[_ModelT] + fields: OrderedDict[str, Field] + create_instances: list[_ModelT] + update_instances: list[_ModelT] + delete_instances: list[_ModelT] + def __init__(self, **kwargs: Any) -> None: ... + @classmethod + def get_result_class(self) -> type[Result]: ... + @classmethod + def get_row_result_class(self) -> type[RowResult]: ... + @classmethod + def get_error_result_class(self) -> type[Error]: ... + @classmethod + def get_diff_class(self) -> type[Diff]: ... + @classmethod + def get_db_connection_name(self) -> str: ... + def get_use_transactions(self) -> bool: ... + def get_chunk_size(self) -> int: ... + def get_fields(self, **kwargs: Any) -> list[Field]: ... + def get_field_name(self, field: Field) -> str: ... + def init_instance(self, row: dict[str, Any] | None = None) -> _ModelT: ... + def get_instance(self, instance_loader: BaseInstanceLoader, row: dict[str, Any]) -> _ModelT | None: ... + def get_or_init_instance(self, instance_loader: BaseInstanceLoader, row: dict[str, Any]) -> tuple[_ModelT | None, bool]: ... + def get_import_id_fields(self) -> Sequence[str]: ... + def get_bulk_update_fields(self) -> list[str]: ... + def bulk_create( + self, + using_transactions: bool, + dry_run: bool, + raise_errors: bool, + batch_size: int | None = None, + result: Result | None = None, + ) -> None: ... + def bulk_update( + self, + using_transactions: bool, + dry_run: bool, + raise_errors: bool, + batch_size: int | None = None, + result: Result | None = None, + ) -> None: ... + def bulk_delete(self, using_transactions: bool, dry_run: bool, raise_errors: bool, result: Result | None = None) -> None: ... + def validate_instance( + self, instance: _ModelT, import_validation_errors: dict[str, Any] | None = None, validate_unique: bool = True + ) -> None: ... + def save_instance( + self, instance: _ModelT, is_create: bool, using_transactions: bool = True, dry_run: bool = False + ) -> None: ... + def before_save_instance(self, instance: _ModelT, using_transactions: bool, dry_run: bool) -> None: ... + def after_save_instance(self, instance: _ModelT, using_transactions: bool, dry_run: bool) -> None: ... + def delete_instance(self, instance: _ModelT, using_transactions: bool = True, dry_run: bool = False) -> None: ... + def before_delete_instance(self, instance: _ModelT, dry_run: bool) -> None: ... + def after_delete_instance(self, instance: _ModelT, dry_run: bool) -> None: ... + def import_field(self, field: Field, obj: _ModelT, data: dict[str, Any], is_m2m: bool = False, **kwargs: Any) -> None: ... + def get_import_fields(self) -> list[Field]: ... + def import_obj(self, obj: _ModelT, data: dict[str, Any], dry_run: bool, **kwargs: Any) -> None: ... + def save_m2m(self, obj: _ModelT, data: dict[str, Any], using_transactions: bool, dry_run: bool) -> None: ... + def for_delete(self, row: dict[str, Any], instance: _ModelT) -> bool: ... + def skip_row( + self, instance: _ModelT, original: _ModelT, row: dict[str, Any], import_validation_errors: dict[str, Any] | None = None + ) -> bool: ... + def get_diff_headers(self) -> list[str]: ... + def before_import(self, dataset: Dataset, using_transactions: bool, dry_run: bool, **kwargs: Any) -> None: ... + def after_import(self, dataset: Dataset, result: Result, using_transactions: bool, dry_run: bool, **kwargs: Any) -> None: ... + def before_import_row(self, row: dict[str, Any], row_number: int | None = None, **kwargs: Any) -> None: ... + def after_import_row( + self, row: dict[str, Any], row_result: RowResult, row_number: int | None = None, **kwargs: Any + ) -> None: ... + def after_import_instance(self, instance: _ModelT, new: bool, row_number: int | None = None, **kwargs: Any) -> None: ... + @overload + def handle_import_error(self, result: Result, error: Exception, raise_errors: Literal[True]) -> NoReturn: ... + @overload + def handle_import_error(self, result: Result, error: Exception, raise_errors: Literal[False] = ...) -> None: ... + @overload + @deprecated("raise_errors argument is deprecated and will be removed in a future release.") + def import_row( + self, + row: dict[str, Any], + instance_loader: BaseInstanceLoader, + using_transactions: bool = True, + dry_run: bool = False, + *, + raise_errors: bool, + **kwargs: Any, + ) -> RowResult: ... + @overload + def import_row( + self, + row: dict[str, Any], + instance_loader: BaseInstanceLoader, + using_transactions: bool = True, + dry_run: bool = False, + raise_errors: None = None, + **kwargs: Any, + ) -> RowResult: ... + def import_data( + self, + dataset: Dataset, + dry_run: bool = False, + raise_errors: bool = False, + use_transactions: bool | None = None, + collect_failed_rows: bool = False, + rollback_on_validation_errors: bool = False, + **kwargs: Any, + ) -> Result: ... + @overload + @deprecated("rollback_on_validation_errors argument is deprecated and will be removed in a future release.") + def import_data_inner( + self, + dataset: Dataset, + dry_run: bool, + raise_errors: bool, + using_transactions: bool, + collect_failed_rows: bool, + rollback_on_validation_errors: bool, + **kwargs: Any, + ) -> Result: ... + @overload + def import_data_inner( + self, + dataset: Dataset, + dry_run: bool, + raise_errors: bool, + using_transactions: bool, + collect_failed_rows: bool, + rollback_on_validation_errors: None = None, + **kwargs: Any, + ) -> Result: ... + def get_export_order(self) -> tuple[str, ...]: ... + def before_export(self, queryset: QuerySet[_ModelT], *args: Any, **kwargs: Any) -> None: ... + def after_export(self, queryset: QuerySet[_ModelT], data: Dataset, *args: Any, **kwargs: Any) -> None: ... + def filter_export(self, queryset: QuerySet[_ModelT], *args: Any, **kwargs: Any) -> QuerySet[_ModelT]: ... + def export_field(self, field: Field, obj: _ModelT) -> str: ... + def get_export_fields(self) -> list[Field]: ... + def export_resource(self, obj: _ModelT) -> list[str]: ... + def get_export_headers(self) -> list[str]: ... + def get_user_visible_headers(self) -> list[str]: ... + def get_user_visible_fields(self) -> list[str]: ... + def iter_queryset(self, queryset: QuerySet[_ModelT]) -> Iterator[_ModelT]: ... + def export(self, *args: Any, queryset: QuerySet[_ModelT] | None = None, **kwargs: Any) -> Dataset: ... + +class ModelDeclarativeMetaclass(DeclarativeMetaclass): + def __new__(cls: type[_typeshed.Self], name: str, bases: tuple[type[Any], ...], attrs: dict[str, Any]) -> _typeshed.Self: ... + +class ModelResource(Resource[_ModelT], metaclass=ModelDeclarativeMetaclass): + DEFAULT_RESOURCE_FIELD: ClassVar[type[Field]] = ... + WIDGETS_MAP: ClassVar[dict[str, type[Widget]]] + @classmethod + def get_m2m_widget(cls, field: DjangoField[Any, Any]) -> partial[ManyToManyWidget[Any]]: ... + @classmethod + def get_fk_widget(cls, field: DjangoField[Any, Any]) -> partial[ForeignKeyWidget[Any]]: ... + @classmethod + def widget_from_django_field(cls, f: DjangoField[Any, Any], default: type[Widget] = ...) -> type[Widget]: ... + @classmethod + def widget_kwargs_for_field(self, field_name: str) -> dict[str, Any]: ... + @classmethod + def field_from_django_field(cls, field_name: str, django_field: DjangoField[Any, Any], readonly: bool) -> Field: ... + def get_queryset(self) -> QuerySet[_ModelT]: ... + def init_instance(self, row: dict[str, Any] | None = None) -> _ModelT: ... + def after_import(self, dataset: Dataset, result: Result, using_transactions: bool, dry_run: bool, **kwargs: Any) -> None: ... + @classmethod + def get_display_name(cls) -> str: ... + +_ResourceT = TypeVar("_ResourceT", bound=Resource[Any]) + +# HK Type Vars could help type the first overload: +@overload +def modelresource_factory(model: Model, resource_class: type[_ResourceT]) -> _ResourceT: ... +@overload +def modelresource_factory(model: _ModelT) -> ModelResource[_ModelT]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/results.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/results.pyi new file mode 100644 index 000000000000..dd50fd7e7e39 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/results.pyi @@ -0,0 +1,73 @@ +from _typeshed import Incomplete +from collections import OrderedDict +from collections.abc import Iterator +from typing import Any, ClassVar, Literal +from typing_extensions import TypeAlias + +from django.core.exceptions import ValidationError +from django.db.models import Model + +Dataset: TypeAlias = Incomplete # tablib.Dataset + +class Error: + error: Exception + traceback: str + row: dict[str, Any] + def __init__(self, error: Exception, traceback: str | None = None, row: dict[str, Any] | None = None) -> None: ... + +_ImportType: TypeAlias = Literal["update", "new", "delete", "skip", "error", "invalid"] + +class RowResult: + IMPORT_TYPE_UPDATE: ClassVar[Literal["update"]] + IMPORT_TYPE_NEW: ClassVar[Literal["new"]] + IMPORT_TYPE_DELETE: ClassVar[Literal["delete"]] + IMPORT_TYPE_SKIP: ClassVar[Literal["skip"]] + IMPORT_TYPE_ERROR: ClassVar[Literal["error"]] + IMPORT_TYPE_INVALID: ClassVar[Literal["invalid"]] + valid_import_types: frozenset[_ImportType] + errors: list[Error] + validation_error: ValidationError | None + diff: list[str] | None + import_type: _ImportType + row_values: dict[str, Any] + object_id: Any | None + object_repr: str | None + instance: Model + original: Model + new_record: bool | None + def __init__(self) -> None: ... + def add_instance_info(self, instance: Model) -> None: ... + +class InvalidRow: + number: int + error: ValidationError + values: tuple[Any, ...] + error_dict: dict[str, list[str]] + def __init__(self, number: int, validation_error: ValidationError, values: tuple[Any, ...]) -> None: ... + @property + def field_specific_errors(self) -> dict[str, list[str]]: ... + @property + def non_field_specific_errors(self) -> list[str]: ... + @property + def error_count(self) -> int: ... + +class Result: + base_errors: list[Error] + diff_headers: list[str] + rows: list[RowResult] + invalid_rows: list[InvalidRow] + failed_dataset: Dataset + totals: OrderedDict[_ImportType, int] + total_rows: int + def __init__(self) -> None: ... + def valid_rows(self) -> list[RowResult]: ... + def append_row_result(self, row_result: RowResult) -> None: ... + def append_base_error(self, error: Error) -> None: ... + def add_dataset_headers(self, headers: list[str] | None) -> None: ... + def append_failed_row(self, row: dict[str, Any], error: Exception) -> None: ... + def append_invalid_row(self, number: int, row: dict[str, Any], validation_error: ValidationError) -> None: ... + def increment_row_result_total(self, row_result: RowResult) -> None: ... + def row_errors(self) -> list[tuple[int, Any]]: ... + def has_errors(self) -> bool: ... + def has_validation_errors(self) -> bool: ... + def __iter__(self) -> Iterator[RowResult]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/signals.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/signals.pyi new file mode 100644 index 000000000000..7d32df82f840 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/signals.pyi @@ -0,0 +1,4 @@ +from django.dispatch import Signal + +post_export: Signal +post_import: Signal diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/templatetags/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/templatetags/__init__.pyi new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/templatetags/import_export_tags.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/templatetags/import_export_tags.pyi new file mode 100644 index 000000000000..dcbfa25a67c1 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/templatetags/import_export_tags.pyi @@ -0,0 +1,8 @@ +from typing_extensions import LiteralString + +from django.template import Library + +register: Library + +# @register.simple_tag # commented out for pytype +def compare_values(value1: str, value2: str) -> LiteralString: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/tmp_storages.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/tmp_storages.pyi new file mode 100644 index 000000000000..eda138ffda97 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/tmp_storages.pyi @@ -0,0 +1,34 @@ +from abc import abstractmethod +from typing import IO, Any, ClassVar + +class BaseStorage: + name: str | None + read_mode: str + encoding: str | None + def __init__(self, *, name: str | None = None, read_mode: str = "", encoding: str | None = None) -> None: ... + @abstractmethod + def save(self, data: Any) -> None: ... + @abstractmethod + def read(self) -> Any: ... # `Any` because `read` returns things from `save` + @abstractmethod + def remove(self) -> None: ... + +class TempFolderStorage(BaseStorage): + def save(self, data: Any) -> None: ... + def read(self) -> Any: ... + def remove(self) -> None: ... + def get_full_path(self) -> str: ... + +class CacheStorage(BaseStorage): + CACHE_LIFETIME: int + CACHE_PREFIX: str + def save(self, data: Any) -> None: ... + def read(self) -> Any: ... + def remove(self) -> None: ... + +class MediaStorage(BaseStorage): + MEDIA_FOLDER: ClassVar[str] + def save(self, data: IO[Any]) -> None: ... + def read(self) -> Any: ... + def remove(self) -> None: ... + def get_full_path(self) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/utils.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/utils.pyi new file mode 100644 index 000000000000..49985a35ada5 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/utils.pyi @@ -0,0 +1,18 @@ +from collections.abc import Callable +from types import TracebackType +from typing import Any, TypeVar + +from django.db.transaction import Atomic + +_C = TypeVar("_C", bound=Callable[..., Any]) + +class atomic_if_using_transaction: + using_transactions: bool + context_manager: Atomic + def __init__(self, using_transactions: bool, using: str | None) -> None: ... + def __enter__(self) -> None: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_value: BaseException | None, exc_tb: TracebackType | None + ) -> None: ... + +def original(method: _C) -> _C: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/widgets.pyi b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/widgets.pyi new file mode 100644 index 000000000000..e91d2a424124 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/django-import-export/import_export/widgets.pyi @@ -0,0 +1,66 @@ +from collections.abc import Mapping +from datetime import datetime +from typing import Any, ClassVar, Generic, TypeVar + +from django.db.models import Model, QuerySet + +def format_datetime(value: datetime, datetime_format: str) -> str: ... + +class Widget: + def clean(self, value: Any, row: Mapping[str, Any] | None = None, **kwargs: Any) -> Any: ... + def render(self, value: Any, obj: Model | None = None) -> Any: ... + +class NumberWidget(Widget): + coerce_to_string: bool + def __init__(self, coerce_to_string: bool = False) -> None: ... + def is_empty(self, value: Any) -> bool: ... + def render(self, value: Any, obj: Model | None = None) -> Any: ... + +class FloatWidget(NumberWidget): ... +class IntegerWidget(NumberWidget): ... +class DecimalWidget(NumberWidget): ... + +class CharWidget(Widget): + coerce_to_string: bool + allow_blank: bool + def __init__(self, coerce_to_string: bool = False, allow_blank: bool = False) -> None: ... + +class BooleanWidget(Widget): + TRUE_VALUES: ClassVar[list[str | int | bool]] + FALSE_VALUES: ClassVar[list[str | int | bool]] + NULL_VALUES: ClassVar[list[str | None]] + +class DateWidget(Widget): + formats: tuple[str, ...] + def __init__(self, format: str | None = None) -> None: ... + +class DateTimeWidget(Widget): + formats: tuple[str, ...] + def __init__(self, format: str | None = None) -> None: ... + +class TimeWidget(Widget): + formats: tuple[str, ...] + def __init__(self, format: str | None = None) -> None: ... + +class DurationWidget(Widget): ... + +class SimpleArrayWidget(Widget): + separator: str + def __init__(self, separator: str | None = None) -> None: ... + +class JSONWidget(Widget): ... + +_ModelT = TypeVar("_ModelT", bound=Model) + +class ForeignKeyWidget(Widget, Generic[_ModelT]): + model: _ModelT + field: str + use_natural_foreign_keys: bool + def __init__(self, model: _ModelT, field: str = "pk", use_natural_foreign_keys: bool = False, **kwargs: Any) -> None: ... + def get_queryset(self, value: Any, row: Mapping[str, Any], *args: Any, **kwargs: Any) -> QuerySet[_ModelT]: ... + +class ManyToManyWidget(Widget, Generic[_ModelT]): + model: _ModelT + separator: str + field: str + def __init__(self, model: _ModelT, separator: str | None = None, field: str | None = None, **kwargs: Any) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/containers.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/containers.pyi index 94a1d4129900..c3f787b76891 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/containers.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/containers.pyi @@ -35,7 +35,7 @@ class Container(Model): def diff(self): ... def exec_run( self, - cmd, + cmd: str | list[str], stdout: bool = True, stderr: bool = True, stdin: bool = False, @@ -51,7 +51,7 @@ class Container(Model): ) -> ExecResult: ... def export(self, chunk_size: int | None = 2097152) -> str: ... def get_archive( - self, path, chunk_size: int | None = 2097152, encode_stream: bool = False + self, path: str, chunk_size: int | None = 2097152, encode_stream: bool = False ) -> tuple[Incomplete, Incomplete]: ... def kill(self, signal: Incomplete | None = None): ... @overload diff --git a/packages/pyright-internal/typeshed-fallback/stubs/flake8-bugbear/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/flake8-bugbear/METADATA.toml index 74885e11baea..34969cb41329 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/flake8-bugbear/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/flake8-bugbear/METADATA.toml @@ -1,4 +1,4 @@ -version = "24.10.31" +version = "24.12.12" upstream_repository = "https://github.com/PyCQA/flake8-bugbear" partial_stub = true diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/METADATA.toml index a86dce92af40..180d317a993e 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/METADATA.toml @@ -1,4 +1,4 @@ -version = "2.8.1" +version = "2.8.2" upstream_repository = "https://github.com/PyFPDF/fpdf2" requires = ["Pillow>=10.3.0"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/__init__.pyi index b6d360183ceb..6151095247d7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/__init__.pyi @@ -6,6 +6,7 @@ from .fpdf import FPDF as FPDF, FPDFException as FPDFException, TitleStyle as Ti from .html import HTML2FPDF as HTML2FPDF, HTMLMixin as HTMLMixin from .prefs import ViewerPreferences as ViewerPreferences from .template import FlexTemplate as FlexTemplate, Template as Template +from .util import get_scale_factor as get_scale_factor __license__: str __version__: str @@ -31,4 +32,5 @@ __all__ = [ "HTML2FPDF", "FPDF_VERSION", "FPDF_FONT_DIR", + "get_scale_factor", ] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/annotations.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/annotations.pyi index c67abdf26aea..4d1c3e42d8d8 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/annotations.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/annotations.pyi @@ -15,7 +15,7 @@ class AnnotationMixin: border: str f_t: Name | None v: Incomplete | None - f: int # AnnotationFlags + f: int # AnnotationFlags bitmask contents: str | None a: Action | None dest: Destination | None @@ -35,7 +35,7 @@ class AnnotationMixin: y: int, width: int, height: int, - flags: tuple[AnnotationFlag, ...] = ..., + flags: tuple[AnnotationFlag | str, ...] = ..., contents: str | None = None, dest: Destination | None = None, action: Action | None = None, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/enums.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/enums.pyi index e8a66b855f3f..20441ee7c4a5 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/enums.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/enums.pyi @@ -8,15 +8,15 @@ class SignatureFlag(IntEnum): SIGNATURES_EXIST = 1 APPEND_ONLY = 2 -class CoerciveEnum(Enum): +class CoerciveEnum(Enum): # type: ignore[misc] # Enum with no members @classmethod - def coerce(cls, value: Self | str) -> Self: ... + def coerce(cls, value: Self | str, case_sensitive: bool = False) -> Self: ... -class CoerciveIntEnum(IntEnum): +class CoerciveIntEnum(IntEnum): # type: ignore[misc] # Enum with no members @classmethod def coerce(cls, value: Self | str | int) -> Self: ... -class CoerciveIntFlag(IntFlag): +class CoerciveIntFlag(IntFlag): # type: ignore[misc] # Enum with no members @classmethod def coerce(cls, value: Self | str | int) -> Self: ... @@ -38,6 +38,9 @@ class Align(CoerciveEnum): R = "RIGHT" J = "JUSTIFY" + @classmethod + def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] + _Align: TypeAlias = Align | Literal["CENTER", "X_CENTER", "LEFT", "RIGHT", "JUSTIFY"] # noqa: Y047 class VAlign(CoerciveEnum): @@ -45,6 +48,9 @@ class VAlign(CoerciveEnum): T = "TOP" B = "BOTTOM" + @classmethod + def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] + class TextEmphasis(CoerciveIntFlag): NONE = 0 B = 1 @@ -70,6 +76,15 @@ class TableBordersLayout(CoerciveEnum): NO_HORIZONTAL_LINES = "NO_HORIZONTAL_LINES" SINGLE_TOP_LINE = "SINGLE_TOP_LINE" +class CellBordersLayout(CoerciveIntFlag): + NONE = 0 + LEFT = 1 + RIGHT = 2 + TOP = 4 + BOTTOM = 8 + ALL = 15 + INHERIT = 16 + class TableCellFillMode(CoerciveEnum): NONE = "NONE" ALL = "ALL" @@ -79,6 +94,8 @@ class TableCellFillMode(CoerciveEnum): EVEN_COLUMNS = "EVEN_COLUMNS" def should_fill_cell(self, i: int, j: int) -> bool: ... + @classmethod + def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] class TableSpan(CoerciveEnum): ROW = "ROW" @@ -98,6 +115,8 @@ class RenderStyle(CoerciveEnum): def is_draw(self) -> bool: ... @property def is_fill(self) -> bool: ... + @classmethod + def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] class TextMode(CoerciveIntEnum): FILL = 0 @@ -276,3 +295,30 @@ class TextDirection(CoerciveEnum): RTL = "RTL" TTB = "TTB" BTT = "BTT" + +class PageLabelStyle(CoerciveEnum): + NUMBER = "D" + UPPER_ROMAN = "R" + LOWER_ROMAN = "r" + UPPER_LETTER = "A" + LOWER_LETTER = "a" + NONE = None + +class Duplex(CoerciveEnum): + SIMPLEX = "Simplex" + DUPLEX_FLIP_SHORT_EDGE = "DuplexFlipShortEdge" + DUPLEX_FLIP_LONG_EDGE = "DuplexFlipLongEdge" + +class PageBoundaries(CoerciveEnum): + ART_BOX = "ArtBox" + BLEED_BOX = "BleedBox" + CROP_BOX = "CropBox" + MEDIA_BOX = "MediaBox" + TRIM_BOX = "TrimBox" + +class PageOrientation(CoerciveEnum): + PORTRAIT = "P" + LANDSCAPE = "L" + + @classmethod + def coerce(cls, value: Self | str) -> Self: ... # type: ignore[override] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fonts.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fonts.pyi index eb8c934789ab..f498efd2395a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fonts.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fonts.pyi @@ -6,7 +6,7 @@ from typing import Final, overload from typing_extensions import Self, deprecated from .drawing import DeviceGray, DeviceRGB, Number -from .enums import TextEmphasis +from .enums import Align, TextEmphasis from .syntax import PDFObject # Only defined if harfbuzz is installed. @@ -41,7 +41,7 @@ class FontFace: class TextStyle(FontFace): t_margin: int - l_margin: int + l_margin: int | Align b_margin: int def __init__( self, @@ -52,7 +52,7 @@ class TextStyle(FontFace): fill_color: int | tuple[int, int, int] | None = None, underline: bool = False, t_margin: int | None = None, - l_margin: int | None = None, + l_margin: int | Align | str | None = None, b_margin: int | None = None, ): ... def replace( # type: ignore[override] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi index 1508aad89465..5bd1b679f6e4 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi @@ -9,6 +9,7 @@ from typing import Any, ClassVar, Final, Literal, NamedTuple, overload from typing_extensions import TypeAlias, deprecated from fpdf import ViewerPreferences +from fpdf.outline import OutlineSection from PIL import Image from .annotations import AnnotationDict, PDFEmbeddedFile @@ -22,8 +23,10 @@ from .enums import ( EncryptionMethod, FileAttachmentAnnotationName, MethodReturnValue, + PageLabelStyle, PageLayout, PageMode, + PageOrientation, PathPaintRule, RenderStyle, TableBordersLayout, @@ -40,7 +43,7 @@ from .enums import ( _Align, ) from .errors import FPDFException as FPDFException -from .fonts import FontFace, TextStyle, TitleStyle as TitleStyle +from .fonts import CoreFont, FontFace, TextStyle, TitleStyle as TitleStyle, TTFFont from .graphics_state import GraphicsStateMixin from .html import HTML2FPDF from .image_datastructures import ( @@ -55,6 +58,7 @@ from .recorder import FPDFRecorder from .structure_tree import StructureTreeBuilder from .syntax import DestinationXYZ from .table import Table +from .transitions import Transition from .util import Padding, _Unit __all__ = [ @@ -79,16 +83,14 @@ FPDF_VERSION: Final[str] PAGE_FORMATS: dict[_Format, tuple[float, float]] class ToCPlaceholder(NamedTuple): - render_function: Callable[[FPDF, Any], object] + render_function: Callable[[FPDF, list[OutlineSection]], object] start_page: int y: int + page_orientation: str pages: int = 1 def get_page_format(format: _Format | tuple[float, float], k: float | None = None) -> tuple[float, float]: ... -# TODO: TypedDicts -_Font: TypeAlias = dict[str, Any] - class FPDF(GraphicsStateMixin): MARKDOWN_BOLD_MARKER: ClassVar[str] MARKDOWN_ITALICS_MARKER: ClassVar[str] @@ -102,7 +104,7 @@ class FPDF(GraphicsStateMixin): page: int pages: dict[int, PDFPage] - fonts: dict[str, _Font] + fonts: dict[str, CoreFont | TTFFont] fonts_used_per_page_number: dict[int, set[int]] links: dict[int, DestinationXYZ] embedded_files: list[PDFEmbeddedFile] @@ -119,6 +121,9 @@ class FPDF(GraphicsStateMixin): oversized_images: Incomplete | None oversized_images_ratio: float struct_builder: StructureTreeBuilder + toc_placeholder: ToCPlaceholder | None + in_toc_rendering: bool + title: str | None section_title_styles: dict[int, TextStyle] core_fonts: dict[str, str] @@ -145,7 +150,7 @@ class FPDF(GraphicsStateMixin): buffer: bytearray | None # Set during call to _set_orientation(), called from __init__(). - cur_orientation: Literal["P", "L"] + cur_orientation: PageOrientation w_pt: float h_pt: float w: float @@ -208,7 +213,6 @@ class FPDF(GraphicsStateMixin): language: str | None = None, ) -> None: ... def set_compression(self, compress: bool) -> None: ... - title: str def set_title(self, title: str) -> None: ... lang: str def set_lang(self, lang: str) -> None: ... @@ -227,17 +231,24 @@ class FPDF(GraphicsStateMixin): def set_doc_option(self, opt: str, value: str) -> None: ... def set_image_filter(self, image_filter: str) -> None: ... def alias_nb_pages(self, alias: str = "{nb}") -> None: ... + def set_page_label( + self, label_style: PageLabelStyle | str | None = None, label_prefix: str | None = None, label_start: int | None = None + ) -> None: ... def add_page( self, orientation: _Orientation = "", format: _Format | tuple[float, float] = "", same: bool = False, - duration: int = 0, - transition: Incomplete | None = None, + duration: float = 0, + transition: Transition | None = None, + label_style: PageLabelStyle | str | None = None, + label_prefix: str | None = None, + label_start: int | None = None, ) -> None: ... def header(self) -> None: ... def footer(self) -> None: ... def page_no(self) -> int: ... + def get_page_label(self) -> str: ... def set_draw_color(self, r: int, g: int = -1, b: int = -1) -> None: ... def set_fill_color(self, r: int, g: int = -1, b: int = -1) -> None: ... def set_text_color(self, r: int, g: int = -1, b: int = -1) -> None: ... @@ -340,7 +351,16 @@ class FPDF(GraphicsStateMixin): def add_link(self, y: float = 0, x: float = 0, page: int = -1, zoom: float | Literal["null"] = "null") -> int: ... def set_link(self, link, y: float = 0, x: float = 0, page: int = -1, zoom: float | Literal["null"] = "null") -> None: ... def link( - self, x: float, y: float, w: float, h: float, link: str | int, alt_text: str | None = None, border_width: int = 0 + self, + x: float, + y: float, + w: float, + h: float, + link: str | int, + alt_text: str | None = None, + *, + border_width: int = 0, + **kwargs, # accepts AnnotationDict arguments ) -> AnnotationDict: ... def embed_file( self, @@ -380,7 +400,9 @@ class FPDF(GraphicsStateMixin): w: float = 1, h: float = 1, name: AnnotationName | str | None = None, + *, flags: tuple[AnnotationFlag, ...] | tuple[str, ...] = ..., + **kwargs, # accepts AnnotationDict arguments ) -> AnnotationDict: ... def free_text_annotation( self, @@ -389,16 +411,22 @@ class FPDF(GraphicsStateMixin): y: float | None = None, w: float | None = None, h: float | None = None, + *, flags: tuple[AnnotationFlag, ...] | tuple[str, ...] = ..., + **kwargs, # accepts AnnotationDict arguments + ) -> AnnotationDict: ... + def add_action( + self, action, x: float, y: float, w: float, h: float, **kwargs # accepts AnnotationDict arguments ) -> AnnotationDict: ... - def add_action(self, action, x: float, y: float, w: float, h: float) -> None: ... def highlight( self, text: str, - title: str = "", type: TextMarkupType | str = "Highlight", color: tuple[float, float, float] = (1, 1, 0), modification_time: datetime.datetime | None = None, + *, + title: str | None = None, + **kwargs, # accepts AnnotationDict arguments ) -> _GeneratorContextManager[None]: ... add_highlight = highlight def add_text_markup_annotation( @@ -406,18 +434,22 @@ class FPDF(GraphicsStateMixin): type: str, text: str, quad_points: Sequence[int], - title: str = "", color: tuple[float, float, float] = (1, 1, 0), modification_time: datetime.datetime | None = None, page: int | None = None, + *, + title: str | None = None, + **kwargs, # accepts AnnotationDict arguments ) -> AnnotationDict: ... def ink_annotation( self, coords: Iterable[Incomplete], - contents: str = "", - title: str = "", + text: str = "", color: Sequence[float] = (1, 1, 0), - border_width: int = 1, + border_width: float = 1, + *, + title: str | None = None, + **kwargs, # accepts AnnotationDict arguments ) -> AnnotationDict: ... def text(self, x: float, y: float, text: str = "") -> None: ... def rotate(self, angle: float, x: float | None = None, y: float | None = None) -> None: ... @@ -585,7 +617,9 @@ class FPDF(GraphicsStateMixin): def round_clip(self, x: float, y: float, r: float) -> _GeneratorContextManager[None]: ... def unbreakable(self) -> _GeneratorContextManager[FPDFRecorder]: ... def offset_rendering(self) -> _GeneratorContextManager[FPDFRecorder]: ... - def insert_toc_placeholder(self, render_toc_function, pages: int = 1) -> None: ... + def insert_toc_placeholder( + self, render_toc_function: Callable[[FPDF, list[OutlineSection]], object], pages: int = 1, allow_extra_pages: bool = False + ) -> None: ... def set_section_title_styles( self, level0: TextStyle, @@ -597,6 +631,7 @@ class FPDF(GraphicsStateMixin): level6: TextStyle | None = None, ) -> None: ... def start_section(self, name: str, level: int = 0, strict: bool = True) -> None: ... + def use_text_style(self, text_style: TextStyle) -> _GeneratorContextManager[None]: ... def use_font_face(self, font_face: FontFace) -> _GeneratorContextManager[None]: ... def table( self, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/html.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/html.pyi index 443968afcbf9..9cf64f1e6163 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/html.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/html.pyi @@ -55,6 +55,7 @@ class HTML2FPDF(HTMLParser): ol_type: list[_OLType] bullet: list[Incomplete] heading_level: Incomplete | None + render_title_tag: bool table_line_separators: bool table: Table | None table_row: Row | None @@ -78,6 +79,7 @@ class HTML2FPDF(HTMLParser): tag_indents: dict[str, int] | None = None, tag_styles: Mapping[str, FontFace] | None = None, font_family: str = "times", + render_title_tag: bool = False, ) -> None: ... def handle_data(self, data) -> None: ... def handle_starttag(self, tag, attrs) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_parsing.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_parsing.pyi index 9f5d5a4924cf..000d9f725696 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_parsing.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_parsing.pyi @@ -1,9 +1,10 @@ from _typeshed import Incomplete +from collections.abc import Iterable from dataclasses import dataclass from io import BytesIO from logging import Logger from types import TracebackType -from typing import Any, Literal +from typing import Any, Final, Literal from typing_extensions import TypeAlias from PIL import Image @@ -11,7 +12,7 @@ from PIL import Image from .image_datastructures import ImageCache, ImageInfo, VectorImageInfo from .svg import SVGObject -_ImageFilter: TypeAlias = Literal["AUTO", "FlateDecode", "DCTDecode", "JPXDecode"] +_ImageFilter: TypeAlias = Literal["AUTO", "FlateDecode", "DCTDecode", "JPXDecode", "LZWDecode"] RESAMPLE: Image.Resampling @@ -25,6 +26,11 @@ SETTINGS: ImageSettings TIFFBitRevTable: list[int] +LZW_CLEAR_TABLE_MARKER: Final = 256 +LZW_EOD_MARKER: Final = 257 +LZW_INITIAL_BITS_PER_CODE: Final = 9 +LZW_MAX_BITS_PER_CODE: Final = 12 + def preload_image( image_cache: ImageCache, name: str | BytesIO | Image.Image, dims: tuple[float, float] | None = None ) -> tuple[str, BytesIO | Image.Image | None, ImageInfo]: ... @@ -50,3 +56,5 @@ class temp_attr: def ccitt_payload_location_from_pil(img: Image.Image) -> tuple[int, int]: ... def transcode_monochrome(img: Image.Image): ... +def pack_codes_into_bytes(codes: Iterable[int]) -> bytes: ... +def clear_table() -> tuple[dict[bytes, int], int, int, int]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/line_break.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/line_break.pyi index d71917cd0d83..90c4678df1c9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/line_break.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/line_break.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete from collections.abc import Callable, Sequence from typing import Final, NamedTuple +from uuid import UUID from .enums import Align, TextDirection, WrapMode @@ -68,12 +69,18 @@ class Fragment: def trim(self, index: int) -> None: ... def __eq__(self, other: Fragment) -> bool: ... # type: ignore[override] def get_width(self, start: int = 0, end: int | None = None, chars: str | None = None, initial_cs: bool = True) -> float: ... + def has_same_style(self, other: Fragment) -> bool: ... def get_character_width(self, character: str, print_sh: bool = False, initial_cs: bool = True): ... def render_pdf_text(self, frag_ws, current_ws, word_spacing, adjust_x, adjust_y, h): ... def render_pdf_text_ttf(self, frag_ws, word_spacing): ... def render_with_text_shaping(self, pos_x: float, pos_y: float, h: float, word_spacing: float) -> str: ... def render_pdf_text_core(self, frag_ws, current_ws): ... +class TotalPagesSubstitutionFragment(Fragment): + uuid: UUID + def get_placeholder_string(self) -> str: ... + def render_text_substitution(self, replacement_text: str) -> str: ... + class TextLine(NamedTuple): fragments: tuple[Fragment, ...] text_width: float @@ -120,13 +127,12 @@ class CurrentLine: self, character: str, character_width: float, - graphics_state: dict[str, Incomplete], - k: float, + original_fragment: Fragment, original_fragment_index: int, original_character_index: int, height: float, url: str | None = None, - ): ... + ) -> None: ... def trim_trailing_spaces(self) -> None: ... def manual_break(self, align: Align, trailing_nl: bool = False, trailing_form_feed: bool = False) -> TextLine: ... def automatic_break_possible(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/outline.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/outline.pyi index 5da8df372ea1..d3bee41be5dc 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/outline.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/outline.pyi @@ -2,6 +2,8 @@ from _typeshed import Incomplete from collections.abc import Generator, Iterable from typing import NamedTuple +from .fonts import TextStyle +from .fpdf import FPDF from .structure_tree import StructElem from .syntax import Destination, PDFObject, PDFString @@ -34,3 +36,22 @@ class OutlineDictionary(PDFObject): def build_outline_objs( sections: Iterable[Incomplete], ) -> Generator[Incomplete, None, list[OutlineDictionary | OutlineItemDictionary]]: ... + +class TableOfContents: + text_style: TextStyle + use_section_title_styles: bool + level_indent: float + line_spacing: float + ignore_pages_before_toc: bool + + def __init__( + self, + text_style: TextStyle | None = None, + use_section_title_styles: bool = False, + level_indent: float = 7.5, + line_spacing: float = 1.5, + ignore_pages_before_toc: bool = True, + ) -> None: ... + def get_text_style(self, pdf: FPDF, item: OutlineSection) -> TextStyle: ... + def render_toc_item(self, pdf: FPDF, item: OutlineSection) -> None: ... + def render_toc(self, pdf: FPDF, outline: Iterable[OutlineSection]) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/output.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/output.pyi index 1f081daeb442..db06865eee0e 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/output.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/output.pyi @@ -5,8 +5,10 @@ from typing import Final from .annotations import AnnotationDict from .encryption import StandardSecurityHandler +from .enums import PageLabelStyle from .fpdf import FPDF from .image_datastructures import RasterImageInfo +from .line_break import TotalPagesSubstitutionFragment from .syntax import Name, PDFArray, PDFContentStream, PDFObject, PDFString LOGGER: Logger @@ -138,6 +140,18 @@ class PDFICCPObject(PDFContentStream): alternate: Name def __init__(self, contents: bytes, n, alternate: str) -> None: ... +class PDFPageLabel: + st: int + def __init__(self, label_style: PageLabelStyle, label_prefix: str, label_start: int) -> None: ... + @property + def s(self) -> Name: ... + @property + def p(self) -> PDFString: ... + def serialize(self) -> dict[str, str]: ... + def get_style(self) -> PageLabelStyle: ... + def get_prefix(self) -> str: ... + def get_start(self) -> int: ... + class PDFPage(PDFObject): type: Name contents: Incomplete @@ -153,6 +167,11 @@ class PDFPage(PDFObject): def index(self): ... def dimensions(self) -> tuple[float | None, float | None]: ... def set_dimensions(self, width_pt: float | None, height_pt: float | None) -> None: ... + def set_page_label(self, previous_page_label: PDFPageLabel, page_label: PDFPageLabel) -> None: ... + def get_page_label(self) -> PDFPageLabel: ... + def get_label(self) -> str: ... + def get_text_substitutions(self) -> list[TotalPagesSubstitutionFragment]: ... + def add_text_substitution(self, fragment: TotalPagesSubstitutionFragment) -> None: ... class PDFPagesRoot(PDFObject): type: Name diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/prefs.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/prefs.pyi index bd9f243e831c..541ecad54d36 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/prefs.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/prefs.pyi @@ -1,4 +1,4 @@ -from .enums import PageMode +from .enums import Duplex, PageBoundaries, PageMode, TextDirection class ViewerPreferences: hide_toolbar: bool @@ -7,6 +7,8 @@ class ViewerPreferences: fit_window: bool center_window: bool display_doc_title: bool + num_copies: int | None + print_page_range: list[int] | None def __init__( self, hide_toolbar: bool = False, @@ -15,10 +17,42 @@ class ViewerPreferences: fit_window: bool = False, center_window: bool = False, display_doc_title: bool = False, - non_full_screen_page_mode: PageMode | str = ..., + non_full_screen_page_mode: PageMode | str | None = ..., + num_copies: int | None = None, + print_page_range: list[int] | None = None, + direction: TextDirection | str | None = None, + duplex: Duplex | str | None = None, + view_area: PageBoundaries | None = None, + view_clip: PageBoundaries | None = None, + print_area: PageBoundaries | None = None, + print_clip: PageBoundaries | None = None, ) -> None: ... @property - def non_full_screen_page_mode(self): ... + def non_full_screen_page_mode(self) -> PageMode | None: ... @non_full_screen_page_mode.setter - def non_full_screen_page_mode(self, page_mode) -> None: ... + def non_full_screen_page_mode(self, page_mode: PageMode | str | None) -> None: ... + @property + def direction(self) -> TextDirection | None: ... + @direction.setter + def direction(self, direction: TextDirection | str | None) -> None: ... + @property + def duplex(self) -> Duplex | None: ... + @duplex.setter + def duplex(self, duplex: Duplex | str | None) -> None: ... + @property + def view_area(self) -> PageBoundaries | None: ... + @view_area.setter + def view_area(self, view_area: PageBoundaries | str | None) -> None: ... + @property + def view_clip(self) -> PageBoundaries | None: ... + @view_clip.setter + def view_clip(self, view_area: PageBoundaries | str | None) -> None: ... + @property + def print_area(self) -> PageBoundaries | None: ... + @print_area.setter + def print_area(self, view_area: PageBoundaries | str | None) -> None: ... + @property + def print_clip(self) -> PageBoundaries | None: ... + @print_clip.setter + def print_clip(self, view_area: PageBoundaries | str | None) -> None: ... def serialize(self) -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi index c000e828fbb7..c29ae9cd2607 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi @@ -7,7 +7,16 @@ from typing import Literal, overload from PIL import Image from .drawing import DeviceGray, DeviceRGB -from .enums import Align, TableBordersLayout, TableCellFillMode, TableHeadingsDisplay, TableSpan, VAlign, WrapMode +from .enums import ( + Align, + CellBordersLayout, + TableBordersLayout, + TableCellFillMode, + TableHeadingsDisplay, + TableSpan, + VAlign, + WrapMode, +) from .fonts import FontFace from .fpdf import FPDF from .image_datastructures import _TextAlign @@ -70,6 +79,7 @@ class Row: rowspan: int = 1, padding: tuple[float, ...] | None = None, link: str | int | None = None, + border: CellBordersLayout | int = ..., ) -> str: ... @overload def cell( @@ -84,6 +94,7 @@ class Row: rowspan: int = 1, padding: tuple[float, ...] | None = None, link: str | int | None = None, + border: CellBordersLayout | int = ..., ) -> TableSpan: ... @dataclass @@ -98,6 +109,7 @@ class Cell: rowspan: int padding: int | tuple[float, ...] | None link: str | int | None + border: CellBordersLayout | None def write(self, text, align: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/util.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/util.pyi index de98dcc8f8c9..b8d0a8d57752 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/util.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/util.pyi @@ -27,6 +27,7 @@ def convert_unit( ROMAN_NUMERAL_MAP: Final[tuple[tuple[str, int], ...]] def int2roman(n: int) -> str: ... +def int_to_letters(n: int) -> str: ... def print_mem_usage(prefix: str) -> None: ... def get_mem_usage(prefix: str) -> str: ... def get_process_rss() -> str: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/gdb/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/gdb/METADATA.toml index 8aa64fa66bab..475788246998 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/gdb/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/gdb/METADATA.toml @@ -1,5 +1,5 @@ version = "15.0.*" -# This is the official web portal for GDB, +# This is the official web portal for the GDB Git repo, # see https://sourceware.org/gdb/current/ for other ways of obtaining the source code. upstream_repository = "https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=tree" extra_description = """\ diff --git a/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/__init__.pyi index b7cb8209f30a..7bf762889b23 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/__init__.pyi @@ -7,12 +7,11 @@ import threading from _typeshed import Incomplete from collections.abc import Callable, Iterator, Mapping, Sequence from contextlib import AbstractContextManager -from typing import Any, Final, Generic, Literal, Protocol, TypeVar, final, overload +from typing import Any, Final, Generic, Literal, Protocol, TypeVar, final, overload, type_check_only from typing_extensions import TypeAlias, deprecated import gdb.FrameDecorator import gdb.types -import gdb.unwinder import gdb.xmethod # The following submodules are automatically imported @@ -289,7 +288,15 @@ class PendingFrame: class UnwindInfo: def add_saved_register(self, reg: str | RegisterDescriptor | int, value: Value, /) -> None: ... -frame_unwinders: list[gdb.unwinder.Unwinder] +@type_check_only +class _Unwinder(Protocol): + @property + def name(self) -> str: ... + enabled: bool + + def __call__(self, pending_frame: PendingFrame) -> UnwindInfo | None: ... + +frame_unwinders: list[_Unwinder] # Inferiors @@ -468,7 +475,7 @@ class Progspace: pretty_printers: list[_PrettyPrinterLookupFunction] type_printers: list[gdb.types._TypePrinter] frame_filters: dict[str, _FrameFilter] - frame_unwinders: list[gdb.unwinder.Unwinder] + frame_unwinders: list[_Unwinder] missing_debug_handlers: Incomplete def block_for_pc(self, pc: int, /) -> Block | None: ... @@ -493,7 +500,7 @@ class Objfile: pretty_printers: list[_PrettyPrinterLookupFunction] type_printers: list[gdb.types._TypePrinter] frame_filters: dict[str, _FrameFilter] - frame_unwinders: list[gdb.unwinder.Unwinder] + frame_unwinders: list[_Unwinder] is_file: bool def is_valid(self) -> bool: ... @@ -664,21 +671,131 @@ class LineTable: # Breakpoints class Breakpoint: + + # The where="spec" form of __init__(). See py-breakpoints.c:bppy_init():keywords for the positional order. + @overload + def __init__( + self, + # where + spec: str, + # options + type: int = ..., + wp_class: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., + ) -> None: ... + + # The where="location" form of __init__(). A watchpoint (`type=BP_WATCHPOINT`) cannot be created with this form. + # + # We exclude the `wp_class` (watchpoint class) option here, even though py-breakpoints.c accepts it. It doesn't make sense + # unless type==BP_WATCHPOINT, and is silently ignored in those cases; allowing it in those cases is likely an oversight, not + # an intentional allowance. + # + # We repeat this 7 times because the type system doesn't have simple a way for us to say "at least one of `function`, `label`, + # or `line`", so we must repeat it for each combination of the 3. + # + # The len=3 combination. + @overload + def __init__( + self, + *, + # where + source: str = ..., + function: str, + label: str, + line: int | str, + # options + type: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., + ) -> None: ... + # The 3 len=2 combinations. + @overload + def __init__( + self, + *, + source: str = ..., + # where + label: str, + line: int | str, + # options + type: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., + ) -> None: ... + @overload + def __init__( + self, + *, + source: str = ..., + # where + function: str, + line: int | str, + # options + type: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., + ) -> None: ... @overload def __init__( - self, spec: str, type: int = ..., wp_class: int = ..., internal: bool = ..., temporary: bool = ..., qualified: bool = ... + self, + *, + source: str = ..., + # where + function: str, + label: str, + # options + type: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., ) -> None: ... + # The 3 len=1 combinations. @overload def __init__( self, + *, source: str = ..., - function: str = ..., - label: str = ..., - line: int = ..., + # where + function: str, + # options + type: int = ..., internal: bool = ..., temporary: bool = ..., qualified: bool = ..., ) -> None: ... + @overload + def __init__( + self, + *, + source: str = ..., + # where + label: str, + # options + type: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., + ) -> None: ... + @overload + def __init__( + self, + *, + source: str = ..., + # where + line: int | str, + # options + type: int = ..., + internal: bool = ..., + temporary: bool = ..., + qualified: bool = ..., + ) -> None: ... + + # Methods. def stop(self) -> bool: ... def is_valid(self) -> bool: ... def delete(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/unwinder.pyi b/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/unwinder.pyi index 8d9fdd0143e3..60a5f84d6dec 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/unwinder.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/gdb/gdb/unwinder.pyi @@ -1,5 +1,4 @@ import gdb -from gdb import Frame, UnwindInfo class FrameId: def __init__(self, sp: gdb.Value | int, pc: gdb.Value | int, special: gdb.Value | int | None = None) -> None: ... @@ -16,6 +15,6 @@ class Unwinder: enabled: bool def __init__(self, name: str) -> None: ... - def __call__(self, pending_frame: Frame) -> UnwindInfo | None: ... + def __call__(self, pending_frame: gdb.PendingFrame) -> gdb.UnwindInfo | None: ... -def register_unwinder(locus: gdb.Objfile | gdb.Progspace | None, unwinder: Unwinder, replace: bool = ...) -> None: ... +def register_unwinder(locus: gdb.Objfile | gdb.Progspace | None, unwinder: gdb._Unwinder, replace: bool = ...) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/select.pyi b/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/select.pyi index 1c86bc9180eb..b1313ceda1b7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/select.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/gevent/gevent/select.pyi @@ -1,4 +1,5 @@ import sys +from _typeshed import FileDescriptorLike from collections.abc import Iterable from select import error as error from typing import Any @@ -8,8 +9,12 @@ def select( ) -> tuple[list[Any], list[Any], list[Any]]: ... if sys.platform != "win32": - from select import poll as poll - __all__ = ["error", "poll", "select"] else: __all__ = ["error", "select"] + +class poll: + def register(self, fd: FileDescriptorLike, eventmask: int = ...) -> None: ... + def modify(self, fd: FileDescriptorLike, eventmask: int) -> None: ... + def poll(self, timeout: float | None = None) -> list[tuple[int, int]]: ... + def unregister(self, fd: FileDescriptorLike) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/METADATA.toml index 6ca7213ae262..5e6a9f36de50 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/METADATA.toml @@ -1,2 +1,2 @@ -version = "2.22.*" +version = "2.23.*" # upstream_repository = closed-source diff --git a/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/METADATA.toml index 14bf98b299d2..365a88f84835 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/METADATA.toml @@ -1,2 +1,2 @@ -version = "3.2.*" +version = "3.2.5" upstream_repository = "https://github.com/ibmdb/python-ibmdb" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/ibm_db.pyi b/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/ibm_db.pyi index 3840582334f6..685dc05245a5 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/ibm_db.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/ibm-db/ibm_db.pyi @@ -10,6 +10,7 @@ QUOTED_LITERAL_REPLACEMENT_OFF: int QUOTED_LITERAL_REPLACEMENT_ON: int SQL_API_SQLROWCOUNT: int SQL_ATTR_AUTOCOMMIT: int +SQL_ATTR_CALL_RETURN: int SQL_ATTR_CURRENT_SCHEMA: int SQL_ATTR_CURSOR_TYPE: int SQL_ATTR_INFO_ACCTSTR: int @@ -69,6 +70,11 @@ SQL_SMALLINT: int SQL_TABLE_STAT: int SQL_TINYINT: int SQL_TRUE: int +SQL_TXN_NO_COMMIT: int +SQL_TXN_READ_COMMITTED: int +SQL_TXN_READ_UNCOMMITTED: int +SQL_TXN_REPEATABLE_READ: int +SQL_TXN_SERIALIZABLE: int SQL_TYPE_DATE: int SQL_TYPE_TIME: int SQL_TYPE_TIMESTAMP: int @@ -83,7 +89,6 @@ USE_WCHAR: int WCHAR_NO: int WCHAR_YES: int -# TODO: SQL_ATTR_TXN_ISOLATION: int SQL_ATTR_ACCESS_MODE: int SQL_ATTR_ALLOW_INTERLEAVED_GETDATA: int SQL_ATTR_ANSI_APP: int @@ -262,6 +267,7 @@ def connect( def createdb(connection: IBM_DBConnection, dbName: str, codeSet: str = ..., mode: str = ..., /) -> bool: ... def createdbNX(connection: IBM_DBConnection, dbName: str, codeSet: str = ..., mode: str = ..., /) -> bool: ... def cursor_type(stmt: IBM_DBStatement, /) -> int: ... +def debug(option: str | bool) -> None: ... def dropdb(connection: IBM_DBConnection, dbName: str, /) -> bool: ... def exec_immediate( connection: IBM_DBConnection, statement: str | None, options: dict[int, int] = ..., / @@ -270,6 +276,9 @@ def execute(stmt: IBM_DBStatement, parameters: tuple[object, ...] | None = ..., def execute_many( stmt: IBM_DBStatement, seq_of_parameters: tuple[object, ...], options: dict[int, int] = ..., / ) -> int | None: ... +def fetchall(stmt: IBM_DBStatement, /) -> list[tuple[object, ...]]: ... +def fetchmany(stmt: IBM_DBStatement, numberOfRows: int, /) -> list[tuple[object, ...]]: ... +def fetchone(stmt: IBM_DBStatement, /) -> tuple[object, ...]: ... def fetch_assoc(stmt: IBM_DBStatement, row_number: int = ..., /) -> dict[str, object] | bool: ... def fetch_both(stmt: IBM_DBStatement, row_number: int = ..., /) -> dict[int | str, object] | bool: ... def fetch_row(stmt: IBM_DBStatement, row_number: int = ..., /) -> bool: ... @@ -298,6 +307,7 @@ def get_db_info(connection: IBM_DBConnection, option: int, /) -> str | bool: ... def get_last_serial_value(stmt: IBM_DBStatement, /) -> str | bool: ... def get_num_result(stmt: IBM_DBStatement, /) -> int | bool: ... def get_option(resc: IBM_DBConnection | IBM_DBStatement, options: int, type: int, /) -> Any: ... +def get_sqlcode(connection_or_stmt: IBM_DBConnection | IBM_DBStatement | None = None, /) -> str: ... def next_result(stmt: IBM_DBStatement, /) -> IBM_DBStatement | bool: ... def num_fields(stmt: IBM_DBStatement, /) -> int | bool: ... def num_rows(stmt: IBM_DBStatement, /) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml index 18d11b38fe89..b38656b30402 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/METADATA.toml @@ -1,10 +1,6 @@ version = "6.1.*" upstream_repository = "https://github.com/collective/icalendar" -requires = [ - "types-python-dateutil", - "types-pytz", - "backports.zoneinfo; python_version<'3.9'", -] +requires = ["types-python-dateutil", "types-pytz"] [tool.stubtest] stubtest_requirements = ["pytz"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi index 7a2102561c60..269bdf742af9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/icalendar/icalendar/timezone/tzp.pyi @@ -23,7 +23,7 @@ class TZP: def fix_rrule_until(self, rrule: rrule, ical_rrule: vRecur) -> None: ... def create_timezone(self, timezone_component: Timezone) -> datetime.tzinfo: ... def clean_timezone_id(self, tzid: str) -> str: ... - def timezone(self, id: str) -> datetime.tzinfo | None: ... + def timezone(self, tz_id: str) -> datetime.tzinfo | None: ... def uses_pytz(self) -> bool: ... def uses_zoneinfo(self) -> bool: ... @property diff --git a/packages/pyright-internal/typeshed-fallback/stubs/jsonschema/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/jsonschema/METADATA.toml index a4fabbc736b5..5e2ea3e07240 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/jsonschema/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/jsonschema/METADATA.toml @@ -6,5 +6,3 @@ partial_stub = true [tool.stubtest] ignore_missing_stub = true extras = ["format"] -# see https://github.com/python/typeshed/issues/12107 for the reason for the pin -stubtest_requirements = ["webcolors<24.6.0"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwk.pyi b/packages/pyright-internal/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwk.pyi index c86ff358d0cd..f5638cddf622 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwk.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/jwcrypto/jwcrypto/jwk.pyi @@ -29,10 +29,10 @@ priv_bytes: Incomplete JWKTypesRegistry: Incomplete class ParmType(Enum): - name: str - b64: str - b64u: str - unsupported: str + name = "A string with a name" # pyright: ignore[reportAssignmentType] + b64 = "Base64url Encoded" + b64u = "Base64urlUint Encoded" + unsupported = "Unsupported Parameter" class JWKParameter(NamedTuple): description: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/lupa/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/lupa/METADATA.toml index 6f7ead243686..4c6af6eeb903 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/lupa/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/lupa/METADATA.toml @@ -1,2 +1,2 @@ -version = "2.2.*" +version = "2.4.*" upstream_repository = "https://github.com/scoder/lupa" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/m3u8/m3u8/httpclient.pyi b/packages/pyright-internal/typeshed-fallback/stubs/m3u8/m3u8/httpclient.pyi index de76c1b84164..96569e96e167 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/m3u8/m3u8/httpclient.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/m3u8/m3u8/httpclient.pyi @@ -16,4 +16,4 @@ class DefaultHTTPClient: ) -> tuple[str, str]: ... class HTTPSHandler: - def __new__(cls, verify_ssl: bool = True) -> urllib.request.HTTPSHandler: ... # type: ignore + def __new__(cls, verify_ssl: bool = True) -> urllib.request.HTTPSHandler: ... # type: ignore[misc] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/METADATA.toml new file mode 100644 index 000000000000..4d240e218e47 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/METADATA.toml @@ -0,0 +1,2 @@ +version = "2.1.*" +upstream_repository = "https://github.com/MylesMor/nanoleafapi" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/__init__.pyi new file mode 100644 index 000000000000..78cdd18a19f5 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/__init__.pyi @@ -0,0 +1,16 @@ +from nanoleafapi.digital_twin import NanoleafDigitalTwin as NanoleafDigitalTwin +from nanoleafapi.nanoleaf import ( + BLUE as BLUE, + GREEN as GREEN, + LIGHT_BLUE as LIGHT_BLUE, + ORANGE as ORANGE, + PINK as PINK, + PURPLE as PURPLE, + RED as RED, + WHITE as WHITE, + YELLOW as YELLOW, + Nanoleaf as Nanoleaf, + NanoleafConnectionError as NanoleafConnectionError, + NanoleafEffectCreationError as NanoleafEffectCreationError, + NanoleafRegistrationError as NanoleafRegistrationError, +) diff --git a/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/digital_twin.pyi b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/digital_twin.pyi new file mode 100644 index 000000000000..5da49f6bedef --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/digital_twin.pyi @@ -0,0 +1,12 @@ +from nanoleafapi.nanoleaf import Nanoleaf + +class NanoleafDigitalTwin: + nanoleaf: Nanoleaf + tile_dict: dict[str, dict[str, int]] + def __init__(self, nl: Nanoleaf) -> None: ... + def set_color(self, panel_id: int, rgb: tuple[int, int, int]) -> None: ... + def set_all_colors(self, rgb: tuple[int, int, int]) -> None: ... + def get_ids(self) -> list[int]: ... + def get_color(self, panel_id: int) -> tuple[int, int, int]: ... + def get_all_colors(self) -> dict[int, tuple[int, int, int]]: ... + def sync(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/discovery.pyi b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/discovery.pyi new file mode 100644 index 000000000000..233eb0cd2553 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/discovery.pyi @@ -0,0 +1 @@ +def discover_devices(timeout: int = 30, debug: bool = False) -> dict[str | None, str]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/nanoleaf.pyi b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/nanoleaf.pyi new file mode 100644 index 000000000000..d83625ad5285 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/nanoleafapi/nanoleafapi/nanoleaf.pyi @@ -0,0 +1,68 @@ +from _typeshed import Incomplete +from collections.abc import Callable +from typing import Any + +RED: tuple[int, int, int] +ORANGE: tuple[int, int, int] +YELLOW: tuple[int, int, int] +GREEN: tuple[int, int, int] +LIGHT_BLUE: tuple[int, int, int] +BLUE: tuple[int, int, int] +PINK: tuple[int, int, int] +PURPLE: tuple[int, int, int] +WHITE: tuple[int, int, int] + +class Nanoleaf: + ip: str + print_errors: bool + url: str + auth_token: str + already_registered: bool + def __init__(self, ip: str, auth_token: str | None = None, print_errors: bool = False) -> None: ... + def create_auth_token(self) -> str | None: ... + def delete_auth_token(self, auth_token: str) -> bool: ... + def check_connection(self) -> None: ... + def get_info(self) -> dict[str, Incomplete]: ... + def get_name(self) -> str: ... + def get_auth_token(self) -> str | None: ... + def get_ids(self) -> list[int]: ... + @staticmethod + def get_custom_base_effect(anim_type: str = "custom", loop: bool = True) -> dict[str, Incomplete]: ... + def power_off(self) -> bool: ... + def power_on(self) -> bool: ... + def get_power(self) -> bool: ... + def toggle_power(self) -> bool: ... + def set_color(self, rgb: tuple[int, int, int]) -> bool: ... + def set_brightness(self, brightness: int, duration: int = 0) -> bool: ... + def increment_brightness(self, brightness: int) -> bool: ... + def get_brightness(self) -> int: ... + def identify(self) -> bool: ... + def set_hue(self, value: int) -> bool: ... + def increment_hue(self, value: int) -> bool: ... + def get_hue(self) -> int: ... + def set_saturation(self, value: int) -> bool: ... + def increment_saturation(self, value: int) -> bool: ... + def get_saturation(self) -> int: ... + def set_color_temp(self, value: int) -> bool: ... + def increment_color_temp(self, value: int) -> bool: ... + def get_color_temp(self) -> int: ... + def get_color_mode(self) -> str: ... + def get_current_effect(self) -> str: ... + def set_effect(self, effect_name: str) -> bool: ... + def list_effects(self) -> list[str]: ... + def write_effect(self, effect_dict: dict[str, Incomplete]) -> bool: ... + def effect_exists(self, effect_name: str) -> bool: ... + def pulsate(self, rgb: tuple[int, int, int], speed: float = 1) -> bool: ... + def flow(self, rgb_list: list[tuple[int, int, int]], speed: float = 1) -> bool: ... + def spectrum(self, speed: float = 1) -> bool: ... + def enable_extcontrol(self) -> bool: ... + def get_layout(self) -> dict[str, Incomplete]: ... + def register_event(self, func: Callable[[dict[str, Incomplete]], Any], event_types: list[int]) -> None: ... + +class NanoleafRegistrationError(Exception): + def __init__(self) -> None: ... + +class NanoleafConnectionError(Exception): + def __init__(self) -> None: ... + +class NanoleafEffectCreationError(Exception): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/multidigraph.pyi b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/multidigraph.pyi index e9a2b91b1c5b..fac4ea0c0acd 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/multidigraph.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/networkx/classes/multidigraph.pyi @@ -20,6 +20,6 @@ class MultiDiGraph(MultiGraph[_Node], DiGraph[_Node]): def in_degree(self) -> InMultiDegreeView[_Node]: ... @cached_property def out_degree(self) -> OutMultiDegreeView[_Node]: ... - def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> MultiGraph[_Node]: ... # type: ignore + def to_undirected(self, reciprocal: bool = False, as_view: bool = False) -> MultiGraph[_Node]: ... # type: ignore[override] def reverse(self, copy: bool = True) -> MultiDiGraph[_Node]: ... def copy(self, as_view: bool = False) -> MultiDiGraph[_Node]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/cell_style.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/cell_style.pyi index cc97daf6abdc..c1867a7b356f 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/cell_style.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/cell_style.pyi @@ -31,7 +31,7 @@ class StyleArray(array[int]): xfId: ArrayDescriptor[int] def __new__(cls, args: bytes | bytearray | Iterable[int] = [0, 0, 0, 0, 0, 0, 0, 0, 0]) -> Self: ... def __init__(self, args: bytes | bytearray | Iterable[int] = [0, 0, 0, 0, 0, 0, 0, 0, 0]) -> None: ... - def __hash__(self) -> int: ... + def __hash__(self) -> int: ... # type: ignore[override] def __copy__(self) -> StyleArray: ... def __deepcopy__(self, memo: Unused) -> StyleArray: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi b/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi index 511b205e8845..f9066c393709 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi @@ -838,7 +838,7 @@ class Database(_callable_context_manager): def rollback(self): ... def batch_commit(self, it, n) -> Generator[Incomplete, None, None]: ... def table_exists(self, table_name, schema: str | None = None): ... - def get_tables(self, schema: str | None = None) -> None: ... + def get_tables(self, schema: str | None = None) -> list[str]: ... def get_indexes(self, table, schema: str | None = None) -> list[IndexMetadata]: ... def get_columns(self, table, schema: str | None = None) -> list[ColumnMetadata]: ... def get_primary_keys(self, table, schema: str | None = None) -> None: ... @@ -909,7 +909,7 @@ class SqliteDatabase(Database): def last_insert_id(self, cursor, query_type: Incomplete | None = ...): ... def rows_affected(self, cursor): ... def begin(self, lock_type: Incomplete | None = ...) -> None: ... - def get_tables(self, schema: str | None = None): ... + def get_tables(self, schema: str | None = None) -> list[str]: ... def get_views(self, schema: str | None = None) -> list[ViewMetadata]: ... def get_indexes(self, table, schema: str | None = None) -> list[IndexMetadata]: ... def get_columns(self, table, schema: str | None = None) -> list[ColumnMetadata]: ... @@ -946,7 +946,7 @@ class PostgresqlDatabase(Database): def last_insert_id(self, cursor, query_type: Incomplete | None = ...): ... def rows_affected(self, cursor): ... def begin(self, isolation_level: str | None = None) -> None: ... - def get_tables(self, schema: str | None = None): ... + def get_tables(self, schema: str | None = None) -> list[str]: ... def get_views(self, schema: str | None = None) -> list[ViewMetadata]: ... def get_indexes(self, table, schema: str | None = None) -> list[IndexMetadata]: ... def get_columns(self, table, schema: str | None = None) -> list[ColumnMetadata]: ... @@ -980,7 +980,7 @@ class MySQLDatabase(Database): def is_connection_usable(self) -> bool: ... def default_values_insert(self, ctx): ... def begin(self, isolation_level: str | None = None) -> None: ... - def get_tables(self, schema: str | None = None): ... + def get_tables(self, schema: str | None = None) -> list[str]: ... def get_views(self, schema: str | None = None) -> list[ViewMetadata]: ... def get_indexes(self, table, schema: str | None = None) -> list[IndexMetadata]: ... def get_columns(self, table, schema: str | None = None) -> list[ColumnMetadata]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pexpect/pexpect/pty_spawn.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pexpect/pexpect/pty_spawn.pyi index 4c1d7d967755..64a9546ee8bb 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pexpect/pexpect/pty_spawn.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pexpect/pexpect/pty_spawn.pyi @@ -61,7 +61,7 @@ class spawn(SpawnBase[AnyStr]): def eof(self) -> bool: ... def terminate(self, force: bool = False) -> bool: ... status: int | None - exitstatus: bool | None + exitstatus: int | None signalstatus: int | None terminated: bool def wait(self) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pika/pika/credentials.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pika/pika/credentials.pyi index 86956e6832c6..5fba83c452a3 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pika/pika/credentials.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pika/pika/credentials.pyi @@ -1,20 +1,23 @@ -from _typeshed import Incomplete from logging import Logger -from typing import ClassVar -from typing_extensions import TypeAlias +from typing import ClassVar, Protocol from .spec import Connection -# TODO: This could be turned into a protocol. -_Credentials: TypeAlias = Incomplete # noqa: Y047 +class _Credentials(Protocol): + TYPE: ClassVar[str] + erase_on_connect: bool + def __eq__(self, other: object) -> bool: ... + def __ne__(self, other: object) -> bool: ... + def response_for(self, start: Connection.Start) -> tuple[str | None, bytes | None]: ... + def erase_credentials(self) -> None: ... LOGGER: Logger class PlainCredentials: TYPE: ClassVar[str] + erase_on_connect: bool username: str password: str - erase_on_connect: bool def __init__(self, username: str, password: str, erase_on_connect: bool = False) -> None: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... @@ -30,4 +33,4 @@ class ExternalCredentials: def response_for(self, start: Connection.Start) -> tuple[str | None, bytes | None]: ... def erase_credentials(self) -> None: ... -VALID_TYPES: Incomplete +VALID_TYPES: list[_Credentials] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/polib/polib.pyi b/packages/pyright-internal/typeshed-fallback/stubs/polib/polib.pyi index 0788fe8ca3b4..fa7061f1f6ab 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/polib/polib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/polib/polib.pyi @@ -1,4 +1,5 @@ from collections.abc import Callable +from pathlib import Path from typing import IO, Any, Generic, Literal, SupportsIndex, TypeVar, overload _TB = TypeVar("_TB", bound=_BaseEntry) @@ -11,9 +12,9 @@ default_encoding: str # encoding: str # check_for_duplicates: bool @overload -def pofile(pofile: str, *, klass: type[_TP], **kwargs: Any) -> _TP: ... +def pofile(pofile: str | Path, *, klass: type[_TP], **kwargs: Any) -> _TP: ... @overload -def pofile(pofile: str, **kwargs: Any) -> POFile: ... +def pofile(pofile: str | Path, **kwargs: Any) -> POFile: ... @overload def mofile(mofile: str, *, klass: type[_TM], **kwargs: Any) -> _TM: ... @overload diff --git a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml index 8349e2ea04fc..04c674e5fbc1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml @@ -1,7 +1,7 @@ # Using an exact number in the specifier for scripts/sync_protobuf/google_protobuf.py -version = "~=5.28.3" +version = "~=5.29.1" upstream_repository = "https://github.com/protocolbuffers/protobuf" -extra_description = "Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 27.2 on [protobuf v28.3](https://github.com/protocolbuffers/protobuf/releases/tag/v28.3) (python `protobuf==5.28.3`)." +extra_description = "Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 28.1 on [protobuf v29.1](https://github.com/protocolbuffers/protobuf/releases/tag/v29.1) (python `protobuf==5.29.1`)." partial_stub = true [tool.stubtest] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/api_pb2.pyi b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/api_pb2.pyi index 71205bfe4531..f48ce3dd2de2 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/api_pb2.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/api_pb2.pyi @@ -220,7 +220,7 @@ class Mixin(google.protobuf.message.Message): The mixin construct implies that all methods in `AccessControl` are also declared with same name and request/response types in `Storage`. A documentation generator or annotation processor will - see the effective `Storage.GetAcl` method after inherting + see the effective `Storage.GetAcl` method after inheriting documentation and annotations as follows: service Storage { diff --git a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi index 48d88f0b07e5..ddf523d56c8b 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/descriptor_pb2.pyi @@ -54,7 +54,7 @@ class _EditionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTy EDITION_2024: _Edition.ValueType # 1001 EDITION_1_TEST_ONLY: _Edition.ValueType # 1 """Placeholder editions for testing feature resolution. These should not be - used or relyed on outside of tests. + used or relied on outside of tests. """ EDITION_2_TEST_ONLY: _Edition.ValueType # 2 EDITION_99997_TEST_ONLY: _Edition.ValueType # 99997 @@ -90,7 +90,7 @@ comparison. EDITION_2024: Edition.ValueType # 1001 EDITION_1_TEST_ONLY: Edition.ValueType # 1 """Placeholder editions for testing feature resolution. These should not be -used or relyed on outside of tests. +used or relied on outside of tests. """ EDITION_2_TEST_ONLY: Edition.ValueType # 2 EDITION_99997_TEST_ONLY: Edition.ValueType # 99997 @@ -1188,10 +1188,7 @@ class FieldOptions(google.protobuf.message.Message): RETENTION_SOURCE: FieldOptions._OptionRetention.ValueType # 2 class OptionRetention(_OptionRetention, metaclass=_OptionRetentionEnumTypeWrapper): - """If set to RETENTION_SOURCE, the option will be omitted from the binary. - Note: as of January 2023, support for this is in progress and does not yet - have an effect (b/264593489). - """ + """If set to RETENTION_SOURCE, the option will be omitted from the binary.""" RETENTION_UNKNOWN: FieldOptions.OptionRetention.ValueType # 0 RETENTION_RUNTIME: FieldOptions.OptionRetention.ValueType # 1 @@ -1217,8 +1214,7 @@ class FieldOptions(google.protobuf.message.Message): class OptionTargetType(_OptionTargetType, metaclass=_OptionTargetTypeEnumTypeWrapper): """This indicates the types of entities that the field may apply to when used as an option. If it is unset, then the field may be freely used as an - option on any kind of entity. Note: as of January 2023, support for this is - in progress and does not yet have an effect (b/264593489). + option on any kind of entity. """ TARGET_TYPE_UNKNOWN: FieldOptions.OptionTargetType.ValueType # 0 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/runtime_version.pyi b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/runtime_version.pyi new file mode 100644 index 000000000000..c6e1f8406216 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/google/protobuf/runtime_version.pyi @@ -0,0 +1,23 @@ +from enum import Enum +from typing import Final + +class Domain(Enum): + GOOGLE_INTERNAL = 1 + PUBLIC = 2 + +OSS_DOMAIN: Final[Domain] +OSS_MAJOR: Final[int] +OSS_MINOR: Final[int] +OSS_PATCH: Final[int] +OSS_SUFFIX: Final[str] +DOMAIN: Final[Domain] +MAJOR: Final[int] +MINOR: Final[int] +PATCH: Final[int] +SUFFIX: Final[str] + +class VersionError(Exception): ... + +def ValidateProtobufRuntimeVersion( + gen_domain: Domain, gen_major: int, gen_minor: int, gen_patch: int, gen_suffix: str, location: str +) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/METADATA.toml index 3dd21238383c..cd764fe93749 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/METADATA.toml @@ -1,2 +1,3 @@ version = "2.0.*" upstream_repository = "https://github.com/ppwwyyxx/cocoapi" +requires = ["numpy>=2.0.0rc1"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/coco.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/coco.pyi index 3cac74aeda72..dfb4b3ca4c7c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/coco.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/coco.pyi @@ -1,17 +1,14 @@ -from _typeshed import Incomplete from collections.abc import Collection, Sequence from pathlib import Path from typing import Generic, Literal, TypedDict, TypeVar, overload from typing_extensions import TypeAlias -from . import _EncodedRLE +import numpy as np +import numpy.typing as npt -# TODO: Use numpy types when #5768 is resolved. -# import numpy as np -# import numpy.typing as npt +from . import _EncodedRLE -PYTHON_VERSION: Incomplete -_NDArray: TypeAlias = Incomplete +PYTHON_VERSION: int class _Image(TypedDict): id: int @@ -82,13 +79,11 @@ class COCO: def showAnns(self, anns: Sequence[_Annotation], draw_bbox: bool = False) -> None: ... def loadRes(self, resFile: str) -> COCO: ... def download(self, tarDir: str | None = None, imgIds: Collection[int] = []) -> Literal[-1] | None: ... - def loadNumpyAnnotations(self, data: _NDArray) -> list[_Annotation]: ... - # def loadNumpyAnnotations(self, data: npt.NDArray[np.float64]) -> list[_Annotation]: ... + def loadNumpyAnnotations(self, data: npt.NDArray[np.float64]) -> list[_Annotation]: ... @overload def annToRLE(self, ann: _AnnotationG[_RLE]) -> _RLE: ... @overload def annToRLE(self, ann: _AnnotationG[_EncodedRLE]) -> _EncodedRLE: ... @overload def annToRLE(self, ann: _AnnotationG[_TPolygonSegmentation]) -> _EncodedRLE: ... - def annToMask(self, ann: _Annotation) -> _NDArray: ... - # def annToMask(self, ann: _Annotation) -> npt.NDArray[np.uint8]: ... + def annToMask(self, ann: _Annotation) -> npt.NDArray[np.uint8]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/cocoeval.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/cocoeval.pyi index 5dedb9bf1aea..262b9dc3f8dd 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/cocoeval.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/cocoeval.pyi @@ -1,14 +1,12 @@ -from _typeshed import Incomplete from typing import Literal, TypedDict from typing_extensions import TypeAlias -from .coco import COCO +import numpy as np +import numpy.typing as npt -# TODO: Use numpy types when #5768 is resolved. -# import numpy as np -# import numpy.typing as npt +from .coco import COCO -_NDArray: TypeAlias = Incomplete +_NDFloatArray: TypeAlias = npt.NDArray[np.float64] _TIOU: TypeAlias = Literal["segm", "bbox", "keypoints"] class _ImageEvaluationResult(TypedDict): @@ -18,26 +16,19 @@ class _ImageEvaluationResult(TypedDict): maxDet: int dtIds: list[int] gtIds: list[int] - dtMatches: _NDArray - # dtMatches: npt.NDArray[np.float64] - gtMatches: _NDArray - # gtMatches: npt.NDArray[np.float64] + dtMatches: _NDFloatArray + gtMatches: _NDFloatArray dtScores: list[float] - gtIgnore: _NDArray - # gtIgnore: npt.NDArray[np.float64] - dtIgnore: _NDArray - # dtIgnore: npt.NDArray[np.float64] + gtIgnore: _NDFloatArray + dtIgnore: _NDFloatArray class _EvaluationResult(TypedDict): params: Params counts: list[int] date: str - # precision: npt.NDArray[np.float64] - precision: _NDArray - # recall: npt.NDArray[np.float64] - recall: _NDArray - # scores: npt.NDArray[np.float64] - scores: _NDArray + precision: _NDFloatArray + recall: _NDFloatArray + scores: _NDFloatArray class COCOeval: cocoGt: COCO @@ -45,14 +36,12 @@ class COCOeval: evalImgs: list[_ImageEvaluationResult] eval: _EvaluationResult params: Params - stats: _NDArray - # stats: npt.NDArray[np.float64] + stats: _NDFloatArray ious: dict[tuple[int, int], list[float]] def __init__(self, cocoGt: COCO | None = None, cocoDt: COCO | None = None, iouType: _TIOU = "segm") -> None: ... def evaluate(self) -> None: ... def computeIoU(self, imgId: int, catId: int) -> list[float]: ... - def computeOks(self, imgId: int, catId: int) -> _NDArray: ... - # def computeOks(self, imgId: int, catId: int) -> npt.NDArray[np.float64]: ... + def computeOks(self, imgId: int, catId: int) -> _NDFloatArray: ... def evaluateImg(self, imgId: int, catId: int, aRng: list[int], maxDet: int) -> _ImageEvaluationResult: ... def accumulate(self, p: Params | None = None) -> None: ... def summarize(self) -> None: ... @@ -60,16 +49,13 @@ class COCOeval: class Params: imgIds: list[int] catIds: list[int] - iouThrs: _NDArray - # iouThrs: npt.NDArray[np.float64] - recThrs: _NDArray - # recThrs: npt.NDArray[np.float64] + iouThrs: _NDFloatArray + recThrs: _NDFloatArray maxDets: list[int] areaRng: list[list[float]] areaRngLbl: list[str] useCats: int - kpt_oks_sigmas: _NDArray - # kpt_oks_sigmas: npt.NDArray[np.float64] + kpt_oks_sigmas: _NDFloatArray iouType: _TIOU useSegm: int | None def __init__(self, iouType: _TIOU = "segm") -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/mask.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/mask.pyi index 37825152c91f..3ce14d3b1f4a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/mask.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pycocotools/pycocotools/mask.pyi @@ -1,17 +1,15 @@ -from _typeshed import Incomplete from typing import Any, overload from typing_extensions import TypeAlias -from . import _EncodedRLE +import numpy as np +import numpy.typing as npt -# TODO: Use numpy types when #5768 is resolved. -# import numpy as np -# import numpy.typing as npt +from . import _EncodedRLE -_NPUInt32: TypeAlias = Incomplete # np.uint32 -_NDArrayUInt8: TypeAlias = Incomplete # npt.NDArray[np.uint8] -_NDArrayUInt32: TypeAlias = Incomplete # npt.NDArray[np.uint32] -_NDArrayFloat64: TypeAlias = Incomplete # npt.NDArray[np.float64] +_NPUInt32: TypeAlias = np.uint32 +_NDArrayUInt8: TypeAlias = npt.NDArray[np.uint8] +_NDArrayUInt32: TypeAlias = npt.NDArray[np.uint32] +_NDArrayFloat64: TypeAlias = npt.NDArray[np.float64] def iou( dt: _NDArrayUInt32 | list[float] | list[_EncodedRLE], diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pycurl/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/pycurl/METADATA.toml index f6e2bec005ce..09ac8a43ea91 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pycurl/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/pycurl/METADATA.toml @@ -1,4 +1,4 @@ -version = "7.45.3" +version = "7.45.4" upstream_repository = "https://github.com/pycurl/pycurl" [tool.stubtest] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pycurl/pycurl.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pycurl/pycurl.pyi index db0bb87c7902..197912f92e9f 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pycurl/pycurl.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pycurl/pycurl.pyi @@ -30,7 +30,7 @@ class Curl: def errstr(self) -> str: ... def duphandle(self) -> Self: ... def errstr_raw(self) -> bytes: ... - if sys.platform == "linux": + if sys.platform == "linux" or sys.platform == "darwin": def set_ca_certs(self, value: bytes | str, /) -> None: ... @final @@ -53,45 +53,16 @@ class CurlShare: def close(self) -> None: ... def setopt(self, option: int, value): ... -if sys.platform != "linux": - AWS_SIGV4: Final = 10305 - CAINFO_BLOB: Final = 40309 - CURL_HTTP_VERSION_3: Final = 30 - CURL_VERSION_ALTSVC: Final = 16777216 - CURL_VERSION_GSASL: Final = 536870912 - CURL_VERSION_HSTS: Final = 268435456 - CURL_VERSION_HTTP3: Final = 33554432 - CURL_VERSION_UNICODE: Final = 134217728 - CURL_VERSION_ZSTD: Final = 67108864 - DOH_URL: Final = 10279 - HTTP09_ALLOWED: Final = 285 - ISSUERCERT_BLOB: Final = 40295 - MAXLIFETIME_CONN: Final = 314 - MAXAGE_CONN: Final = 288 - M_MAX_CONCURRENT_STREAMS: Final = 16 - PROXY_CAINFO_BLOB: Final = 40310 - PROXY_ISSUERCERT: Final = 10296 - PROXY_ISSUERCERT_BLOB: Final = 40297 - PROXY_SSLCERT_BLOB: Final = 40293 - PROXY_SSLKEY_BLOB: Final = 40294 - SSLCERT_BLOB: Final = 40291 - SSLKEY_BLOB: Final = 40292 - UPLOAD_BUFFERSIZE: Final = 280 - VERSION_ALTSVC: Final = 16777216 - VERSION_GSASL: Final = 536870912 - VERSION_HSTS: Final = 268435456 - VERSION_HTTP3: Final = 33554432 - VERSION_UNICODE: Final = 134217728 - VERSION_ZSTD: Final = 67108864 - ACCEPTTIMEOUT_MS: Final = 212 ACCEPT_ENCODING: Final = 10102 ADDRESS_SCOPE: Final = 171 APPCONNECT_TIME: Final = 3145761 APPEND: Final = 50 AUTOREFERER: Final = 58 +AWS_SIGV4: Final = 10305 BUFFERSIZE: Final = 98 CAINFO: Final = 10065 +CAINFO_BLOB: Final = 40309 CAPATH: Final = 10097 CLOSESOCKETFUNCTION: Final = 20208 COMPILE_LIBCURL_VERSION_NUM: Final = 525824 @@ -123,11 +94,19 @@ CURL_HTTP_VERSION_2: Final = 3 CURL_HTTP_VERSION_2TLS: Final = 4 CURL_HTTP_VERSION_2_0: Final = 3 CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE: Final = 5 +CURL_HTTP_VERSION_3: Final = 30 +CURL_HTTP_VERSION_3ONLY: Final = 31 CURL_HTTP_VERSION_LAST: Final = 32 CURL_HTTP_VERSION_NONE: Final = 0 +CURL_VERSION_ALTSVC: Final = 16777216 CURL_VERSION_BROTLI: Final = 8388608 +CURL_VERSION_GSASL: Final = 536870912 +CURL_VERSION_HSTS: Final = 268435456 +CURL_VERSION_HTTP3: Final = 33554432 CURL_VERSION_HTTPS_PROXY: Final = 2097152 CURL_VERSION_MULTI_SSL: Final = 4194304 +CURL_VERSION_UNICODE: Final = 134217728 +CURL_VERSION_ZSTD: Final = 67108864 CUSTOMREQUEST: Final = 10036 DEBUGFUNCTION: Final = 20094 DEFAULT_PROTOCOL: Final = 10238 @@ -135,7 +114,9 @@ DIRLISTONLY: Final = 48 DNS_CACHE_TIMEOUT: Final = 92 DNS_SERVERS: Final = 10211 DNS_USE_GLOBAL_CACHE: Final = 91 +DOH_URL: Final = 10279 EFFECTIVE_URL: Final = 1048577 +EFFECTIVE_METHOD: Final = 1048634 EGDSOCKET: Final = 10077 ENCODING: Final = 10102 EXPECT_100_TIMEOUT_MS: Final = 227 @@ -310,12 +291,14 @@ GSSAPI_DELEGATION_FLAG: Final = 2 GSSAPI_DELEGATION_NONE: Final = 0 GSSAPI_DELEGATION_POLICY_FLAG: Final = 1 HAPROXYPROTOCOL: Final = 274 +HAPROXY_CLIENT_IP: Final = 10323 HEADER: Final = 42 HEADERFUNCTION: Final = 20079 HEADEROPT: Final = 229 HEADER_SEPARATE: Final = 1 HEADER_SIZE: Final = 2097163 HEADER_UNIFIED: Final = 0 +HTTP09_ALLOWED: Final = 285 HTTP200ALIASES: Final = 10104 HTTPAUTH: Final = 107 HTTPAUTH_ANY: Final = -17 @@ -370,6 +353,7 @@ IPRESOLVE_V4: Final = 1 IPRESOLVE_V6: Final = 2 IPRESOLVE_WHATEVER: Final = 0 ISSUERCERT: Final = 10170 +ISSUERCERT_BLOB: Final = 40295 KEYPASSWD: Final = 10026 KHMATCH_MISMATCH: Final = 1 KHMATCH_MISSING: Final = 2 @@ -400,15 +384,18 @@ LOW_SPEED_TIME: Final = 20 MAIL_AUTH: Final = 10217 MAIL_FROM: Final = 10186 MAIL_RCPT: Final = 10187 +MAXAGE_CONN: Final = 288 MAXCONNECTS: Final = 71 MAXFILESIZE: Final = 30117 MAXFILESIZE_LARGE: Final = 30117 +MAXLIFETIME_CONN: Final = 314 MAXREDIRS: Final = 68 MAX_RECV_SPEED_LARGE: Final = 30146 MAX_SEND_SPEED_LARGE: Final = 30145 M_CHUNK_LENGTH_PENALTY_SIZE: Final = 30010 M_CONTENT_LENGTH_PENALTY_SIZE: Final = 30009 M_MAXCONNECTS: Final = 6 +M_MAX_CONCURRENT_STREAMS: Final = 16 M_MAX_HOST_CONNECTIONS: Final = 7 M_MAX_PIPELINE_LENGTH: Final = 8 M_MAX_TOTAL_CONNECTIONS: Final = 13 @@ -517,15 +504,20 @@ PROXYTYPE_SOCKS5_HOSTNAME: Final = 7 PROXYUSERNAME: Final = 10175 PROXYUSERPWD: Final = 10006 PROXY_CAINFO: Final = 10246 +PROXY_CAINFO_BLOB: Final = 40310 PROXY_CAPATH: Final = 10247 PROXY_CRLFILE: Final = 10260 +PROXY_ISSUERCERT: Final = 10296 +PROXY_ISSUERCERT_BLOB: Final = 40297 PROXY_KEYPASSWD: Final = 10258 PROXY_PINNEDPUBLICKEY: Final = 10263 PROXY_SERVICE_NAME: Final = 10235 PROXY_SSLCERT: Final = 10254 PROXY_SSLCERTTYPE: Final = 10255 +PROXY_SSLCERT_BLOB: Final = 40293 PROXY_SSLKEY: Final = 10256 PROXY_SSLKEYTYPE: Final = 10257 +PROXY_SSLKEY_BLOB: Final = 40294 PROXY_SSLVERSION: Final = 250 PROXY_SSL_CIPHER_LIST: Final = 10259 PROXY_SSL_OPTIONS: Final = 261 @@ -612,11 +604,13 @@ SSH_PUBLIC_KEYFILE: Final = 10152 SSLCERT: Final = 10025 SSLCERTPASSWD: Final = 10026 SSLCERTTYPE: Final = 10086 +SSLCERT_BLOB: Final = 40291 SSLENGINE: Final = 10089 SSLENGINE_DEFAULT: Final = 90 SSLKEY: Final = 10087 SSLKEYPASSWD: Final = 10026 SSLKEYTYPE: Final = 10088 +SSLKEY_BLOB: Final = 40292 SSLOPT_ALLOW_BEAST: Final = 1 SSLOPT_NO_REVOKE: Final = 2 SSLVERSION: Final = 32 @@ -671,6 +665,7 @@ TRANSFER_ENCODING: Final = 207 UNIX_SOCKET_PATH: Final = 10231 UNRESTRICTED_AUTH: Final = 105 UPLOAD: Final = 46 +UPLOAD_BUFFERSIZE: Final = 280 URL: Final = 10002 USERAGENT: Final = 10018 USERNAME: Final = 10173 @@ -681,14 +676,18 @@ USESSL_NONE: Final = 0 USESSL_TRY: Final = 1 USE_SSL: Final = 119 VERBOSE: Final = 41 +VERSION_ALTSVC: Final = 16777216 VERSION_ASYNCHDNS: Final = 128 VERSION_BROTLI: Final = 8388608 VERSION_CONV: Final = 4096 VERSION_CURLDEBUG: Final = 8192 VERSION_DEBUG: Final = 64 +VERSION_GSASL: Final = 536870912 VERSION_GSSAPI: Final = 131072 VERSION_GSSNEGOTIATE: Final = 32 +VERSION_HSTS: Final = 268435456 VERSION_HTTP2: Final = 65536 +VERSION_HTTP3: Final = 33554432 VERSION_HTTPS_PROXY: Final = 2097152 VERSION_IDN: Final = 1024 VERSION_IPV6: Final = 1 @@ -704,7 +703,9 @@ VERSION_SPNEGO: Final = 256 VERSION_SSL: Final = 4 VERSION_SSPI: Final = 2048 VERSION_TLSAUTH_SRP: Final = 16384 +VERSION_UNICODE: Final = 134217728 VERSION_UNIX_SOCKETS: Final = 524288 +VERSION_ZSTD: Final = 67108864 WILDCARDMATCH: Final = 197 WRITEDATA: Final = 10001 WRITEFUNCTION: Final = 20011 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/keyboard/_base.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/keyboard/_base.pyi index 60eb21d285f0..8574e597ed4d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/keyboard/_base.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pynput/pynput/keyboard/_base.pyi @@ -2,7 +2,7 @@ import contextlib import enum import sys from collections.abc import Callable, Generator, Iterable, Iterator -from typing import Any, ClassVar +from typing import Any, ClassVar, cast from typing_extensions import Self from pynput._util import AbstractListener @@ -25,71 +25,71 @@ class KeyCode: def from_dead(cls, char: str, **kwargs: Any) -> Self: ... class Key(enum.Enum): - alt: KeyCode - alt_l: KeyCode - alt_r: KeyCode - alt_gr: KeyCode - backspace: KeyCode - caps_lock: KeyCode - cmd: KeyCode - cmd_l: KeyCode - cmd_r: KeyCode - ctrl: KeyCode - ctrl_l: KeyCode - ctrl_r: KeyCode - delete: KeyCode - down: KeyCode - end: KeyCode - enter: KeyCode - esc: KeyCode - f1: KeyCode - f2: KeyCode - f3: KeyCode - f4: KeyCode - f5: KeyCode - f6: KeyCode - f7: KeyCode - f8: KeyCode - f9: KeyCode - f10: KeyCode - f11: KeyCode - f12: KeyCode - f13: KeyCode - f14: KeyCode - f15: KeyCode - f16: KeyCode - f17: KeyCode - f18: KeyCode - f19: KeyCode - f20: KeyCode + alt = cast(KeyCode, ...) + alt_l = cast(KeyCode, ...) + alt_r = cast(KeyCode, ...) + alt_gr = cast(KeyCode, ...) + backspace = cast(KeyCode, ...) + caps_lock = cast(KeyCode, ...) + cmd = cast(KeyCode, ...) + cmd_l = cast(KeyCode, ...) + cmd_r = cast(KeyCode, ...) + ctrl = cast(KeyCode, ...) + ctrl_l = cast(KeyCode, ...) + ctrl_r = cast(KeyCode, ...) + delete = cast(KeyCode, ...) + down = cast(KeyCode, ...) + end = cast(KeyCode, ...) + enter = cast(KeyCode, ...) + esc = cast(KeyCode, ...) + f1 = cast(KeyCode, ...) + f2 = cast(KeyCode, ...) + f3 = cast(KeyCode, ...) + f4 = cast(KeyCode, ...) + f5 = cast(KeyCode, ...) + f6 = cast(KeyCode, ...) + f7 = cast(KeyCode, ...) + f8 = cast(KeyCode, ...) + f9 = cast(KeyCode, ...) + f10 = cast(KeyCode, ...) + f11 = cast(KeyCode, ...) + f12 = cast(KeyCode, ...) + f13 = cast(KeyCode, ...) + f14 = cast(KeyCode, ...) + f15 = cast(KeyCode, ...) + f16 = cast(KeyCode, ...) + f17 = cast(KeyCode, ...) + f18 = cast(KeyCode, ...) + f19 = cast(KeyCode, ...) + f20 = cast(KeyCode, ...) if sys.platform == "win32": - f21: KeyCode - f22: KeyCode - f23: KeyCode - f24: KeyCode - home: KeyCode - left: KeyCode - page_down: KeyCode - page_up: KeyCode - right: KeyCode - shift: KeyCode - shift_l: KeyCode - shift_r: KeyCode - space: KeyCode - tab: KeyCode - up: KeyCode - media_play_pause: KeyCode - media_volume_mute: KeyCode - media_volume_down: KeyCode - media_volume_up: KeyCode - media_previous: KeyCode - media_next: KeyCode - insert: KeyCode - menu: KeyCode - num_lock: KeyCode - pause: KeyCode - print_screen: KeyCode - scroll_lock: KeyCode + f21 = cast(KeyCode, ...) + f22 = cast(KeyCode, ...) + f23 = cast(KeyCode, ...) + f24 = cast(KeyCode, ...) + home = cast(KeyCode, ...) + left = cast(KeyCode, ...) + page_down = cast(KeyCode, ...) + page_up = cast(KeyCode, ...) + right = cast(KeyCode, ...) + shift = cast(KeyCode, ...) + shift_l = cast(KeyCode, ...) + shift_r = cast(KeyCode, ...) + space = cast(KeyCode, ...) + tab = cast(KeyCode, ...) + up = cast(KeyCode, ...) + media_play_pause = cast(KeyCode, ...) + media_volume_mute = cast(KeyCode, ...) + media_volume_down = cast(KeyCode, ...) + media_volume_up = cast(KeyCode, ...) + media_previous = cast(KeyCode, ...) + media_next = cast(KeyCode, ...) + insert = cast(KeyCode, ...) + menu = cast(KeyCode, ...) + num_lock = cast(KeyCode, ...) + pause = cast(KeyCode, ...) + print_screen = cast(KeyCode, ...) + scroll_lock = cast(KeyCode, ...) class Controller: _KeyCode: ClassVar[type[KeyCode]] # undocumented diff --git a/packages/pyright-internal/typeshed-fallback/stubs/python-dateutil/dateutil/relativedelta.pyi b/packages/pyright-internal/typeshed-fallback/stubs/python-dateutil/dateutil/relativedelta.pyi index 7f228880c3cf..9de928158249 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/python-dateutil/dateutil/relativedelta.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/python-dateutil/dateutil/relativedelta.pyi @@ -63,24 +63,16 @@ class relativedelta: @weeks.setter def weeks(self, value: int) -> None: ... def normalized(self) -> Self: ... - # TODO: use Union when mypy will handle it properly in overloaded operator - # methods (#2129, #1442, #1264 in mypy) @overload - def __add__(self, other: relativedelta) -> Self: ... - @overload - def __add__(self, other: timedelta) -> Self: ... + def __add__(self, other: timedelta | relativedelta) -> Self: ... @overload def __add__(self, other: _DateT) -> _DateT: ... @overload - def __radd__(self, other: relativedelta) -> Self: ... - @overload - def __radd__(self, other: timedelta) -> Self: ... + def __radd__(self, other: timedelta | relativedelta) -> Self: ... @overload def __radd__(self, other: _DateT) -> _DateT: ... @overload - def __rsub__(self, other: relativedelta) -> Self: ... - @overload - def __rsub__(self, other: timedelta) -> Self: ... + def __rsub__(self, other: timedelta | relativedelta) -> Self: ... @overload def __rsub__(self, other: _DateT) -> _DateT: ... def __sub__(self, other: relativedelta) -> Self: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/python-gflags/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/python-gflags/METADATA.toml deleted file mode 100644 index 885945de44ef..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/python-gflags/METADATA.toml +++ /dev/null @@ -1,2 +0,0 @@ -version = "3.1.*" -upstream_repository = "https://github.com/google/python-gflags" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/python-gflags/gflags.pyi b/packages/pyright-internal/typeshed-fallback/stubs/python-gflags/gflags.pyi deleted file mode 100644 index 84da3865585d..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/python-gflags/gflags.pyi +++ /dev/null @@ -1,309 +0,0 @@ -from collections.abc import Callable, Iterable, Iterator, Sequence -from types import ModuleType -from typing import IO, Any - -class Error(Exception): ... - -FlagsError = Error - -class DuplicateFlag(FlagsError): ... -class CantOpenFlagFileError(FlagsError): ... -class DuplicateFlagCannotPropagateNoneToSwig(DuplicateFlag): ... - -class DuplicateFlagError(DuplicateFlag): - def __init__(self, flagname: str, flag_values: FlagValues, other_flag_values: FlagValues = ...) -> None: ... - -class IllegalFlagValueError(FlagsError): ... - -IllegalFlagValue = IllegalFlagValueError - -class UnrecognizedFlag(FlagsError): ... - -class UnrecognizedFlagError(UnrecognizedFlag): - def __init__(self, flagname: str, flagvalue: str = ...) -> None: ... - -def get_help_width() -> int: ... - -GetHelpWidth = get_help_width - -def text_wrap(text: str, length: int = ..., indent: str = ..., firstline_indent: str = ..., tabs: str = ...) -> str: ... - -TextWrap = text_wrap - -def doc_to_help(doc: str) -> str: ... - -DocToHelp = doc_to_help - -class FlagValues: - def UseGnuGetOpt(self, use_gnu_getopt: bool = ...) -> None: ... - def is_gnu_getopt(self) -> bool: ... - IsGnuGetOpt = is_gnu_getopt - # TODO dict type - def FlagDict(self) -> dict[Any, Any]: ... - def flags_by_module_dict(self) -> dict[str, list[Flag]]: ... - FlagsByModuleDict = flags_by_module_dict - def flags_by_module_id_dict(self) -> dict[int, list[Flag]]: ... - FlagsByModuleIdDict = flags_by_module_id_dict - def key_flags_by_module_dict(self) -> dict[str, list[Flag]]: ... - KeyFlagsByModuleDict = key_flags_by_module_dict - def find_module_defining_flag(self, flagname: str, default: str = ...) -> str: ... - FindModuleDefiningFlag = find_module_defining_flag - def find_module_id_defining_flag(self, flagname: str, default: int = ...) -> int: ... - FindModuleIdDefiningFlag = find_module_id_defining_flag - def append_flag_values(self, flag_values: FlagValues) -> None: ... - AppendFlagValues = append_flag_values - def remove_flag_values(self, flag_values: FlagValues) -> None: ... - RemoveFlagValues = remove_flag_values - def __setitem__(self, name: str, flag: Flag) -> None: ... - def __getitem__(self, name: str) -> Flag: ... - def __getattr__(self, name: str) -> Any: ... - def __setattr__(self, name: str, value: Any) -> None: ... - def __delattr__(self, flag_name: str) -> None: ... - def set_default(self, name: str, value: Any) -> None: ... - SetDefault = set_default - def __contains__(self, name: str) -> bool: ... - has_key = __contains__ - def __iter__(self) -> Iterator[str]: ... - def __call__(self, argv: list[str], known_only: bool = ...) -> list[str]: ... - def reset(self) -> None: ... - Reset = reset - def RegisteredFlags(self) -> list[str]: ... - def flag_values_dict(self) -> dict[str, Any]: ... - FlagValuesDict = flag_values_dict - def GetHelp(self, prefix: str = ...) -> str: ... - def module_help(self, module: ModuleType | str) -> str: ... - ModuleHelp = module_help - def main_module_help(self) -> str: ... - MainModuleHelp = main_module_help - def get(self, name: str, default: Any) -> Any: ... - def ShortestUniquePrefixes(self, fl: dict[str, Flag]) -> dict[str, str]: ... - def ExtractFilename(self, flagfile_str: str) -> str: ... - def read_flags_from_files(self, argv: list[str], force_gnu: bool = ...) -> list[str]: ... - ReadFlagsFromFiles = read_flags_from_files - def flags_into_string(self) -> str: ... - FlagsIntoString = flags_into_string - def append_flags_into_file(self, filename: str) -> None: ... - AppendFlagsIntoFile = append_flags_into_file - def write_help_in_xml_format(self, outfile: IO[str] = ...) -> None: ... - WriteHelpInXMLFormat = write_help_in_xml_format - # TODO validator: gflags_validators.Validator - def AddValidator(self, validator: Any) -> None: ... - def is_parsed(self) -> bool: ... - IsParsed = is_parsed - -FLAGS: FlagValues - -class Flag: - name: str - default: Any - default_as_str: str - value: Any - help: str - short_name: str - boolean: bool - present: bool - parser: ArgumentParser - serializer: ArgumentSerializer - allow_override: bool - def __init__( - self, - parser: ArgumentParser, - serializer: ArgumentSerializer, - name: str, - default: str | None, - help_string: str, - short_name: str = ..., - boolean: bool = ..., - allow_override: bool = ..., - ) -> None: ... - def Parse(self, argument: Any) -> Any: ... - def Unparse(self) -> None: ... - def Serialize(self) -> str: ... - def SetDefault(self, value: Any) -> None: ... - def Type(self) -> str: ... - def WriteInfoInXMLFormat(self, outfile: IO[str], module_name: str, is_key: bool = ..., indent: str = ...) -> None: ... - -class ArgumentParser: - syntactic_help: str - # TODO what is this - def parse(self, argument: Any) -> Any: ... - Parser = parse - def flag_type(self) -> str: ... - Type = flag_type - def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str) -> None: ... - -class ArgumentSerializer: - def Serialize(self, value: Any) -> str: ... - -class ListSerializer(ArgumentSerializer): - def __init__(self, list_sep: str) -> None: ... - def Serialize(self, value: list[Any]) -> str: ... - -def register_validator( - flag_name: str, checker: Callable[[Any], bool], message: str = ..., flag_values: FlagValues = ... -) -> None: ... - -RegisterValidator = register_validator - -def mark_flag_as_required(flag_name: str, flag_values: FlagValues = ...) -> None: ... - -MarkFlagAsRequired = mark_flag_as_required - -def mark_flags_as_required(flag_names: Iterable[str], flag_values: FlagValues = ...) -> None: ... - -MarkFlagsAsRequired = mark_flags_as_required - -def mark_flags_as_mutual_exclusive(flag_names: Iterable[str], required: bool = ..., flag_values: FlagValues = ...) -> None: ... - -MarkFlagsAsMutualExclusive = mark_flags_as_mutual_exclusive - -def DEFINE( - parser: ArgumentParser, - name: str, - default: Any, - help: str, - flag_values: FlagValues = ..., - serializer: ArgumentSerializer = ..., - **args: Any, -) -> None: ... -def DEFINE_flag(flag: Flag, flag_values: FlagValues = ...) -> None: ... -def declare_key_flag(flag_name: str, flag_values: FlagValues = ...) -> None: ... - -DECLARE_key_flag = declare_key_flag - -def adopt_module_key_flags(module: ModuleType, flag_values: FlagValues = ...) -> None: ... - -ADOPT_module_key_flags = adopt_module_key_flags - -def DEFINE_string(name: str, default: str | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... - -class BooleanParser(ArgumentParser): - def Convert(self, argument: Any) -> bool: ... - def Parse(self, argument: Any) -> bool: ... - -class BooleanFlag(Flag): - def __init__(self, name: str, default: bool | None, help: str, short_name: str = ..., **args: Any) -> None: ... - -def DEFINE_boolean(name: str, default: bool | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... - -DEFINE_bool = DEFINE_boolean - -class HelpFlag(BooleanFlag): - def __init__(self) -> None: ... - def Parse(self, arg: Any) -> None: ... - -class HelpXMLFlag(BooleanFlag): - def __init__(self) -> None: ... - def Parse(self, arg: Any) -> None: ... - -class HelpshortFlag(BooleanFlag): - def __init__(self) -> None: ... - def Parse(self, arg: Any) -> None: ... - -class NumericParser(ArgumentParser): - def IsOutsideBounds(self, val: float) -> bool: ... - def Parse(self, argument: Any) -> float: ... - def WriteCustomInfoInXMLFormat(self, outfile: IO[str], indent: str) -> None: ... - def Convert(self, argument: Any) -> Any: ... - -class FloatParser(NumericParser): - number_article: str - number_name: str - syntactic_help: str - def __init__(self, lower_bound: float = ..., upper_bound: float = ...) -> None: ... - def Convert(self, argument: Any) -> float: ... - -def DEFINE_float( - name: str, - default: float | None, - help: str, - lower_bound: float = ..., - upper_bound: float = ..., - flag_values: FlagValues = ..., - **args: Any, -) -> None: ... - -class IntegerParser(NumericParser): - number_article: str - number_name: str - syntactic_help: str - def __init__(self, lower_bound: int = ..., upper_bound: int = ...) -> None: ... - def Convert(self, argument: Any) -> int: ... - -def DEFINE_integer( - name: str, - default: int | None, - help: str, - lower_bound: int = ..., - upper_bound: int = ..., - flag_values: FlagValues = ..., - **args: Any, -) -> None: ... - -class EnumParser(ArgumentParser): - def __init__(self, enum_values: list[str]) -> None: ... - def Parse(self, argument: Any) -> Any: ... - -class EnumFlag(Flag): - def __init__( - self, name: str, default: str | None, help: str, enum_values: list[str], short_name: str, **args: Any - ) -> None: ... - -def DEFINE_enum( - name: str, default: str | None, enum_values: Iterable[str], help: str, flag_values: FlagValues = ..., **args: Any -) -> None: ... - -class BaseListParser(ArgumentParser): - def __init__(self, token: str = ..., name: str = ...) -> None: ... - def Parse(self, argument: Any) -> list[Any]: ... - -class ListParser(BaseListParser): - def __init__(self) -> None: ... - -class WhitespaceSeparatedListParser(BaseListParser): - def __init__(self) -> None: ... - -def DEFINE_list(name: str, default: list[str] | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... -def DEFINE_spaceseplist(name: str, default: list[str] | None, help: str, flag_values: FlagValues = ..., **args: Any) -> None: ... - -class MultiFlag(Flag): - def __init__(self, *args: Any, **kwargs: Any) -> None: ... - def Parse(self, arguments: Any) -> None: ... - def Serialize(self) -> str: ... - -def DEFINE_multi_string( - name: str, default: str | list[str] | None, help: str, flag_values: FlagValues = ..., **args: Any -) -> None: ... - -DEFINE_multistring = DEFINE_multi_string - -def DEFINE_multi_integer( - name: str, - default: int | list[int] | None, - help: str, - lower_bound: int = ..., - upper_bound: int = ..., - flag_values: FlagValues = ..., - **args: Any, -) -> None: ... - -DEFINE_multi_int = DEFINE_multi_integer - -def DEFINE_multi_float( - name: str, - default: float | list[float] | None, - help: str, - lower_bound: float = ..., - upper_bound: float = ..., - flag_values: FlagValues = ..., - **args: Any, -) -> None: ... -def DEFINE_multi_enum( - name: str, - default: Sequence[str] | str | None, - enum_values: Sequence[str], - help: str, - flag_values: FlagValues = ..., - case_sensitive: bool = ..., - **args: Any, -) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pywin32/_win32typing.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pywin32/_win32typing.pyi index a7bdc25f2d48..0078f78f40e7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pywin32/_win32typing.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pywin32/_win32typing.pyi @@ -170,13 +170,13 @@ class PRINTER_DEFAULTS: class PyACL: def Initialize(self) -> None: ... def IsValid(self) -> bool: ... + @overload @deprecated( """\ Early versions of this function supported only two arguments. \ This has been deprecated in preference of the three argument version, \ which reflects the win32 API and the new functions in this module.""" ) - @overload def AddAccessAllowedAce(self, access: int, sid: PySID, /) -> None: ... @overload def AddAccessAllowedAce(self, revision: int, access: int, sid: PySID, /) -> None: ... @@ -184,13 +184,13 @@ which reflects the win32 API and the new functions in this module.""" def AddAccessAllowedObjectAce( self, AceRevision, AceFlags, AccessMask, ObjectTypeGuid: PyIID, InheritedObjectTypeGuid: PyIID, sid: PySID, / ) -> None: ... + @overload @deprecated( """\ Early versions of this function supported only two arguments. \ This has been deprecated in preference of the three argument version, \ which reflects the win32 API and the new functions in this module.""" ) - @overload def AddAccessDeniedAce(self, access: int, sid: PySID, /) -> None: ... @overload def AddAccessDeniedAce(self, revision: int, access: int, sid: PySID, /) -> None: ... @@ -240,6 +240,7 @@ class PyCERTSTORE: def HCERTSTORE(self): ... @overload def CertCloseStore(self) -> None: ... + @overload @deprecated( """\ `Flags` argument has been deprecated as it is likely to crash the process if \ @@ -247,7 +248,6 @@ class PyCERTSTORE: always called with `CERT_CLOSE_STORE_CHECK_FLAG`, and support for this \ param will be dropped at some point in the future.""" ) - @overload def CertCloseStore(self, Flags: int) -> None: ... def CertControlStore(self, Flags, CtrlType, CtrlPara: int) -> None: ... def CertEnumCertificatesInStore(self) -> list[PyCERT_CONTEXT]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/qrbill/qrbill/bill.pyi b/packages/pyright-internal/typeshed-fallback/stubs/qrbill/qrbill/bill.pyi index 0e2824b0451b..651963333d23 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/qrbill/qrbill/bill.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/qrbill/qrbill/bill.pyi @@ -114,8 +114,8 @@ class QRBill: payment_line: bool = True, font_factor: int = 1, ) -> None: ... - @deprecated("ref_number is deprecated and replaced by reference_number") @overload + @deprecated("ref_number is deprecated and replaced by reference_number") def __init__( self, account: str, @@ -135,8 +135,8 @@ class QRBill: payment_line: bool = True, font_factor: int = 1, ) -> None: ... - @deprecated("extra_infos is deprecated and replaced by additional_information") @overload + @deprecated("extra_infos is deprecated and replaced by additional_information") def __init__( self, account: str, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/redis/METADATA.toml deleted file mode 100644 index 730ac58500db..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/METADATA.toml +++ /dev/null @@ -1,12 +0,0 @@ -version = "4.6.0" -upstream_repository = "https://github.com/redis/redis-py" -# Requires a version of cryptography with a `py.typed` file -requires = ["cryptography>=35.0.0", "types-pyOpenSSL"] -partial_stub = true -obsolete_since = "5.0.0" # Released on 2023-08-15, marked obsolete 2024-07-25 - -[tool.stubtest] -ignore_missing_stub = true -# The runtime has an undeclared dependency on setuptools -stubtest_requirements = ["setuptools"] -extras = ["ocsp"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/__init__.pyi deleted file mode 100644 index a02bc174b595..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/__init__.pyi +++ /dev/null @@ -1,72 +0,0 @@ -from . import backoff, client, connection, credentials, exceptions, sentinel, utils -from .cluster import RedisCluster as RedisCluster - -__all__ = [ - "AuthenticationError", - "AuthenticationWrongNumberOfArgsError", - "BlockingConnectionPool", - "BusyLoadingError", - "ChildDeadlockedError", - "Connection", - "ConnectionError", - "ConnectionPool", - "CredentialProvider", - "DataError", - "from_url", - "default_backoff", - "InvalidResponse", - "PubSubError", - "ReadOnlyError", - "Redis", - "RedisCluster", - "RedisError", - "ResponseError", - "Sentinel", - "SentinelConnectionPool", - "SentinelManagedConnection", - "SentinelManagedSSLConnection", - "SSLConnection", - "UsernamePasswordCredentialProvider", - "StrictRedis", - "TimeoutError", - "UnixDomainSocketConnection", - "WatchError", -] - -default_backoff = backoff.default_backoff - -Redis = client.Redis - -BlockingConnectionPool = connection.BlockingConnectionPool -Connection = connection.Connection -ConnectionPool = connection.ConnectionPool -SSLConnection = connection.SSLConnection -StrictRedis = client.StrictRedis -UnixDomainSocketConnection = connection.UnixDomainSocketConnection - -from_url = utils.from_url - -Sentinel = sentinel.Sentinel -SentinelConnectionPool = sentinel.SentinelConnectionPool -SentinelManagedConnection = sentinel.SentinelManagedConnection -SentinelManagedSSLConnection = sentinel.SentinelManagedSSLConnection - -AuthenticationError = exceptions.AuthenticationError -AuthenticationWrongNumberOfArgsError = exceptions.AuthenticationWrongNumberOfArgsError -BusyLoadingError = exceptions.BusyLoadingError -ChildDeadlockedError = exceptions.ChildDeadlockedError -ConnectionError = exceptions.ConnectionError -DataError = exceptions.DataError -InvalidResponse = exceptions.InvalidResponse -PubSubError = exceptions.PubSubError -ReadOnlyError = exceptions.ReadOnlyError -RedisError = exceptions.RedisError -ResponseError = exceptions.ResponseError -TimeoutError = exceptions.TimeoutError -WatchError = exceptions.WatchError - -CredentialProvider = credentials.CredentialProvider -UsernamePasswordCredentialProvider = credentials.UsernamePasswordCredentialProvider - -__version__: str -VERSION: tuple[int | str, ...] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/__init__.pyi deleted file mode 100644 index 23d3d7d41f24..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/__init__.pyi +++ /dev/null @@ -1,64 +0,0 @@ -from redis.asyncio.client import Redis as Redis, StrictRedis as StrictRedis -from redis.asyncio.cluster import RedisCluster as RedisCluster -from redis.asyncio.connection import ( - BlockingConnectionPool as BlockingConnectionPool, - Connection as Connection, - ConnectionPool as ConnectionPool, - SSLConnection as SSLConnection, - UnixDomainSocketConnection as UnixDomainSocketConnection, -) -from redis.asyncio.parser import CommandsParser as CommandsParser -from redis.asyncio.sentinel import ( - Sentinel as Sentinel, - SentinelConnectionPool as SentinelConnectionPool, - SentinelManagedConnection as SentinelManagedConnection, - SentinelManagedSSLConnection as SentinelManagedSSLConnection, -) -from redis.asyncio.utils import from_url as from_url -from redis.backoff import default_backoff as default_backoff -from redis.exceptions import ( - AuthenticationError as AuthenticationError, - AuthenticationWrongNumberOfArgsError as AuthenticationWrongNumberOfArgsError, - BusyLoadingError as BusyLoadingError, - ChildDeadlockedError as ChildDeadlockedError, - ConnectionError as ConnectionError, - DataError as DataError, - InvalidResponse as InvalidResponse, - PubSubError as PubSubError, - ReadOnlyError as ReadOnlyError, - RedisError as RedisError, - ResponseError as ResponseError, - TimeoutError as TimeoutError, - WatchError as WatchError, -) - -__all__ = [ - "AuthenticationError", - "AuthenticationWrongNumberOfArgsError", - "BlockingConnectionPool", - "BusyLoadingError", - "ChildDeadlockedError", - "CommandsParser", - "Connection", - "ConnectionError", - "ConnectionPool", - "DataError", - "from_url", - "default_backoff", - "InvalidResponse", - "PubSubError", - "ReadOnlyError", - "Redis", - "RedisCluster", - "RedisError", - "ResponseError", - "Sentinel", - "SentinelConnectionPool", - "SentinelManagedConnection", - "SentinelManagedSSLConnection", - "SSLConnection", - "StrictRedis", - "TimeoutError", - "UnixDomainSocketConnection", - "WatchError", -] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/client.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/client.pyi deleted file mode 100644 index df616e6be01e..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/client.pyi +++ /dev/null @@ -1,1091 +0,0 @@ -from _typeshed import Incomplete, Unused -from collections.abc import AsyncIterator, Awaitable, Callable, Generator, Iterable, Mapping, MutableMapping, Sequence -from datetime import datetime, timedelta -from types import TracebackType -from typing import Any, ClassVar, Literal, NoReturn, Protocol, TypedDict, overload -from typing_extensions import Self, TypeAlias - -from redis import RedisError -from redis.asyncio.connection import ConnectCallbackT, Connection, ConnectionPool -from redis.asyncio.lock import Lock -from redis.asyncio.retry import Retry -from redis.client import AbstractRedis, _CommandOptions, _Key, _StrType, _Value -from redis.commands import AsyncCoreCommands, AsyncSentinelCommands, RedisModuleCommands -from redis.credentials import CredentialProvider -from redis.typing import ChannelT, EncodableT, KeyT, PatternT, StreamIdT - -PubSubHandler: TypeAlias = Callable[[dict[str, str]], Awaitable[None]] - -class ResponseCallbackProtocol(Protocol): - def __call__(self, response: Any, **kwargs): ... - -class AsyncResponseCallbackProtocol(Protocol): - async def __call__(self, response: Any, **kwargs): ... - -ResponseCallbackT: TypeAlias = ResponseCallbackProtocol | AsyncResponseCallbackProtocol - -class Redis(AbstractRedis, RedisModuleCommands, AsyncCoreCommands[_StrType], AsyncSentinelCommands): - response_callbacks: MutableMapping[str | bytes, ResponseCallbackT] - auto_close_connection_pool: bool - connection_pool: Any - single_connection_client: Any - connection: Any - @overload - @classmethod - def from_url( - cls, - url: str, - *, - host: str = "localhost", - port: int = 6379, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - socket_keepalive: bool | None = None, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - connection_pool: ConnectionPool[Any] | None = None, - unix_socket_path: str | None = None, - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: Literal[True], - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | None = None, - ssl: bool = False, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: str = "required", - ssl_ca_certs: str | None = None, - ssl_ca_data: str | None = None, - ssl_check_hostname: bool = False, - max_connections: int | None = None, - single_connection_client: bool = False, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - auto_close_connection_pool: bool = True, - redis_connect_func: ConnectCallbackT | None = None, - credential_provider: CredentialProvider | None = None, - ) -> Redis[str]: ... - @overload - @classmethod - def from_url( - cls, - url: str, - *, - host: str = "localhost", - port: int = 6379, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - socket_keepalive: bool | None = None, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - connection_pool: ConnectionPool[Any] | None = None, - unix_socket_path: str | None = None, - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: Literal[False] = False, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | None = None, - ssl: bool = False, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: str = "required", - ssl_ca_certs: str | None = None, - ssl_ca_data: str | None = None, - ssl_check_hostname: bool = False, - max_connections: int | None = None, - single_connection_client: bool = False, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - auto_close_connection_pool: bool = True, - redis_connect_func: ConnectCallbackT | None = None, - credential_provider: CredentialProvider | None = None, - ) -> Redis[bytes]: ... - @overload - def __init__( - self: Redis[str], - *, - host: str = "localhost", - port: int = 6379, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - socket_keepalive: bool | None = None, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - connection_pool: ConnectionPool[Any] | None = None, - unix_socket_path: str | None = None, - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: Literal[True], - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | None = None, - ssl: bool = False, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: str = "required", - ssl_ca_certs: str | None = None, - ssl_ca_data: str | None = None, - ssl_check_hostname: bool = False, - max_connections: int | None = None, - single_connection_client: bool = False, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - auto_close_connection_pool: bool = True, - redis_connect_func: ConnectCallbackT | None = None, - credential_provider: CredentialProvider | None = None, - ) -> None: ... - @overload - def __init__( - self: Redis[bytes], - *, - host: str = "localhost", - port: int = 6379, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - socket_keepalive: bool | None = None, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - connection_pool: ConnectionPool[Any] | None = None, - unix_socket_path: str | None = None, - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: Literal[False] = False, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | None = None, - ssl: bool = False, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: str = "required", - ssl_ca_certs: str | None = None, - ssl_ca_data: str | None = None, - ssl_check_hostname: bool = False, - max_connections: int | None = None, - single_connection_client: bool = False, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - auto_close_connection_pool: bool = True, - redis_connect_func: ConnectCallbackT | None = None, - credential_provider: CredentialProvider | None = None, - ) -> None: ... - def __await__(self) -> Generator[Any, None, Self]: ... - async def initialize(self) -> Self: ... - def set_response_callback(self, command: str, callback: ResponseCallbackT): ... - def load_external_module(self, funcname, func) -> None: ... - def pipeline(self, transaction: bool = True, shard_hint: str | None = None) -> Pipeline[_StrType]: ... - async def transaction( - self, - func: Callable[[Pipeline[_StrType]], Any | Awaitable[Any]], - *watches: KeyT, - shard_hint: str | None = None, - value_from_callable: bool = False, - watch_delay: float | None = None, - ): ... - def lock( - self, - name: KeyT, - timeout: float | None = None, - sleep: float = 0.1, - blocking: bool = True, - blocking_timeout: float | None = None, - lock_class: type[Lock] | None = None, - thread_local: bool = True, - ) -> Lock: ... - def pubsub(self, **kwargs) -> PubSub: ... - def monitor(self) -> Monitor: ... - def client(self) -> Redis[_StrType]: ... - async def __aenter__(self) -> Self: ... - async def __aexit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self, _warnings: Any = ...) -> None: ... - async def close(self, close_connection_pool: bool | None = None) -> None: ... - async def execute_command(self, *args, **options): ... - async def parse_response(self, connection: Connection, command_name: str | bytes, **options): ... - -StrictRedis = Redis - -class MonitorCommandInfo(TypedDict): - time: float - db: int - client_address: str - client_port: str - client_type: str - command: str - -class Monitor: - monitor_re: Any - command_re: Any - connection_pool: Any - connection: Any - def __init__(self, connection_pool: ConnectionPool[Any]) -> None: ... - async def connect(self) -> None: ... - async def __aenter__(self) -> Self: ... - async def __aexit__(self, *args: Unused) -> None: ... - async def next_command(self) -> MonitorCommandInfo: ... - def listen(self) -> AsyncIterator[MonitorCommandInfo]: ... - -class PubSub: - PUBLISH_MESSAGE_TYPES: ClassVar[tuple[str, ...]] - UNSUBSCRIBE_MESSAGE_TYPES: ClassVar[tuple[str, ...]] - HEALTH_CHECK_MESSAGE: ClassVar[str] - connection_pool: Any - shard_hint: str | None - ignore_subscribe_messages: bool - connection: Any - encoder: Any - health_check_response: Iterable[str | bytes] - channels: Any - pending_unsubscribe_channels: Any - patterns: Any - pending_unsubscribe_patterns: Any - def __init__( - self, - connection_pool: ConnectionPool[Any], - shard_hint: str | None = None, - ignore_subscribe_messages: bool = False, - encoder: Incomplete | None = None, - ) -> None: ... - async def __aenter__(self) -> Self: ... - async def __aexit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self) -> None: ... - async def reset(self) -> None: ... - def close(self) -> Awaitable[NoReturn]: ... - async def on_connect(self, connection: Connection): ... - @property - def subscribed(self) -> bool: ... - async def execute_command(self, *args: EncodableT): ... - async def parse_response(self, block: bool = True, timeout: float = 0): ... - async def check_health(self) -> None: ... - async def psubscribe(self, *args: ChannelT, **kwargs: PubSubHandler): ... - def punsubscribe(self, *args: ChannelT) -> Awaitable[Any]: ... - async def subscribe(self, *args: ChannelT, **kwargs: Callable[..., Any]): ... - def unsubscribe(self, *args) -> Awaitable[Any]: ... - def listen(self) -> AsyncIterator[Any]: ... - async def get_message(self, ignore_subscribe_messages: bool = False, timeout: float = 0.0): ... - def ping(self, message: Incomplete | None = None) -> Awaitable[Any]: ... - async def handle_message(self, response, ignore_subscribe_messages: bool = False): ... - async def run(self, *, exception_handler: PSWorkerThreadExcHandlerT | None = None, poll_timeout: float = 1.0) -> None: ... - -class PubsubWorkerExceptionHandler(Protocol): - def __call__(self, e: BaseException, pubsub: PubSub): ... - -class AsyncPubsubWorkerExceptionHandler(Protocol): - async def __call__(self, e: BaseException, pubsub: PubSub): ... - -PSWorkerThreadExcHandlerT: TypeAlias = PubsubWorkerExceptionHandler | AsyncPubsubWorkerExceptionHandler -CommandT: TypeAlias = tuple[tuple[str | bytes, ...], Mapping[str, Any]] -CommandStackT: TypeAlias = list[CommandT] - -class Pipeline(Redis[_StrType]): - UNWATCH_COMMANDS: ClassVar[set[str]] - connection_pool: Any - connection: Any - response_callbacks: Any - is_transaction: bool - shard_hint: str | None - watching: bool - command_stack: Any - scripts: Any - explicit_transaction: bool - def __init__( - self, - connection_pool: ConnectionPool[Any], - response_callbacks: MutableMapping[str | bytes, ResponseCallbackT], - transaction: bool, - shard_hint: str | None, - ) -> None: ... - async def __aenter__(self) -> Self: ... - async def __aexit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __await__(self) -> Generator[Any, None, Self]: ... - def __len__(self) -> int: ... - def __bool__(self) -> bool: ... - async def reset(self) -> None: ... - def multi(self) -> None: ... - def execute_command(self, *args, **kwargs) -> Pipeline[_StrType] | Awaitable[Pipeline[_StrType]]: ... - async def immediate_execute_command(self, *args, **options): ... - def pipeline_execute_command(self, *args, **options): ... - def raise_first_error(self, commands: CommandStackT, response: Iterable[Any]): ... - def annotate_exception(self, exception: Exception, number: int, command: Iterable[object]) -> None: ... - async def parse_response(self, connection: Connection, command_name: str | bytes, **options): ... - async def load_scripts(self) -> None: ... - async def execute(self, raise_on_error: bool = True): ... - async def discard(self) -> None: ... - async def watch(self, *names: KeyT) -> bool: ... - async def unwatch(self) -> bool: ... - # region acl commands - def acl_cat(self, category: str | None = None, **kwargs: _CommandOptions) -> Any: ... - def acl_deluser(self, *username: str, **kwargs: _CommandOptions) -> Any: ... - def acl_genpass(self, bits: int | None = None, **kwargs: _CommandOptions) -> Any: ... - def acl_getuser(self, username: str, **kwargs: _CommandOptions) -> Any: ... - def acl_help(self, **kwargs: _CommandOptions) -> Any: ... - def acl_list(self, **kwargs: _CommandOptions) -> Any: ... - def acl_log(self, count: int | None = None, **kwargs: _CommandOptions) -> Any: ... - def acl_log_reset(self, **kwargs: _CommandOptions) -> Any: ... - def acl_load(self, **kwargs: _CommandOptions) -> Any: ... - def acl_save(self, **kwargs: _CommandOptions) -> Any: ... - def acl_setuser( # type: ignore[override] - self, - username: str, - enabled: bool = False, - nopass: bool = False, - passwords: Sequence[str] | None = None, - hashed_passwords: Sequence[str] | None = None, - categories: Sequence[str] | None = None, - commands: Sequence[str] | None = None, - keys: Sequence[str] | None = None, - channels: Iterable[ChannelT] | None = None, - selectors: Iterable[tuple[str, KeyT]] | None = None, - reset: bool = False, - reset_keys: bool = False, - reset_channels: bool = False, - reset_passwords: bool = False, - **kwargs: _CommandOptions, - ) -> Pipeline[_StrType]: ... - def acl_users(self, **kwargs: _CommandOptions) -> Any: ... - def acl_whoami(self, **kwargs: _CommandOptions) -> Any: ... - # endregion - # region cluster commands - def cluster(self, cluster_arg: str, *args, **kwargs: _CommandOptions) -> Any: ... - def readwrite(self, **kwargs: _CommandOptions) -> Any: ... - def readonly(self, **kwargs: _CommandOptions) -> Any: ... - # endregion - # region BasicKey commands - def append(self, key, value) -> Any: ... - def bitcount(self, key: _Key, start: int | None = None, end: int | None = None, mode: str | None = None) -> Any: ... - def bitfield(self, key, default_overflow: Incomplete | None = None) -> Any: ... - def bitop(self, operation, dest, *keys) -> Any: ... - def bitpos(self, key: _Key, bit: int, start: int | None = None, end: int | None = None, mode: str | None = None) -> Any: ... - def copy(self, source, destination, destination_db: Incomplete | None = None, replace: bool = False) -> Any: ... - def decr(self, name, amount: int = 1) -> Any: ... - def decrby(self, name, amount: int = 1) -> Any: ... - def delete(self, *names: _Key) -> Any: ... - def dump(self, name: _Key) -> Any: ... - def exists(self, *names: _Key) -> Any: ... - def expire( - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Any: ... - def expireat(self, name, when, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False) -> Any: ... - def get(self, name: _Key) -> Any: ... - def getdel(self, name: _Key) -> Any: ... - def getex( - self, - name, - ex: Incomplete | None = None, - px: Incomplete | None = None, - exat: Incomplete | None = None, - pxat: Incomplete | None = None, - persist: bool = False, - ) -> Any: ... - def getbit(self, name: _Key, offset: int) -> Any: ... - def getrange(self, key, start, end) -> Any: ... - def getset(self, name, value) -> Any: ... - def incr(self, name: _Key, amount: int = 1) -> Any: ... - def incrby(self, name: _Key, amount: int = 1) -> Any: ... - def incrbyfloat(self, name: _Key, amount: float = 1.0) -> Any: ... - def keys(self, pattern: _Key = "*", **kwargs: _CommandOptions) -> Any: ... - def lmove( - self, - first_list: _Key, - second_list: _Key, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> Any: ... - def blmove( - self, - first_list: _Key, - second_list: _Key, - timeout: float, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> Any: ... - def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - def mset(self, mapping: Mapping[_Key, _Value]) -> Any: ... - def msetnx(self, mapping: Mapping[_Key, _Value]) -> Any: ... - def move(self, name: _Key, db: int) -> Any: ... - def persist(self, name: _Key) -> Any: ... - def pexpire( - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Any: ... - def pexpireat( - self, name: _Key, when: int | datetime, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Any: ... - def psetex(self, name, time_ms, value) -> Any: ... - def pttl(self, name: _Key) -> Any: ... - def hrandfield(self, key, count: Incomplete | None = None, withvalues: bool = False) -> Any: ... - def randomkey(self, **kwargs: _CommandOptions) -> Any: ... - def rename(self, src, dst) -> Any: ... - def renamenx(self, src, dst) -> Any: ... - def restore( - self, - name, - ttl, - value, - replace: bool = False, - absttl: bool = False, - idletime: Incomplete | None = None, - frequency: Incomplete | None = None, - ) -> Any: ... - def set( # type: ignore[override] - self, - name: _Key, - value: _Value, - ex: None | int | timedelta = None, - px: None | int | timedelta = None, - nx: bool = False, - xx: bool = False, - keepttl: bool = False, - get: bool = False, - exat: Incomplete | None = None, - pxat: Incomplete | None = None, - ) -> Any: ... - def setbit(self, name: _Key, offset: int, value: int) -> Any: ... - def setex(self, name: _Key, time: int | timedelta, value: _Value) -> Any: ... - def setnx(self, name: _Key, value: _Value) -> Any: ... - def setrange(self, name, offset, value) -> Any: ... - def stralgo( - self, - algo, - value1, - value2, - specific_argument: str = "strings", - len: bool = False, - idx: bool = False, - minmatchlen: Incomplete | None = None, - withmatchlen: bool = False, - **kwargs: _CommandOptions, - ) -> Any: ... - def strlen(self, name) -> Any: ... - def substr(self, name, start, end: int = -1) -> Any: ... - def touch(self, *args) -> Any: ... - def ttl(self, name: _Key) -> Any: ... - def type(self, name) -> Any: ... - def unlink(self, *names: _Key) -> Any: ... - # endregion - # region hyperlog commands - def pfadd(self, name: _Key, *values: _Value) -> Any: ... - def pfcount(self, name: _Key) -> Any: ... - def pfmerge(self, dest: _Key, *sources: _Key) -> Any: ... - # endregion - # region hash commands - def hdel(self, name: _Key, *keys: _Key) -> Any: ... - def hexists(self, name: _Key, key: _Key) -> Any: ... - def hget(self, name: _Key, key: _Key) -> Any: ... - def hgetall(self, name: _Key) -> Any: ... - def hincrby(self, name: _Key, key: _Key, amount: int = 1) -> Any: ... - def hincrbyfloat(self, name: _Key, key: _Key, amount: float = 1.0) -> Any: ... - def hkeys(self, name: _Key) -> Any: ... - def hlen(self, name: _Key) -> Any: ... - @overload - def hset( - self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = None, items: Incomplete | None = None - ) -> Any: ... - @overload - def hset( - self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Incomplete | None = None - ) -> Any: ... - @overload - def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Incomplete | None = None) -> Any: ... - def hsetnx(self, name: _Key, key: _Key, value: _Value) -> Any: ... - def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> Any: ... - def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - def hvals(self, name: _Key) -> Any: ... - def hstrlen(self, name, key) -> Any: ... - # endregion - # region geo commands - def geoadd(self, name, values, nx: bool = False, xx: bool = False, ch: bool = False) -> Any: ... - def geodist(self, name, place1, place2, unit: Incomplete | None = None) -> Any: ... - def geohash(self, name, *values) -> Any: ... - def geopos(self, name, *values) -> Any: ... - def georadius( - self, - name, - longitude, - latitude, - radius, - unit: Incomplete | None = None, - withdist: bool = False, - withcoord: bool = False, - withhash: bool = False, - count: Incomplete | None = None, - sort: Incomplete | None = None, - store: Incomplete | None = None, - store_dist: Incomplete | None = None, - any: bool = False, - ) -> Any: ... - def georadiusbymember( - self, - name, - member, - radius, - unit: Incomplete | None = None, - withdist: bool = False, - withcoord: bool = False, - withhash: bool = False, - count: Incomplete | None = None, - sort: Incomplete | None = None, - store: Incomplete | None = None, - store_dist: Incomplete | None = None, - any: bool = False, - ) -> Any: ... - def geosearch( - self, - name, - member: Incomplete | None = None, - longitude: Incomplete | None = None, - latitude: Incomplete | None = None, - unit: str = "m", - radius: Incomplete | None = None, - width: Incomplete | None = None, - height: Incomplete | None = None, - sort: Incomplete | None = None, - count: Incomplete | None = None, - any: bool = False, - withcoord: bool = False, - withdist: bool = False, - withhash: bool = False, - ) -> Any: ... - def geosearchstore( - self, - dest, - name, - member: Incomplete | None = None, - longitude: Incomplete | None = None, - latitude: Incomplete | None = None, - unit: str = "m", - radius: Incomplete | None = None, - width: Incomplete | None = None, - height: Incomplete | None = None, - sort: Incomplete | None = None, - count: Incomplete | None = None, - any: bool = False, - storedist: bool = False, - ) -> Any: ... - # endregion - # region list commands - @overload - def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = 0) -> Any: ... - @overload - def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> Any: ... - @overload - def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = 0) -> Any: ... - @overload - def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> Any: ... - def brpoplpush(self, src, dst, timeout: int | None = 0) -> Any: ... - def lindex(self, name: _Key, index: int) -> Any: ... - def linsert( - self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value - ) -> Any: ... - def llen(self, name: _Key) -> Any: ... - def lpop(self, name, count: int | None = None) -> Any: ... - def lpush(self, name: _Value, *values: _Value) -> Any: ... - def lpushx(self, name, value) -> Any: ... - def lrange(self, name: _Key, start: int, end: int) -> Any: ... - def lrem(self, name: _Key, count: int, value: _Value) -> Any: ... - def lset(self, name: _Key, index: int, value: _Value) -> Any: ... - def ltrim(self, name: _Key, start: int, end: int) -> Any: ... - def rpop(self, name, count: int | None = None) -> Any: ... - def rpoplpush(self, src, dst) -> Any: ... - def rpush(self, name: _Value, *values: _Value) -> Any: ... - def rpushx(self, name, value) -> Any: ... - def lpos( - self, name, value, rank: Incomplete | None = None, count: Incomplete | None = None, maxlen: Incomplete | None = None - ) -> Any: ... - @overload # type: ignore[override] - def sort( - self, - name: _Key, - start: int | None = None, - num: int | None = None, - by: _Key | None = None, - get: _Key | Sequence[_Key] | None = None, - desc: bool = False, - alpha: bool = False, - store: None = None, - groups: bool = False, - ) -> list[_StrType]: ... - @overload - def sort( - self, - name: _Key, - start: int | None = None, - num: int | None = None, - by: _Key | None = None, - get: _Key | Sequence[_Key] | None = None, - desc: bool = False, - alpha: bool = False, - *, - store: _Key, - groups: bool = False, - ) -> Any: ... - @overload - def sort( - self, - name: _Key, - start: int | None, - num: int | None, - by: _Key | None, - get: _Key | Sequence[_Key] | None, - desc: bool, - alpha: bool, - store: _Key, - groups: bool = False, - ) -> Any: ... - # endregion - # region scan commands - def scan( - self, - cursor: int = 0, - match: _Key | None = None, - count: int | None = None, - _type: str | None = None, - **kwargs: _CommandOptions, - ) -> Any: ... - def sscan(self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None) -> Any: ... - def hscan(self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None) -> Any: ... - @overload - def zscan(self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None) -> Any: ... - @overload - def zscan( - self, - name: _Key, - cursor: int = 0, - match: _Key | None = None, - count: int | None = None, - *, - score_cast_func: Callable[[_StrType], Any], - ) -> Any: ... - @overload - def zscan( - self, name: _Key, cursor: int, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], Any] - ) -> Any: ... - # endregion - # region set commands - def sadd(self, name: _Key, *values: _Value) -> Any: ... - def scard(self, name: _Key) -> Any: ... - def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - def sismember(self, name: _Key, value: _Value) -> Any: ... - def smembers(self, name: _Key) -> Any: ... - def smismember(self, name, values, *args) -> Any: ... - def smove(self, src: _Key, dst: _Key, value: _Value) -> Any: ... - @overload - def spop(self, name: _Key, count: None = None) -> Any: ... - @overload - def spop(self, name: _Key, count: int) -> Any: ... - @overload - def srandmember(self, name: _Key, number: None = None) -> Any: ... - @overload - def srandmember(self, name: _Key, number: int) -> Any: ... - def srem(self, name: _Key, *values: _Value) -> Any: ... - def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Any: ... - # endregion - # region stream commands - def xack(self, name, groupname, *ids) -> Any: ... - def xadd( - self, - name, - fields, - id: str | int | bytes | memoryview = "*", - maxlen=None, - approximate: bool = True, - nomkstream: bool = False, - minid: Incomplete | None = None, - limit: Incomplete | None = None, - ) -> Any: ... - def xautoclaim( - self, - name, - groupname, - consumername, - min_idle_time, - start_id: StreamIdT = "0-0", - count: Incomplete | None = None, - justid: bool = False, - ) -> Any: ... - def xclaim( - self, - name, - groupname, - consumername, - min_idle_time, - message_ids, - idle=None, - time=None, - retrycount=None, - force=False, - justid=False, - ) -> Any: ... - def xdel(self, name, *ids) -> Any: ... - def xgroup_create(self, name, groupname, id: str = "$", mkstream: bool = False, entries_read: int | None = None) -> Any: ... - def xgroup_delconsumer(self, name, groupname, consumername) -> Any: ... - def xgroup_destroy(self, name, groupname) -> Any: ... - def xgroup_createconsumer(self, name, groupname, consumername) -> Any: ... - def xgroup_setid(self, name, groupname, id, entries_read: int | None = None) -> Any: ... - def xinfo_consumers(self, name, groupname) -> Any: ... - def xinfo_groups(self, name) -> Any: ... - def xinfo_stream(self, name, full: bool = False) -> Any: ... - def xlen(self, name: _Key) -> Any: ... - def xpending(self, name, groupname) -> Any: ... - def xpending_range( - self, name: _Key, groupname, min, max, count: int, consumername: Incomplete | None = None, idle: int | None = None - ) -> Any: ... - def xrange(self, name, min: str = "-", max: str = "+", count: Incomplete | None = None) -> Any: ... - def xread(self, streams, count: Incomplete | None = None, block: Incomplete | None = None) -> Any: ... - def xreadgroup( - self, - groupname, - consumername, - streams, - count: Incomplete | None = None, - block: Incomplete | None = None, - noack: bool = False, - ) -> Any: ... - def xrevrange(self, name, max: str = "+", min: str = "-", count: Incomplete | None = None) -> Any: ... - def xtrim( - self, name, maxlen: int | None = None, approximate: bool = True, minid: Incomplete | None = None, limit: int | None = None - ) -> Any: ... - # endregion - # region sorted set commands - def zadd( - self, - name: _Key, - mapping: Mapping[_Key, _Value], - nx: bool = False, - xx: bool = False, - ch: bool = False, - incr: bool = False, - gt: Incomplete | None = False, - lt: Incomplete | None = False, - ) -> Any: ... - def zcard(self, name: _Key) -> Any: ... - def zcount(self, name: _Key, min: _Value, max: _Value) -> Any: ... - def zdiff(self, keys, withscores: bool = False) -> Any: ... - def zdiffstore(self, dest, keys) -> Any: ... - def zincrby(self, name: _Key, amount: float, value: _Value) -> Any: ... - def zinter(self, keys, aggregate: Incomplete | None = None, withscores: bool = False) -> Any: ... - def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None) -> Any: ... - def zlexcount(self, name: _Key, min: _Value, max: _Value) -> Any: ... - def zpopmax(self, name: _Key, count: int | None = None) -> Any: ... - def zpopmin(self, name: _Key, count: int | None = None) -> Any: ... - def zrandmember(self, key, count: Incomplete | None = None, withscores: bool = False) -> Any: ... - @overload - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = 0) -> Any: ... - @overload - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> Any: ... - @overload - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = 0) -> Any: ... - @overload - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> Any: ... - @overload # type: ignore[override] - def zrange( - self, - name: _Key, - start: int, - end: int, - desc: bool, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], Any], - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> Any: ... - @overload - def zrange( - self, - name: _Key, - start: int, - end: int, - desc: bool, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], float] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> Any: ... - @overload - def zrange( - self, - name: _Key, - start: int, - end: int, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], None], - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> Any: ... - @overload - def zrange( - self, - name: _Key, - start: int, - end: int, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], float] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> Any: ... - @overload - def zrange( - self, - name: _Key, - start: int, - end: int, - desc: bool = False, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> Any: ... - @overload # type: ignore[override] - def zrevrange( - self, name: _Key, start: int, end: int, withscores: Literal[True], score_cast_func: Callable[[_StrType], None] - ) -> Any: ... - @overload - def zrevrange(self, name: _Key, start: int, end: int, withscores: Literal[True]) -> Any: ... - @overload - def zrevrange( - self, name: _Key, start: int, end: int, withscores: bool = False, score_cast_func: Callable[[Any], Any] = ... - ) -> Any: ... - def zrangestore( - self, - dest, - name, - start, - end, - byscore: bool = False, - bylex: bool = False, - desc: bool = False, - offset: Incomplete | None = None, - num: Incomplete | None = None, - ) -> Any: ... - def zrangebylex(self, name: _Key, min: _Value, max: _Value, start: int | None = None, num: int | None = None) -> Any: ... - def zrevrangebylex(self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None) -> Any: ... - @overload # type: ignore[override] - def zrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = None, - num: int | None = None, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], None], - ) -> Any: ... - @overload - def zrangebyscore( - self, name: _Key, min: _Value, max: _Value, start: int | None = None, num: int | None = None, *, withscores: Literal[True] - ) -> Any: ... - @overload - def zrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> Any: ... - @overload - def zrevrangebyscore( - self, - name: _Key, - max: _Value, - min: _Value, - start: int | None = None, - num: int | None = None, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], Any], - ) -> Any: ... - @overload - def zrevrangebyscore( - self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None, *, withscores: Literal[True] - ) -> Any: ... - @overload - def zrevrangebyscore( - self, - name: _Key, - max: _Value, - min: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> Any: ... - def zrank(self, name: _Key, value: _Value, withscore: bool = False) -> Any: ... - def zrem(self, name: _Key, *values: _Value) -> Any: ... - def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> Any: ... - def zremrangebyrank(self, name: _Key, min: int, max: int) -> Any: ... - def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> Any: ... - def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> Any: ... - def zscore(self, name: _Key, value: _Value) -> Any: ... - def zunion(self, keys, aggregate: Incomplete | None = None, withscores: bool = False) -> Any: ... - def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None) -> Any: ... - def zmscore(self, key, members) -> Any: ... - # endregion - # region management commands - def bgrewriteaof(self, **kwargs: _CommandOptions) -> Any: ... - def bgsave(self, schedule: bool = True, **kwargs: _CommandOptions) -> Any: ... - def role(self) -> Any: ... - def client_kill(self, address: str, **kwargs: _CommandOptions) -> Any: ... - def client_kill_filter( - self, - _id: Incomplete | None = None, - _type: Incomplete | None = None, - addr: Incomplete | None = None, - skipme: Incomplete | None = None, - laddr: Incomplete | None = None, - user: Incomplete | None = None, - **kwargs: _CommandOptions, - ) -> Any: ... - def client_info(self, **kwargs: _CommandOptions) -> Any: ... - def client_list(self, _type: str | None = None, client_id: list[str] = [], **kwargs: _CommandOptions) -> Any: ... - def client_getname(self, **kwargs: _CommandOptions) -> Any: ... - def client_getredir(self, **kwargs: _CommandOptions) -> Any: ... - def client_reply(self, reply, **kwargs: _CommandOptions) -> Any: ... - def client_id(self, **kwargs: _CommandOptions) -> Any: ... - def client_tracking_on( - self, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - ) -> Any: ... - def client_tracking_off( - self, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - ) -> Any: ... - def client_tracking( - self, - on: bool = True, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - **kwargs: _CommandOptions, - ) -> Any: ... - def client_trackinginfo(self, **kwargs: _CommandOptions) -> Any: ... - def client_setname(self, name: str, **kwargs: _CommandOptions) -> Any: ... - def client_unblock(self, client_id, error: bool = False, **kwargs: _CommandOptions) -> Any: ... - def client_pause(self, timeout, all: bool = True, **kwargs: _CommandOptions) -> Any: ... - def client_unpause(self, **kwargs: _CommandOptions) -> Any: ... - def command(self, **kwargs: _CommandOptions) -> Any: ... - def command_info(self, **kwargs: _CommandOptions) -> Any: ... - def command_count(self, **kwargs: _CommandOptions) -> Any: ... - def config_get(self, pattern: PatternT = "*", *args: PatternT, **kwargs: _CommandOptions) -> Any: ... - def config_set(self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions) -> Any: ... - def config_resetstat(self, **kwargs: _CommandOptions) -> Any: ... - def config_rewrite(self, **kwargs: _CommandOptions) -> Any: ... - def dbsize(self, **kwargs: _CommandOptions) -> Any: ... - def debug_object(self, key, **kwargs: _CommandOptions) -> Any: ... - def debug_segfault(self, **kwargs: _CommandOptions) -> Any: ... - def echo(self, value: _Value, **kwargs: _CommandOptions) -> Any: ... - def flushall(self, asynchronous: bool = False, **kwargs: _CommandOptions) -> Any: ... - def flushdb(self, asynchronous: bool = False, **kwargs: _CommandOptions) -> Any: ... - def sync(self) -> Any: ... - def psync(self, replicationid, offset) -> Any: ... - def swapdb(self, first, second, **kwargs: _CommandOptions) -> Any: ... - def select(self, index, **kwargs: _CommandOptions) -> Any: ... - def info(self, section: _Key | None = None, *args: _Key, **kwargs: _CommandOptions) -> Any: ... - def lastsave(self, **kwargs: _CommandOptions) -> Any: ... - def lolwut(self, *version_numbers: _Value, **kwargs: _CommandOptions) -> Any: ... - def migrate( - self, - host, - port, - keys, - destination_db, - timeout, - copy: bool = False, - replace: bool = False, - auth: Incomplete | None = None, - **kwargs: _CommandOptions, - ) -> Any: ... - def object(self, infotype, key, **kwargs: _CommandOptions) -> Any: ... - def memory_doctor(self, **kwargs: _CommandOptions) -> Any: ... - def memory_help(self, **kwargs: _CommandOptions) -> Any: ... - def memory_stats(self, **kwargs: _CommandOptions) -> Any: ... - def memory_malloc_stats(self, **kwargs: _CommandOptions) -> Any: ... - def memory_usage(self, key, samples: Incomplete | None = None, **kwargs: _CommandOptions) -> Any: ... - def memory_purge(self, **kwargs: _CommandOptions) -> Any: ... - def ping(self, **kwargs: _CommandOptions) -> Any: ... - def quit(self, **kwargs: _CommandOptions) -> Any: ... - def replicaof(self, *args, **kwargs: _CommandOptions) -> Any: ... - def save(self, **kwargs: _CommandOptions) -> Any: ... - def shutdown( - self, - save: bool = False, - nosave: bool = False, - now: bool = False, - force: bool = False, - abort: bool = False, - **kwargs: _CommandOptions, - ) -> Any: ... - def slaveof(self, host: Incomplete | None = None, port: Incomplete | None = None, **kwargs: _CommandOptions) -> Any: ... - def slowlog_get(self, num: Incomplete | None = None, **kwargs: _CommandOptions) -> Any: ... - def slowlog_len(self, **kwargs: _CommandOptions) -> Any: ... - def slowlog_reset(self, **kwargs: _CommandOptions) -> Any: ... - def time(self, **kwargs: _CommandOptions) -> Any: ... - def wait(self, num_replicas, timeout, **kwargs: _CommandOptions) -> Any: ... - # endregion - # region module commands - def module_load(self, path, *args) -> Any: ... - def module_unload(self, name) -> Any: ... - def module_list(self) -> Any: ... - def command_getkeys(self, *args) -> Any: ... - # endregion - # region pubsub commands - def publish(self, channel: _Key, message: _Key, **kwargs: _CommandOptions) -> Any: ... - def pubsub_channels(self, pattern: _Key = "*", **kwargs: _CommandOptions) -> Any: ... - def pubsub_numpat(self, **kwargs: _CommandOptions) -> Any: ... - def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> Any: ... - # endregion - # region script commands - def eval(self, script, numkeys, *keys_and_args) -> Any: ... - def evalsha(self, sha, numkeys, *keys_and_args) -> Any: ... - def script_exists(self, *args) -> Any: ... - def script_debug(self, *args) -> Any: ... - def script_flush(self, sync_type: Incomplete | None = None) -> Any: ... - def script_kill(self) -> Any: ... - def script_load(self, script) -> Any: ... - def register_script(self, script: str | _StrType) -> Any: ... # type: ignore[override] - # endregion diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/cluster.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/cluster.pyi deleted file mode 100644 index 2ac5263d45f9..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/cluster.pyi +++ /dev/null @@ -1,229 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Awaitable, Callable, Mapping -from types import TracebackType -from typing import Any, Generic, TypeVar -from typing_extensions import Self - -from redis.asyncio.client import ResponseCallbackT -from redis.asyncio.connection import AbstractConnection, BaseParser, Connection, Encoder -from redis.asyncio.parser import CommandsParser -from redis.client import AbstractRedis -from redis.cluster import AbstractRedisCluster, LoadBalancer - -# TODO: add AsyncRedisClusterCommands stubs -# from redis.commands import AsyncRedisClusterCommands -from redis.commands.core import _StrType -from redis.credentials import CredentialProvider -from redis.exceptions import ResponseError -from redis.retry import Retry -from redis.typing import AnyKeyT, EncodableT, KeyT - -TargetNodesT = TypeVar("TargetNodesT", str, ClusterNode, list[ClusterNode], dict[Any, ClusterNode]) # noqa: Y001 - -# It uses `DefaultParser` in real life, but it is a dynamic base class. -class ClusterParser(BaseParser): - def on_disconnect(self) -> None: ... - def on_connect(self, connection: AbstractConnection) -> None: ... - async def can_read_destructive(self) -> bool: ... - async def read_response(self, disable_decoding: bool = False) -> EncodableT | ResponseError | list[EncodableT] | None: ... - -class RedisCluster(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # TODO: AsyncRedisClusterCommands - @classmethod - def from_url( - cls, - url: str, - *, - host: str | None = None, - port: str | int = 6379, - # Cluster related kwargs - startup_nodes: list[ClusterNode] | None = None, - require_full_coverage: bool = True, - read_from_replicas: bool = False, - reinitialize_steps: int = 5, - cluster_error_retry_attempts: int = 3, - connection_error_retry_attempts: int = 3, - max_connections: int = 2147483648, - # Client related kwargs - db: str | int = 0, - path: str | None = None, - credential_provider: CredentialProvider | None = None, - username: str | None = None, - password: str | None = None, - client_name: str | None = None, - # Encoding related kwargs - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - # Connection related kwargs - health_check_interval: float = 0, - socket_connect_timeout: float | None = None, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - socket_timeout: float | None = None, - retry: Retry | None = None, - retry_on_error: list[Exception] | None = None, - # SSL related kwargs - ssl: bool = False, - ssl_ca_certs: str | None = None, - ssl_ca_data: str | None = None, - ssl_cert_reqs: str = "required", - ssl_certfile: str | None = None, - ssl_check_hostname: bool = False, - ssl_keyfile: str | None = None, - address_remap: Callable[[str, int], tuple[str, int]] | None = None, - ) -> Self: ... - - retry: Retry | None - connection_kwargs: dict[str, Any] - nodes_manager: NodesManager - encoder: Encoder - read_from_replicas: bool - reinitialize_steps: int - cluster_error_retry_attempts: int - reinitialize_counter: int - commands_parser: CommandsParser - node_flags: set[str] - command_flags: dict[str, str] - response_callbacks: Incomplete - result_callbacks: dict[str, Callable[[Incomplete, Incomplete], Incomplete]] - - def __init__( - self, - host: str | None = None, - port: str | int = 6379, - # Cluster related kwargs - startup_nodes: list[ClusterNode] | None = None, - require_full_coverage: bool = True, - read_from_replicas: bool = False, - reinitialize_steps: int = 5, - cluster_error_retry_attempts: int = 3, - connection_error_retry_attempts: int = 3, - max_connections: int = 2147483648, - # Client related kwargs - db: str | int = 0, - path: str | None = None, - credential_provider: CredentialProvider | None = None, - username: str | None = None, - password: str | None = None, - client_name: str | None = None, - # Encoding related kwargs - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - # Connection related kwargs - health_check_interval: float = 0, - socket_connect_timeout: float | None = None, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - socket_timeout: float | None = None, - retry: Retry | None = None, - retry_on_error: list[Exception] | None = None, - # SSL related kwargs - ssl: bool = False, - ssl_ca_certs: str | None = None, - ssl_ca_data: str | None = None, - ssl_cert_reqs: str = "required", - ssl_certfile: str | None = None, - ssl_check_hostname: bool = False, - ssl_keyfile: str | None = None, - address_remap: Callable[[str, int], tuple[str, int]] | None = None, - ) -> None: ... - async def initialize(self) -> Self: ... - async def close(self) -> None: ... - async def __aenter__(self) -> Self: ... - async def __aexit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __await__(self) -> Awaitable[Self]: ... - def __del__(self) -> None: ... - async def on_connect(self, connection: Connection) -> None: ... - def get_nodes(self) -> list[ClusterNode]: ... - def get_primaries(self) -> list[ClusterNode]: ... - def get_replicas(self) -> list[ClusterNode]: ... - def get_random_node(self) -> ClusterNode: ... - def get_default_node(self) -> ClusterNode: ... - def set_default_node(self, node: ClusterNode) -> None: ... - def get_node(self, host: str | None = None, port: int | None = None, node_name: str | None = None) -> ClusterNode | None: ... - def get_node_from_key(self, key: str, replica: bool = False) -> ClusterNode | None: ... - def keyslot(self, key: EncodableT) -> int: ... - def get_encoder(self) -> Encoder: ... - def get_connection_kwargs(self) -> dict[str, Any | None]: ... - def set_response_callback(self, command: str, callback: ResponseCallbackT) -> None: ... - async def execute_command(self, *args: EncodableT, **kwargs: Any) -> Any: ... - def pipeline(self, transaction: Any | None = None, shard_hint: Any | None = None) -> ClusterPipeline[_StrType]: ... - -class ClusterNode: - host: str - port: str | int - name: str - server_type: str | None - max_connections: int - connection_class: type[Connection] - connection_kwargs: dict[str, Any] - response_callbacks: dict[Incomplete, Incomplete] - def __init__( - self, - host: str, - port: str | int, - server_type: str | None = None, - *, - max_connections: int = 2147483648, - connection_class: type[Connection] = ..., - **connection_kwargs: Any, - ) -> None: ... - def __eq__(self, obj: object) -> bool: ... - def __del__(self) -> None: ... - async def disconnect(self) -> None: ... - def acquire_connection(self) -> Connection: ... - async def parse_response(self, connection: Connection, command: str, **kwargs: Any) -> Any: ... - async def execute_command(self, *args: Any, **kwargs: Any) -> Any: ... - async def execute_pipeline(self, commands: list[PipelineCommand]) -> bool: ... - -class NodesManager: - startup_nodes: dict[str, ClusterNode] - require_full_coverage: bool - connection_kwargs: dict[str, Any] - default_node: ClusterNode | None - nodes_cache: dict[str, ClusterNode] - slots_cache: dict[int, list[ClusterNode]] - read_load_balancer: LoadBalancer - address_remap: Callable[[str, int], tuple[str, int]] | None - def __init__( - self, - startup_nodes: list[ClusterNode], - require_full_coverage: bool, - connection_kwargs: dict[str, Any], - address_remap: Callable[[str, int], tuple[str, int]] | None = None, - ) -> None: ... - def get_node(self, host: str | None = None, port: int | None = None, node_name: str | None = None) -> ClusterNode | None: ... - def set_nodes(self, old: dict[str, ClusterNode], new: dict[str, ClusterNode], remove_old: bool = False) -> None: ... - def get_node_from_slot(self, slot: int, read_from_replicas: bool = False) -> ClusterNode: ... - def get_nodes_by_server_type(self, server_type: str) -> list[ClusterNode]: ... - async def initialize(self) -> None: ... - async def close(self, attr: str = "nodes_cache") -> None: ... - def remap_host_port(self, host: str, port: int) -> tuple[str, int]: ... - -class ClusterPipeline(AbstractRedis, AbstractRedisCluster, Generic[_StrType]): # TODO: AsyncRedisClusterCommands - def __init__(self, client: RedisCluster[_StrType]) -> None: ... - async def initialize(self) -> Self: ... - async def __aenter__(self) -> Self: ... - async def __aexit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __await__(self) -> Awaitable[Self]: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __bool__(self) -> bool: ... - def __len__(self) -> int: ... - def execute_command(self, *args: KeyT | EncodableT, **kwargs: Any) -> Self: ... - async def execute(self, raise_on_error: bool = True, allow_redirections: bool = True) -> list[Any]: ... - def mset_nonatomic(self, mapping: Mapping[AnyKeyT, EncodableT]) -> Self: ... - -class PipelineCommand: - args: Any - kwargs: Any - position: int - result: Exception | None | Any - def __init__(self, position: int, *args: Any, **kwargs: Any) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/connection.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/connection.pyi deleted file mode 100644 index 1cc16e303c66..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/connection.pyi +++ /dev/null @@ -1,363 +0,0 @@ -import asyncio -import enum -import ssl -from _typeshed import Unused -from abc import abstractmethod -from collections.abc import Callable, Iterable, Mapping -from types import MappingProxyType -from typing import Any, Final, Generic, Literal, Protocol, TypedDict, TypeVar, overload -from typing_extensions import Self, TypeAlias - -from redis.asyncio.retry import Retry -from redis.credentials import CredentialProvider -from redis.exceptions import AuthenticationError, RedisError, ResponseError -from redis.typing import EncodableT, EncodedT - -_SSLVerifyMode: TypeAlias = Literal["none", "optional", "required"] - -SYM_STAR: Final[bytes] -SYM_DOLLAR: Final[bytes] -SYM_CRLF: Final[bytes] -SYM_LF: Final[bytes] -SYM_EMPTY: Final[bytes] - -SERVER_CLOSED_CONNECTION_ERROR: Final[str] - -class _Sentinel(enum.Enum): - sentinel = object() - -SENTINEL: Final[object] -MODULE_LOAD_ERROR: Final[str] -NO_SUCH_MODULE_ERROR: Final[str] -MODULE_UNLOAD_NOT_POSSIBLE_ERROR: Final[str] -MODULE_EXPORTS_DATA_TYPES_ERROR: Final[str] -NO_AUTH_SET_ERROR: Final[dict[str, type[AuthenticationError]]] - -class Encoder: - encoding: str - encoding_errors: str - decode_responses: bool - def __init__(self, encoding: str, encoding_errors: str, decode_responses: bool) -> None: ... - def encode(self, value: EncodableT) -> EncodedT: ... - def decode(self, value: EncodableT, force: bool = False) -> EncodableT: ... - -ExceptionMappingT: TypeAlias = Mapping[str, type[Exception] | Mapping[str, type[Exception]]] - -class BaseParser: - EXCEPTION_CLASSES: ExceptionMappingT - def __init__(self, socket_read_size: int) -> None: ... - @classmethod - def parse_error(cls, response: str) -> ResponseError: ... - @abstractmethod - def on_disconnect(self) -> None: ... - @abstractmethod - def on_connect(self, connection: AbstractConnection) -> None: ... - @abstractmethod - async def can_read_destructive(self) -> bool: ... - @abstractmethod - async def read_response(self, disable_decoding: bool = False) -> EncodableT | ResponseError | list[EncodableT] | None: ... - -class PythonParser(BaseParser): - encoder: Encoder | None - def __init__(self, socket_read_size: int) -> None: ... - def on_connect(self, connection: AbstractConnection) -> None: ... - def on_disconnect(self) -> None: ... - async def can_read_destructive(self) -> bool: ... - async def read_response(self, disable_decoding: bool = False) -> EncodableT | ResponseError | None: ... - -class HiredisParser(BaseParser): - def __init__(self, socket_read_size: int) -> None: ... - def on_connect(self, connection: AbstractConnection) -> None: ... - def on_disconnect(self) -> None: ... - async def can_read_destructive(self) -> bool: ... - async def read_from_socket(self) -> Literal[True]: ... - async def read_response(self, disable_decoding: bool = False) -> EncodableT | list[EncodableT]: ... - -DefaultParser: type[PythonParser | HiredisParser] - -class ConnectCallbackProtocol(Protocol): - def __call__(self, connection: Connection): ... - -class AsyncConnectCallbackProtocol(Protocol): - async def __call__(self, connection: Connection): ... - -ConnectCallbackT: TypeAlias = ConnectCallbackProtocol | AsyncConnectCallbackProtocol - -class AbstractConnection: - pid: int - db: str | int - client_name: str | None - credential_provider: CredentialProvider | None - password: str | None - username: str | None - socket_timeout: float | None - socket_connect_timeout: float | None - retry_on_timeout: bool - retry_on_error: list[type[Exception]] - retry: Retry - health_check_interval: float - next_health_check: float - encoder: Encoder - redis_connect_func: ConnectCallbackT | None - - def __init__( - self, - *, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | _Sentinel = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: ConnectCallbackT | None = None, - encoder_class: type[Encoder] = ..., - credential_provider: CredentialProvider | None = None, - ) -> None: ... - @abstractmethod - def repr_pieces(self) -> list[tuple[str, Any]]: ... - @property - def is_connected(self) -> bool: ... - def register_connect_callback(self, callback: ConnectCallbackT) -> None: ... - def clear_connect_callbacks(self) -> None: ... - def set_parser(self, parser_class: type[BaseParser]) -> None: ... - async def connect(self) -> None: ... - async def on_connect(self) -> None: ... - async def disconnect(self, nowait: bool = False) -> None: ... - async def check_health(self) -> None: ... - async def send_packed_command(self, command: bytes | str | Iterable[bytes], check_health: bool = True) -> None: ... - async def send_command(self, *args: Any, **kwargs: Any) -> None: ... - async def can_read_destructive(self) -> bool: ... - async def read_response( - self, disable_decoding: bool = False, timeout: float | None = None, *, disconnect_on_error: bool = True - ) -> EncodableT | list[EncodableT] | None: ... - def pack_command(self, *args: EncodableT) -> list[bytes]: ... - def pack_commands(self, commands: Iterable[Iterable[EncodableT]]) -> list[bytes]: ... - -class Connection(AbstractConnection): - host: str - port: int - socket_keepalive: bool - socket_keepalive_options: Mapping[int, int | bytes] | None - socket_type: int - - def __init__( - self, - *, - host: str = "localhost", - port: str | int = 6379, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - socket_type: int = 0, - # **kwargs forwarded to AbstractConnection. - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | _Sentinel = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: ConnectCallbackT | None = None, - encoder_class: type[Encoder] = ..., - credential_provider: CredentialProvider | None = None, - ) -> None: ... - def repr_pieces(self) -> list[tuple[str, Any]]: ... - -class SSLConnection(Connection): - ssl_context: RedisSSLContext - def __init__( - self, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: _SSLVerifyMode = "required", - ssl_ca_certs: str | None = None, - ssl_ca_data: str | None = None, - ssl_check_hostname: bool = False, - *, - # **kwargs forwarded to Connection. - host: str = "localhost", - port: str | int = 6379, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - socket_type: int = 0, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | _Sentinel = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: ConnectCallbackT | None = None, - encoder_class: type[Encoder] = ..., - credential_provider: CredentialProvider | None = None, - ) -> None: ... - @property - def keyfile(self) -> str | None: ... - @property - def certfile(self) -> str | None: ... - @property - def cert_reqs(self) -> ssl.VerifyMode: ... - @property - def ca_certs(self) -> str | None: ... - @property - def ca_data(self) -> str | None: ... - @property - def check_hostname(self) -> bool: ... - -class RedisSSLContext: - keyfile: str | None - certfile: str | None - cert_reqs: ssl.VerifyMode - ca_certs: str | None - ca_data: str | None - check_hostname: bool - context: ssl.SSLContext | None - def __init__( - self, - keyfile: str | None = None, - certfile: str | None = None, - cert_reqs: _SSLVerifyMode | None = None, - ca_certs: str | None = None, - ca_data: str | None = None, - check_hostname: bool = False, - ) -> None: ... - def get(self) -> ssl.SSLContext: ... - -class UnixDomainSocketConnection(Connection): - path: str - def __init__( - self, - *, - path: str = "", - # **kwargs forwarded to AbstractConnection. - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | _Sentinel = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: ConnectCallbackT | None = None, - encoder_class: type[Encoder] = ..., - credential_provider: CredentialProvider | None = None, - ) -> None: ... - def repr_pieces(self) -> list[tuple[str, Any]]: ... - -FALSE_STRINGS: Final[tuple[str, ...]] - -def to_bool(value: object) -> bool | None: ... - -URL_QUERY_ARGUMENT_PARSERS: MappingProxyType[str, Callable[[str], Any]] - -class ConnectKwargs(TypedDict): - username: str - password: str - connection_class: type[AbstractConnection] - host: str - port: int - db: int - path: str - -def parse_url(url: str) -> ConnectKwargs: ... - -_ConnectionT = TypeVar("_ConnectionT", bound=AbstractConnection) - -class ConnectionPool(Generic[_ConnectionT]): - # kwargs accepts all arguments from the connection class chosen for - # the given URL, except those encoded in the URL itself. - @classmethod - def from_url(cls, url: str, **kwargs: Any) -> Self: ... - - connection_class: type[_ConnectionT] - connection_kwargs: Mapping[str, Any] - max_connections: int - encoder_class: type[Encoder] - pid: int - - @overload - def __init__( - self: ConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780 - connection_class: type[_ConnectionT], - max_connections: int | None = None, - # **kwargs are passed to the constructed connection instances. - **connection_kwargs: Any, - ) -> None: ... - @overload - def __init__(self: ConnectionPool[Connection], *, max_connections: int | None = None, **connection_kwargs) -> None: ... - def reset(self) -> None: ... - async def get_connection(self, command_name: Unused, *keys: Unused, **options: Unused) -> _ConnectionT: ... - def get_encoder(self) -> Encoder: ... - def make_connection(self) -> _ConnectionT: ... - async def release(self, connection: AbstractConnection) -> None: ... - def owns_connection(self, connection: AbstractConnection) -> bool: ... - async def disconnect(self, inuse_connections: bool = True) -> None: ... - def set_retry(self, retry: Retry) -> None: ... - -class BlockingConnectionPool(ConnectionPool[_ConnectionT]): - queue_class: type[asyncio.Queue[_ConnectionT | None]] - timeout: int | None - pool: asyncio.Queue[_ConnectionT | None] - - @overload - def __init__( - self: BlockingConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780 - max_connections: int, - timeout: int | None, - connection_class: type[_ConnectionT], - queue_class: type[asyncio.Queue[_ConnectionT | None]] = ..., - # **kwargs are passed to the constructed connection instances. - **connection_kwargs: Any, - ) -> None: ... - @overload - def __init__( - self: BlockingConnectionPool[_ConnectionT], # pyright: ignore[reportInvalidTypeVarUse] #11780 - max_connections: int = 50, - timeout: int | None = 20, - *, - connection_class: type[_ConnectionT], - queue_class: type[asyncio.Queue[_ConnectionT | None]] = ..., - # **kwargs are passed to the constructed connection instances. - **connection_kwargs: Any, - ) -> None: ... - @overload - def __init__( - self: BlockingConnectionPool[Connection], - max_connections: int = 50, - timeout: int | None = 20, - *, - queue_class: type[asyncio.Queue[Connection | None]] = ..., - # **kwargs are passed to the constructed connection instances. - **connection_kwargs: Any, - ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/lock.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/lock.pyi deleted file mode 100644 index 1088d0f8f073..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/lock.pyi +++ /dev/null @@ -1,51 +0,0 @@ -import threading -from collections.abc import Awaitable -from types import SimpleNamespace, TracebackType -from typing import Any, ClassVar -from typing_extensions import Self - -from redis.asyncio import Redis -from redis.commands.core import AsyncScript - -class Lock: - lua_release: ClassVar[AsyncScript | None] - lua_extend: ClassVar[AsyncScript | None] - lua_reacquire: ClassVar[AsyncScript | None] - LUA_RELEASE_SCRIPT: ClassVar[str] - LUA_EXTEND_SCRIPT: ClassVar[str] - LUA_REACQUIRE_SCRIPT: ClassVar[str] - redis: Redis[Any] - name: str | bytes | memoryview - timeout: float | None - sleep: float - blocking: bool - blocking_timeout: float | None - thread_local: bool - local: threading.local | SimpleNamespace - def __init__( - self, - redis: Redis[Any], - name: str | bytes | memoryview, - timeout: float | None = None, - sleep: float = 0.1, - blocking: bool = True, - blocking_timeout: float | None = None, - thread_local: bool = True, - ) -> None: ... - def register_scripts(self) -> None: ... - async def __aenter__(self) -> Self: ... - async def __aexit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None - ) -> None: ... - async def acquire( - self, blocking: bool | None = None, blocking_timeout: float | None = None, token: str | bytes | None = None - ) -> bool: ... - async def do_acquire(self, token: str | bytes) -> bool: ... - async def locked(self) -> bool: ... - async def owned(self) -> bool: ... - def release(self) -> Awaitable[None]: ... - async def do_release(self, expected_token: bytes) -> None: ... - def extend(self, additional_time: float, replace_ttl: bool = False) -> Awaitable[bool]: ... - async def do_extend(self, additional_time: float, replace_ttl: bool) -> bool: ... - def reacquire(self) -> Awaitable[bool]: ... - async def do_reacquire(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/parser.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/parser.pyi deleted file mode 100644 index 3a6d1ce6422c..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/parser.pyi +++ /dev/null @@ -1,9 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -# TODO: define and use: -# from redis.asyncio.cluster import ClusterNode - -class CommandsParser: - async def initialize(self, node: Incomplete | None = None) -> None: ... # TODO: ClusterNode - async def get_keys(self, *args: Any) -> tuple[str, ...] | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/retry.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/retry.pyi deleted file mode 100644 index 1579606a50cd..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/retry.pyi +++ /dev/null @@ -1,12 +0,0 @@ -from collections.abc import Awaitable, Callable, Iterable -from typing import TypeVar - -from redis.backoff import AbstractBackoff -from redis.exceptions import RedisError - -_T = TypeVar("_T") - -class Retry: - def __init__(self, backoff: AbstractBackoff, retries: int, supported_errors: tuple[type[RedisError], ...] = ...) -> None: ... - def update_supported_errors(self, specified_errors: Iterable[type[RedisError]]) -> None: ... - async def call_with_retry(self, do: Callable[[], Awaitable[_T]], fail: Callable[[RedisError], Awaitable[object]]) -> _T: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/sentinel.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/sentinel.pyi deleted file mode 100644 index a50ebdee57c3..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/sentinel.pyi +++ /dev/null @@ -1,162 +0,0 @@ -from collections.abc import AsyncIterator, Iterable, Mapping -from typing import Any, Literal, TypedDict, TypeVar, overload - -from redis.asyncio.client import Redis -from redis.asyncio.connection import ( - BaseParser, - ConnectCallbackT, - Connection, - ConnectionPool, - Encoder, - SSLConnection, - _ConnectionT, - _Sentinel, -) -from redis.asyncio.retry import Retry -from redis.commands import AsyncSentinelCommands -from redis.credentials import CredentialProvider -from redis.exceptions import ConnectionError, RedisError - -_RedisT = TypeVar("_RedisT", bound=Redis[Any]) - -class MasterNotFoundError(ConnectionError): ... -class SlaveNotFoundError(ConnectionError): ... - -class SentinelManagedConnection(Connection): - connection_pool: ConnectionPool[Any] | None - def __init__( - self, - *, - connection_pool: ConnectionPool[Any] | None, - # **kwargs forwarded to Connection. - host: str = "localhost", - port: str | int = 6379, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - socket_type: int = 0, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | _Sentinel = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: ConnectCallbackT | None = None, - encoder_class: type[Encoder] = ..., - credential_provider: CredentialProvider | None = None, - ) -> None: ... - async def connect_to(self, address: tuple[str, int]) -> None: ... - async def connect(self) -> None: ... - -class SentinelManagedSSLConnection(SentinelManagedConnection, SSLConnection): ... - -class SentinelConnectionPool(ConnectionPool[_ConnectionT]): - is_master: bool - check_connection: bool - service_name: str - sentinel_manager: Sentinel - master_address: tuple[str, int] | None - slave_rr_counter: int | None - - def __init__( - self, - service_name: str, - sentinel_manager: Sentinel, - *, - ssl: bool = False, - connection_class: type[SentinelManagedConnection] = ..., - is_master: bool = True, - check_connection: bool = False, - # **kwargs ultimately forwarded to construction Connection instances. - host: str = "localhost", - port: str | int = 6379, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[int, int | bytes] | None = None, - socket_type: int = 0, - db: str | int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | _Sentinel = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: ConnectCallbackT | None = None, - encoder_class: type[Encoder] = ..., - credential_provider: CredentialProvider | None = None, - ) -> None: ... - async def get_master_address(self) -> tuple[str, int]: ... - async def rotate_slaves(self) -> AsyncIterator[tuple[str, int]]: ... - -_State = TypedDict( - "_State", {"ip": str, "port": int, "is_master": bool, "is_sdown": bool, "is_odown": bool, "num-other-sentinels": int} -) - -class Sentinel(AsyncSentinelCommands): - sentinel_kwargs: Mapping[str, Any] - sentinels: list[Redis[Any]] - min_other_sentinels: int - connection_kwargs: Mapping[str, Any] - def __init__( - self, - sentinels: Iterable[tuple[str, int]], - min_other_sentinels: int = 0, - sentinel_kwargs: Mapping[str, Any] | None = None, - **connection_kwargs: Any, - ) -> None: ... - async def execute_command(self, *args: Any, once: bool = False, **kwargs: Any) -> Literal[True]: ... - def check_master_state(self, state: _State, service_name: str) -> bool: ... - async def discover_master(self, service_name: str) -> tuple[str, int]: ... - def filter_slaves(self, slaves: Iterable[_State]) -> list[tuple[str, int]]: ... - async def discover_slaves(self, service_name: str) -> list[tuple[str, int]]: ... - @overload - def master_for( - self, - service_name: str, - redis_class: type[_RedisT], - connection_pool_class: type[SentinelConnectionPool[Any]] = ..., - # Forwarded to the connection pool constructor. - **kwargs: Any, - ) -> _RedisT: ... - @overload - def master_for( - self, - service_name: str, - *, - connection_pool_class: type[SentinelConnectionPool[Any]] = ..., - # Forwarded to the connection pool constructor. - **kwargs: Any, - ) -> Redis[Any]: ... - @overload - def slave_for( - self, - service_name: str, - redis_class: type[_RedisT], - connection_pool_class: type[SentinelConnectionPool[Any]] = ..., - # Forwarded to the connection pool constructor. - **kwargs: Any, - ) -> _RedisT: ... - @overload - def slave_for( - self, - service_name: str, - *, - connection_pool_class: type[SentinelConnectionPool[Any]] = ..., - # Forwarded to the connection pool constructor. - **kwargs: Any, - ) -> Redis[Any]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/utils.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/utils.pyi deleted file mode 100644 index 37f7fa8bfb05..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/asyncio/utils.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from types import TracebackType -from typing import Any, Generic - -from redis.asyncio.client import Pipeline, Redis -from redis.client import _StrType - -def from_url(url: str, **kwargs) -> Redis[Any]: ... - -class pipeline(Generic[_StrType]): - p: Pipeline[_StrType] - def __init__(self, redis_obj: Redis[_StrType]) -> None: ... - async def __aenter__(self) -> Pipeline[_StrType]: ... - async def __aexit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/backoff.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/backoff.pyi deleted file mode 100644 index 40230a134526..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/backoff.pyi +++ /dev/null @@ -1,31 +0,0 @@ -from abc import ABC, abstractmethod - -class AbstractBackoff(ABC): - def reset(self) -> None: ... - @abstractmethod - def compute(self, failures: int) -> float: ... - -class ConstantBackoff(AbstractBackoff): - def __init__(self, backoff: int) -> None: ... - def compute(self, failures: int) -> float: ... - -class NoBackoff(ConstantBackoff): - def __init__(self) -> None: ... - -class ExponentialBackoff(AbstractBackoff): - def __init__(self, cap: float = 0.512, base: float = 0.008) -> None: ... - def compute(self, failures: int) -> float: ... - -class FullJitterBackoff(AbstractBackoff): - def __init__(self, cap: float = 0.512, base: float = 0.008) -> None: ... - def compute(self, failures: int) -> float: ... - -class EqualJitterBackoff(AbstractBackoff): - def __init__(self, cap: float = 0.512, base: float = 0.008) -> None: ... - def compute(self, failures: int) -> float: ... - -class DecorrelatedJitterBackoff(AbstractBackoff): - def __init__(self, cap: float = 0.512, base: float = 0.008) -> None: ... - def compute(self, failures: int) -> float: ... - -def default_backoff() -> EqualJitterBackoff: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/client.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/client.pyi deleted file mode 100644 index dfdb8cc614ab..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/client.pyi +++ /dev/null @@ -1,817 +0,0 @@ -import threading -from _typeshed import Incomplete, SupportsItems, Unused -from collections.abc import Callable, Iterable, Iterator, Mapping, Sequence -from datetime import datetime, timedelta -from re import Pattern -from types import TracebackType -from typing import Any, ClassVar, Literal, TypeVar, overload -from typing_extensions import Self, TypeAlias - -from redis import RedisError - -from .commands import CoreCommands, RedisModuleCommands, SentinelCommands -from .connection import ConnectionPool, _ConnectFunc, _ConnectionPoolOptions -from .credentials import CredentialProvider -from .lock import Lock -from .retry import Retry -from .typing import ChannelT, EncodableT, KeyT, PatternT - -_Value: TypeAlias = bytes | float | int | str -_Key: TypeAlias = str | bytes - -# Lib returns str or bytes depending on value of decode_responses -_StrType = TypeVar("_StrType", bound=str | bytes) - -_VT = TypeVar("_VT") -_T = TypeVar("_T") - -# Keyword arguments that are passed to Redis.parse_response(). -_ParseResponseOptions: TypeAlias = Any -# Keyword arguments that are passed to Redis.execute_command(). -_CommandOptions: TypeAlias = _ConnectionPoolOptions | _ParseResponseOptions - -SYM_EMPTY: bytes -EMPTY_RESPONSE: str -NEVER_DECODE: str - -class CaseInsensitiveDict(dict[_StrType, _VT]): - def __init__(self, data: SupportsItems[_StrType, _VT]) -> None: ... - def update(self, data: SupportsItems[_StrType, _VT]) -> None: ... # type: ignore[override] - @overload - def get(self, k: _StrType, default: None = None) -> _VT | None: ... - @overload - def get(self, k: _StrType, default: _VT | _T) -> _VT | _T: ... - # Overrides many other methods too, but without changing signature - -def list_or_args(keys, args): ... -def timestamp_to_datetime(response): ... -def string_keys_to_dict(key_string, callback): ... -def parse_debug_object(response): ... -def parse_object(response, infotype): ... -def parse_info(response): ... - -SENTINEL_STATE_TYPES: dict[str, type[int]] - -def parse_sentinel_state(item): ... -def parse_sentinel_master(response): ... -def parse_sentinel_masters(response): ... -def parse_sentinel_slaves_and_sentinels(response): ... -def parse_sentinel_get_master(response): ... -def pairs_to_dict(response, decode_keys: bool = False, decode_string_values: bool = False): ... -def pairs_to_dict_typed(response, type_info): ... -def zset_score_pairs(response, **options): ... -def sort_return_tuples(response, **options): ... -def int_or_none(response): ... -def float_or_none(response): ... -def bool_ok(response): ... -def parse_client_list(response, **options): ... -def parse_config_get(response, **options): ... -def parse_scan(response, **options): ... -def parse_hscan(response, **options): ... -def parse_zscan(response, **options): ... -def parse_slowlog_get(response, **options): ... - -_LockType = TypeVar("_LockType") - -class AbstractRedis: - RESPONSE_CALLBACKS: dict[str, Any] - -class Redis(AbstractRedis, RedisModuleCommands, CoreCommands[_StrType], SentinelCommands): - @overload - @classmethod - def from_url( - cls, - url: str, - *, - host: str | None = ..., - port: int | None = ..., - db: int | None = ..., - password: str | None = ..., - socket_timeout: float | None = ..., - socket_connect_timeout: float | None = ..., - socket_keepalive: bool | None = ..., - socket_keepalive_options: Mapping[str, int | str] | None = ..., - connection_pool: ConnectionPool | None = ..., - unix_socket_path: str | None = ..., - encoding: str = ..., - encoding_errors: str = ..., - charset: str | None = ..., - errors: str | None = ..., - decode_responses: Literal[True], - retry_on_timeout: bool = ..., - retry_on_error: list[type[RedisError]] | None = ..., - ssl: bool = ..., - ssl_keyfile: str | None = ..., - ssl_certfile: str | None = ..., - ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: str | None = ..., - ssl_ca_path: Incomplete | None = None, - ssl_ca_data: Incomplete | None = None, - ssl_check_hostname: bool = ..., - ssl_password: Incomplete | None = None, - ssl_validate_ocsp: bool = False, - ssl_validate_ocsp_stapled: bool = False, # added in 4.1.1 - ssl_ocsp_context: Incomplete | None = None, # added in 4.1.1 - ssl_ocsp_expected_cert: Incomplete | None = None, # added in 4.1.1 - max_connections: int | None = ..., - single_connection_client: bool = ..., - health_check_interval: float = ..., - client_name: str | None = ..., - username: str | None = ..., - retry: Retry | None = ..., - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - ) -> Redis[str]: ... - @overload - @classmethod - def from_url( - cls, - url: str, - *, - host: str | None = ..., - port: int | None = ..., - db: int | None = ..., - password: str | None = ..., - socket_timeout: float | None = ..., - socket_connect_timeout: float | None = ..., - socket_keepalive: bool | None = ..., - socket_keepalive_options: Mapping[str, int | str] | None = ..., - connection_pool: ConnectionPool | None = ..., - unix_socket_path: str | None = ..., - encoding: str = ..., - encoding_errors: str = ..., - charset: str | None = ..., - errors: str | None = ..., - decode_responses: Literal[False] = False, - retry_on_timeout: bool = ..., - retry_on_error: list[type[RedisError]] | None = ..., - ssl: bool = ..., - ssl_keyfile: str | None = ..., - ssl_certfile: str | None = ..., - ssl_cert_reqs: str | int | None = ..., - ssl_ca_certs: str | None = ..., - ssl_ca_path: Incomplete | None = None, - ssl_ca_data: Incomplete | None = None, - ssl_check_hostname: bool = ..., - ssl_password: Incomplete | None = None, - ssl_validate_ocsp: bool = False, - ssl_validate_ocsp_stapled: bool = False, # added in 4.1.1 - ssl_ocsp_context: Incomplete | None = None, # added in 4.1.1 - ssl_ocsp_expected_cert: Incomplete | None = None, # added in 4.1.1 - max_connections: int | None = ..., - single_connection_client: bool = ..., - health_check_interval: float = ..., - client_name: str | None = ..., - username: str | None = ..., - retry: Retry | None = ..., - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - ) -> Redis[bytes]: ... - connection_pool: Any - response_callbacks: Any - @overload - def __init__( - self: Redis[str], - host: str, - port: int, - db: int, - password: str | None, - socket_timeout: float | None, - socket_connect_timeout: float | None, - socket_keepalive: bool | None, - socket_keepalive_options: Mapping[str, int | str] | None, - connection_pool: ConnectionPool | None, - unix_socket_path: str | None, - encoding: str, - encoding_errors: str, - charset: str | None, - errors: str | None, - decode_responses: Literal[True], - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | None = None, - ssl: bool = False, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: str | int | None = "required", - ssl_ca_certs: str | None = None, - ssl_ca_path: Incomplete | None = None, - ssl_ca_data: Incomplete | None = None, - ssl_check_hostname: bool = False, - ssl_password: Incomplete | None = None, - ssl_validate_ocsp: bool = False, - ssl_validate_ocsp_stapled: bool = False, # added in 4.1.1 - ssl_ocsp_context: Incomplete | None = None, # added in 4.1.1 - ssl_ocsp_expected_cert: Incomplete | None = None, # added in 4.1.1 - max_connections: int | None = None, - single_connection_client: bool = False, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - ) -> None: ... - @overload - def __init__( - self: Redis[str], - host: str = "localhost", - port: int = 6379, - db: int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - socket_keepalive: bool | None = None, - socket_keepalive_options: Mapping[str, int | str] | None = None, - connection_pool: ConnectionPool | None = None, - unix_socket_path: str | None = None, - encoding: str = "utf-8", - encoding_errors: str = "strict", - charset: str | None = None, - errors: str | None = None, - *, - decode_responses: Literal[True], - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | None = None, - ssl: bool = False, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: str | int | None = "required", - ssl_ca_certs: str | None = None, - ssl_ca_data: Incomplete | None = None, - ssl_check_hostname: bool = False, - ssl_password: Incomplete | None = None, - ssl_validate_ocsp: bool = False, - ssl_validate_ocsp_stapled: bool = False, # added in 4.1.1 - ssl_ocsp_context: Incomplete | None = None, # added in 4.1.1 - ssl_ocsp_expected_cert: Incomplete | None = None, # added in 4.1.1 - max_connections: int | None = None, - single_connection_client: bool = False, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - ) -> None: ... - @overload - def __init__( - self: Redis[bytes], - host: str = "localhost", - port: int = 6379, - db: int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - socket_keepalive: bool | None = None, - socket_keepalive_options: Mapping[str, int | str] | None = None, - connection_pool: ConnectionPool | None = None, - unix_socket_path: str | None = None, - encoding: str = "utf-8", - encoding_errors: str = "strict", - charset: str | None = None, - errors: str | None = None, - decode_responses: Literal[False] = False, - retry_on_timeout: bool = False, - retry_on_error: list[type[RedisError]] | None = None, - ssl: bool = False, - ssl_keyfile: str | None = None, - ssl_certfile: str | None = None, - ssl_cert_reqs: str | int | None = "required", - ssl_ca_certs: str | None = None, - ssl_ca_data: Incomplete | None = None, - ssl_check_hostname: bool = False, - ssl_password: Incomplete | None = None, - ssl_validate_ocsp: bool = False, - ssl_validate_ocsp_stapled: bool = False, # added in 4.1.1 - ssl_ocsp_context: Incomplete | None = None, # added in 4.1.1 - ssl_ocsp_expected_cert: Incomplete | None = None, # added in 4.1.1 - max_connections: int | None = None, - single_connection_client: bool = False, - health_check_interval: float = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - ) -> None: ... - def get_encoder(self): ... - def get_connection_kwargs(self): ... - def set_response_callback(self, command, callback): ... - def pipeline(self, transaction: bool = True, shard_hint: Any = None) -> Pipeline[_StrType]: ... - def transaction(self, func, *watches, **kwargs): ... - @overload - def lock( - self, - name: _Key, - timeout: float | None = None, - sleep: float = 0.1, - blocking: bool = True, - blocking_timeout: float | None = None, - lock_class: None = None, - thread_local: bool = True, - ) -> Lock: ... - @overload - def lock( - self, - name: _Key, - timeout: float | None, - sleep: float, - blocking: bool, - blocking_timeout: float | None, - lock_class: type[_LockType], - thread_local: bool = True, - ) -> _LockType: ... - @overload - def lock( - self, - name: _Key, - timeout: float | None = None, - sleep: float = 0.1, - blocking: bool = True, - blocking_timeout: float | None = None, - *, - lock_class: type[_LockType], - thread_local: bool = True, - ) -> _LockType: ... - def pubsub(self, *, shard_hint: Any = ..., ignore_subscribe_messages: bool = ...) -> PubSub: ... - def execute_command(self, *args, **options: _CommandOptions): ... - def parse_response(self, connection, command_name, **options: _ParseResponseOptions): ... - def monitor(self) -> Monitor: ... - def __enter__(self) -> Redis[_StrType]: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self) -> None: ... - def close(self) -> None: ... - def client(self) -> Redis[_StrType]: ... - -StrictRedis = Redis - -class PubSub: - PUBLISH_MESSAGE_TYPES: ClassVar[tuple[str, str]] - UNSUBSCRIBE_MESSAGE_TYPES: ClassVar[tuple[str, str]] - HEALTH_CHECK_MESSAGE: ClassVar[str] - connection_pool: Any - shard_hint: Any - ignore_subscribe_messages: Any - connection: Any - subscribed_event: threading.Event - encoder: Any - health_check_response_b: bytes - health_check_response: list[str] | list[bytes] - def __init__( - self, - connection_pool, - shard_hint: Incomplete | None = None, - ignore_subscribe_messages: bool = False, - encoder: Incomplete | None = None, - ) -> None: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self): ... - channels: Any - patterns: Any - def reset(self): ... - def close(self) -> None: ... - def on_connect(self, connection): ... - @property - def subscribed(self): ... - def execute_command(self, *args): ... - def clean_health_check_responses(self) -> None: ... - def parse_response(self, block: bool = True, timeout: float = 0): ... - def is_health_check_response(self, response) -> bool: ... - def check_health(self) -> None: ... - def psubscribe(self, *args: _Key, **kwargs: Callable[[Any], None]): ... - def punsubscribe(self, *args: _Key) -> None: ... - def subscribe(self, *args: _Key, **kwargs: Callable[[Any], None]) -> None: ... - def unsubscribe(self, *args: _Key) -> None: ... - def listen(self): ... - def get_message(self, ignore_subscribe_messages: bool = False, timeout: float = 0.0) -> dict[str, Any] | None: ... - def handle_message(self, response, ignore_subscribe_messages: bool = False) -> dict[str, Any] | None: ... - def run_in_thread(self, sleep_time: float = 0, daemon: bool = False, exception_handler: Incomplete | None = None): ... - def ping(self, message: _Value | None = None) -> None: ... - -class PubSubWorkerThread(threading.Thread): - daemon: Any - pubsub: Any - sleep_time: Any - exception_handler: Any - def __init__(self, pubsub, sleep_time, daemon: bool = False, exception_handler: Incomplete | None = None) -> None: ... - def run(self) -> None: ... - def stop(self) -> None: ... - -class Pipeline(Redis[_StrType]): - UNWATCH_COMMANDS: Any - connection_pool: Any - connection: Any - response_callbacks: Any - transaction: bool - shard_hint: Any - watching: bool - - command_stack: Any - scripts: Any - explicit_transaction: Any - def __init__(self, connection_pool, response_callbacks, transaction, shard_hint) -> None: ... - def __enter__(self) -> Pipeline[_StrType]: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self) -> None: ... - def __len__(self) -> int: ... - def __bool__(self) -> bool: ... - def discard(self) -> None: ... - def reset(self) -> None: ... - def multi(self) -> None: ... - def execute_command(self, *args, **options): ... - def immediate_execute_command(self, *args, **options): ... - def pipeline_execute_command(self, *args, **options): ... - def raise_first_error(self, commands, response): ... - def annotate_exception(self, exception, number, command): ... - def parse_response(self, connection, command_name, **options): ... - def load_scripts(self): ... - def execute(self, raise_on_error: bool = True) -> list[Any]: ... - def watch(self, *names: _Key) -> bool: ... - def unwatch(self) -> bool: ... - # in the Redis implementation, the following methods are inherited from client. - def set_response_callback(self, command, callback): ... - def pipeline(self, transaction: bool = True, shard_hint: Any = None) -> Pipeline[_StrType]: ... - def acl_cat(self, category: str | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def acl_deluser(self, username: str) -> Pipeline[_StrType]: ... # type: ignore[override] - def acl_genpass(self, bits: int | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def acl_getuser(self, username: str) -> Pipeline[_StrType]: ... # type: ignore[override] - def acl_list(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def acl_load(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def acl_setuser( # type: ignore[override] - self, - username: str, - enabled: bool = False, - nopass: bool = False, - passwords: Sequence[str] | None = None, - hashed_passwords: Sequence[str] | None = None, - categories: Sequence[str] | None = None, - commands: Sequence[str] | None = None, - keys: Sequence[str] | None = None, - channels: Iterable[ChannelT] | None = None, - selectors: Iterable[tuple[str, KeyT]] | None = None, - reset: bool = False, - reset_keys: bool = False, - reset_channels: bool = False, - reset_passwords: bool = False, - **kwargs: _CommandOptions, - ) -> Pipeline[_StrType]: ... - def acl_users(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def acl_whoami(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def bgrewriteaof(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def bgsave(self, schedule: bool = True) -> Pipeline[_StrType]: ... # type: ignore[override] - def client_id(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def client_kill(self, address: str) -> Pipeline[_StrType]: ... # type: ignore[override] - def client_list(self, _type: str | None = None, client_id: list[str] = []) -> Pipeline[_StrType]: ... # type: ignore[override] - def client_getname(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def client_setname(self, name: str) -> Pipeline[_StrType]: ... # type: ignore[override] - def readwrite(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def readonly(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def config_get(self, pattern: PatternT = "*", *args: PatternT, **kwargs: _CommandOptions) -> Pipeline[_StrType]: ... - def config_set( - self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions - ) -> Pipeline[_StrType]: ... - def config_resetstat(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def config_rewrite(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def dbsize(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def debug_object(self, key) -> Pipeline[_StrType]: ... # type: ignore[override] - def echo(self, value) -> Pipeline[_StrType]: ... # type: ignore[override] - def flushall(self, asynchronous: bool = False) -> Pipeline[_StrType]: ... # type: ignore[override] - def flushdb(self, asynchronous: bool = False) -> Pipeline[_StrType]: ... # type: ignore[override] - def info(self, section: _Key | None = None, *args: _Key, **kwargs: _CommandOptions) -> Pipeline[_StrType]: ... # type: ignore[override] - def lastsave(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def object(self, infotype, key) -> Pipeline[_StrType]: ... # type: ignore[override] - def ping(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def save(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def sentinel_get_master_addr_by_name(self, service_name) -> Pipeline[_StrType]: ... - def sentinel_master(self, service_name) -> Pipeline[_StrType]: ... - def sentinel_masters(self) -> Pipeline[_StrType]: ... - def sentinel_monitor(self, name, ip, port, quorum) -> Pipeline[_StrType]: ... - def sentinel_remove(self, name) -> Pipeline[_StrType]: ... - def sentinel_sentinels(self, service_name) -> Pipeline[_StrType]: ... - def sentinel_set(self, name, option, value) -> Pipeline[_StrType]: ... - def sentinel_slaves(self, service_name) -> Pipeline[_StrType]: ... - def slaveof(self, host=None, port=None) -> Pipeline[_StrType]: ... # type: ignore[override] - def slowlog_get(self, num=None) -> Pipeline[_StrType]: ... # type: ignore[override] - def slowlog_len(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def slowlog_reset(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def time(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def append(self, key, value) -> Pipeline[_StrType]: ... - def bitcount( # type: ignore[override] - self, key: _Key, start: int | None = None, end: int | None = None, mode: str | None = None - ) -> Pipeline[_StrType]: ... - def bitop(self, operation, dest, *keys) -> Pipeline[_StrType]: ... - def bitpos(self, key, bit, start=None, end=None, mode: str | None = None) -> Pipeline[_StrType]: ... - def decr(self, name, amount=1) -> Pipeline[_StrType]: ... # type: ignore[override] - def delete(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def __delitem__(self, _Key) -> None: ... - def dump(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] - def exists(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def __contains__(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def expire( # type: ignore[override] - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Pipeline[_StrType]: ... - def expireat( - self, name, when, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Pipeline[_StrType]: ... - def get(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def __getitem__(self, name) -> Pipeline[_StrType]: ... - def getbit(self, name: _Key, offset: int) -> Pipeline[_StrType]: ... # type: ignore[override] - def getrange(self, key, start, end) -> Pipeline[_StrType]: ... - def getset(self, name, value) -> Pipeline[_StrType]: ... # type: ignore[override] - def incr(self, name, amount=1) -> Pipeline[_StrType]: ... # type: ignore[override] - def incrby(self, name, amount=1) -> Pipeline[_StrType]: ... # type: ignore[override] - def incrbyfloat(self, name, amount=1.0) -> Pipeline[_StrType]: ... # type: ignore[override] - def keys(self, pattern: _Key = "*") -> Pipeline[_StrType]: ... # type: ignore[override] - def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def mset(self, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] - def msetnx(self, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] - def move(self, name: _Key, db: int) -> Pipeline[_StrType]: ... # type: ignore[override] - def persist(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def pexpire( # type: ignore[override] - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Pipeline[_StrType]: ... - def pexpireat( # type: ignore[override] - self, name: _Key, when: int | datetime, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Pipeline[_StrType]: ... - def psetex(self, name, time_ms, value) -> Pipeline[_StrType]: ... - def pttl(self, name) -> Pipeline[_StrType]: ... # type: ignore[override] - def randomkey(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def rename(self, src, dst) -> Pipeline[_StrType]: ... - def renamenx(self, src, dst) -> Pipeline[_StrType]: ... - def restore( - self, - name, - ttl, - value, - replace: bool = False, - absttl: bool = False, - idletime: Incomplete | None = None, - frequency: Incomplete | None = None, - ) -> Pipeline[_StrType]: ... - def set( # type: ignore[override] - self, - name: _Key, - value: _Value, - ex: None | int | timedelta = None, - px: None | int | timedelta = None, - nx: bool = False, - xx: bool = False, - keepttl: bool = False, - get: bool = False, - exat: Incomplete | None = None, - pxat: Incomplete | None = None, - ) -> Pipeline[_StrType]: ... - def __setitem__(self, name, value) -> None: ... - def setbit(self, name: _Key, offset: int, value: int) -> Pipeline[_StrType]: ... # type: ignore[override] - def setex(self, name: _Key, time: int | timedelta, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def setnx(self, name, value) -> Pipeline[_StrType]: ... # type: ignore[override] - def setrange(self, name, offset, value) -> Pipeline[_StrType]: ... - def strlen(self, name) -> Pipeline[_StrType]: ... - def substr(self, name, start, end=-1) -> Pipeline[_StrType]: ... - def ttl(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def type(self, name) -> Pipeline[_StrType]: ... - def unlink(self, *names: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def blmove( # type: ignore[override] - self, - first_list: _Key, - second_list: _Key, - timeout: float, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> Pipeline[_StrType]: ... - def blpop(self, keys: _Value | Iterable[_Value], timeout: float = 0) -> Pipeline[_StrType]: ... # type: ignore[override] - def brpop(self, keys: _Value | Iterable[_Value], timeout: float = 0) -> Pipeline[_StrType]: ... # type: ignore[override] - def brpoplpush(self, src, dst, timeout=0) -> Pipeline[_StrType]: ... - def lindex(self, name: _Key, index: int) -> Pipeline[_StrType]: ... # type: ignore[override] - def linsert( # type: ignore[override] - self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value - ) -> Pipeline[_StrType]: ... - def llen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def lmove( # type: ignore[override] - self, - first_list: _Key, - second_list: _Key, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> Pipeline[_StrType]: ... - def lpop(self, name, count: int | None = None) -> Pipeline[_StrType]: ... - def lpush(self, name: _Value, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def lpushx(self, name, value) -> Pipeline[_StrType]: ... - def lrange(self, name: _Key, start: int, end: int) -> Pipeline[_StrType]: ... # type: ignore[override] - def lrem(self, name: _Key, count: int, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def lset(self, name: _Key, index: int, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def ltrim(self, name: _Key, start: int, end: int) -> Pipeline[_StrType]: ... # type: ignore[override] - def rpop(self, name, count: int | None = None) -> Pipeline[_StrType]: ... - def rpoplpush(self, src, dst) -> Pipeline[_StrType]: ... - def rpush(self, name: _Value, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def rpushx(self, name, value) -> Pipeline[_StrType]: ... - def sort( # type: ignore[override] - self, - name: _Key, - start: int | None = None, - num: int | None = None, - by: _Key | None = None, - get: _Key | Sequence[_Key] | None = None, - desc: bool = False, - alpha: bool = False, - store: _Key | None = None, - groups: bool = False, - ) -> Pipeline[_StrType]: ... - def scan( # type: ignore[override] - self, cursor: int = 0, match: _Key | None = None, count: int | None = None, _type: str | None = None - ) -> Pipeline[_StrType]: ... - def scan_iter(self, match: _Key | None = None, count: int | None = None, _type: str | None = None) -> Iterator[Any]: ... # type: ignore[override] - def sscan(self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def sscan_iter(self, name: _Key, match: _Key | None = None, count: int | None = None) -> Iterator[Any]: ... - def hscan(self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def hscan_iter(self, name, match: _Key | None = None, count: int | None = None) -> Iterator[Any]: ... - def zscan_iter( - self, name: _Key, match: _Key | None = None, count: int | None = None, score_cast_func: Callable[[_StrType], Any] = ... - ) -> Iterator[Any]: ... - def sadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def scard(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def sismember(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def smembers(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def smove(self, src: _Key, dst: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def spop(self, name: _Key, count: int | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def srandmember(self, name: _Key, number: int | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def srem(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def xack(self, name, groupname, *ids) -> Pipeline[_StrType]: ... - def xadd( - self, - name, - fields, - id="*", - maxlen=None, - approximate: bool = True, - nomkstream: bool = False, - minid: Incomplete | None = None, - limit: int | None = None, - ) -> Pipeline[_StrType]: ... - def xclaim( - self, - name, - groupname, - consumername, - min_idle_time, - message_ids, - idle=None, - time=None, - retrycount=None, - force=False, - justid=False, - ) -> Pipeline[_StrType]: ... - def xdel(self, name, *ids) -> Pipeline[_StrType]: ... - def xgroup_create(self, name, groupname, id="$", mkstream=False, entries_read: int | None = None) -> Pipeline[_StrType]: ... - def xgroup_delconsumer(self, name, groupname, consumername) -> Pipeline[_StrType]: ... - def xgroup_destroy(self, name, groupname) -> Pipeline[_StrType]: ... - def xgroup_setid(self, name, groupname, id, entries_read: int | None = None) -> Pipeline[_StrType]: ... - def xinfo_consumers(self, name, groupname) -> Pipeline[_StrType]: ... - def xinfo_groups(self, name) -> Pipeline[_StrType]: ... - def xinfo_stream(self, name, full: bool = False) -> Pipeline[_StrType]: ... - def xlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def xpending(self, name, groupname) -> Pipeline[_StrType]: ... - def xpending_range( - self, name: _Key, groupname, min, max, count: int, consumername: Incomplete | None = None, idle: int | None = None - ) -> Pipeline[_StrType]: ... - def xrange(self, name, min="-", max="+", count=None) -> Pipeline[_StrType]: ... - def xread(self, streams, count=None, block=None) -> Pipeline[_StrType]: ... - def xreadgroup(self, groupname, consumername, streams, count=None, block=None, noack=False) -> Pipeline[_StrType]: ... - def xrevrange(self, name, max="+", min="-", count=None) -> Pipeline[_StrType]: ... - def xtrim( - self, name, maxlen: int | None = None, approximate: bool = True, minid: Incomplete | None = None, limit: int | None = None - ) -> Pipeline[_StrType]: ... - def zadd( # type: ignore[override] - self, - name: _Key, - mapping: Mapping[_Key, _Value], - nx: bool = False, - xx: bool = False, - ch: bool = False, - incr: bool = False, - gt: Incomplete | None = False, - lt: Incomplete | None = False, - ) -> Pipeline[_StrType]: ... - def zcard(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def zcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zincrby(self, name: _Key, amount: float, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zinterstore( # type: ignore[override] - self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None - ) -> Pipeline[_StrType]: ... - def zlexcount(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zpopmax(self, name: _Key, count: int | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def zpopmin(self, name: _Key, count: int | None = None) -> Pipeline[_StrType]: ... # type: ignore[override] - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float = 0) -> Pipeline[_StrType]: ... # type: ignore[override] - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float = 0) -> Pipeline[_StrType]: ... # type: ignore[override] - def zrange( # type: ignore[override] - self, - name: _Key, - start: int, - end: int, - desc: bool = False, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> Pipeline[_StrType]: ... - def zrangebylex( # type: ignore[override] - self, name: _Key, min: _Value, max: _Value, start: int | None = None, num: int | None = None - ) -> Pipeline[_StrType]: ... - def zrangebyscore( # type: ignore[override] - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> Pipeline[_StrType]: ... - def zrank(self, name: _Key, value: _Value, withscore: bool = False) -> Pipeline[_StrType]: ... # type: ignore[override] - def zrem(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zremrangebyrank(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zrevrange( # type: ignore[override] - self, name: _Key, start: int, end: int, withscores: bool = False, score_cast_func: Callable[[_StrType], Any] = ... - ) -> Pipeline[_StrType]: ... - def zrevrangebyscore( # type: ignore[override] - self, - name: _Key, - max: _Value, - min: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> Pipeline[_StrType]: ... - def zrevrangebylex( # type: ignore[override] - self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None - ) -> Pipeline[_StrType]: ... - def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> Pipeline[_StrType]: ... # type: ignore[override] - def zscore(self, name: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def zunionstore( # type: ignore[override] - self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None - ) -> Pipeline[_StrType]: ... - def pfadd(self, name: _Key, *values: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def pfcount(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def pfmerge(self, dest: _Key, *sources: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def hdel(self, name: _Key, *keys: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def hexists(self, name: _Key, key: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def hget(self, name: _Key, key: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def hgetall(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def hincrby(self, name: _Key, key: _Key, amount: int = 1) -> Pipeline[_StrType]: ... # type: ignore[override] - def hincrbyfloat(self, name: _Key, key: _Key, amount: float = 1.0) -> Pipeline[_StrType]: ... # type: ignore[override] - def hkeys(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def hlen(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - @overload # type: ignore[override] - def hset( - self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = None, items: Incomplete | None = None - ) -> Pipeline[_StrType]: ... - @overload - def hset( - self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Incomplete | None = None - ) -> Pipeline[_StrType]: ... - @overload - def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Incomplete | None = None) -> Pipeline[_StrType]: ... - def hsetnx(self, name: _Key, key: _Key, value: _Value) -> Pipeline[_StrType]: ... # type: ignore[override] - def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> Pipeline[_StrType]: ... # type: ignore[override] - def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def hvals(self, name: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def publish(self, channel: _Key, message: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def eval(self, script, numkeys, *keys_and_args) -> Pipeline[_StrType]: ... - def evalsha(self, sha, numkeys, *keys_and_args) -> Pipeline[_StrType]: ... - def script_exists(self, *args) -> Pipeline[_StrType]: ... - def script_flush(self, sync_type: Incomplete | None = None) -> Pipeline[_StrType]: ... - def script_kill(self) -> Pipeline[_StrType]: ... - def script_load(self, script) -> Pipeline[_StrType]: ... - def pubsub_channels(self, pattern: _Key = "*") -> Pipeline[_StrType]: ... # type: ignore[override] - def pubsub_numsub(self, *args: _Key) -> Pipeline[_StrType]: ... # type: ignore[override] - def pubsub_numpat(self) -> Pipeline[_StrType]: ... # type: ignore[override] - def monitor(self) -> Monitor: ... - def cluster(self, cluster_arg: str, *args: Any) -> Pipeline[_StrType]: ... # type: ignore[override] - def client(self) -> Any: ... - -class Monitor: - command_re: Pattern[str] - monitor_re: Pattern[str] - def __init__(self, connection_pool) -> None: ... - def __enter__(self) -> Self: ... - def __exit__(self, *args: Unused) -> None: ... - def next_command(self) -> dict[str, Any]: ... - def listen(self) -> Iterable[dict[str, Any]]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/cluster.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/cluster.pyi deleted file mode 100644 index 1c82f57ba3d7..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/cluster.pyi +++ /dev/null @@ -1,265 +0,0 @@ -from _typeshed import Incomplete, Unused -from collections.abc import Callable, Iterable, Sequence -from threading import Lock -from types import TracebackType -from typing import Any, ClassVar, Literal, NoReturn, Protocol -from typing_extensions import Self - -from redis.client import CaseInsensitiveDict, PubSub, Redis, _ParseResponseOptions -from redis.commands import CommandsParser, RedisClusterCommands -from redis.commands.core import _StrType -from redis.connection import BaseParser, Connection, ConnectionPool, Encoder, _ConnectionPoolOptions, _Encodable -from redis.exceptions import MovedError, RedisError -from redis.retry import Retry -from redis.typing import EncodableT - -def get_node_name(host: str, port: str | int) -> str: ... -def get_connection(redis_node: Redis[Any], *args, **options: _ConnectionPoolOptions) -> Connection: ... -def parse_scan_result(command: Unused, res, **options): ... -def parse_pubsub_numsub(command: Unused, res, **options: Unused): ... -def parse_cluster_slots(resp, **options) -> dict[tuple[int, int], dict[str, Any]]: ... -def parse_cluster_myshardid(resp: bytes, **options: Unused) -> str: ... - -PRIMARY: str -REPLICA: str -SLOT_ID: str -REDIS_ALLOWED_KEYS: tuple[str, ...] -KWARGS_DISABLED_KEYS: tuple[str, ...] -PIPELINE_BLOCKED_COMMANDS: tuple[str, ...] - -def cleanup_kwargs(**kwargs: Any) -> dict[str, Any]: ... - -# It uses `DefaultParser` in real life, but it is a dynamic base class. -class ClusterParser(BaseParser): ... - -class AbstractRedisCluster: - RedisClusterRequestTTL: ClassVar[int] - PRIMARIES: ClassVar[str] - REPLICAS: ClassVar[str] - ALL_NODES: ClassVar[str] - RANDOM: ClassVar[str] - DEFAULT_NODE: ClassVar[str] - NODE_FLAGS: ClassVar[set[str]] - COMMAND_FLAGS: ClassVar[dict[str, str]] - CLUSTER_COMMANDS_RESPONSE_CALLBACKS: ClassVar[dict[str, Any]] - RESULT_CALLBACKS: ClassVar[dict[str, Callable[[Incomplete, Incomplete], Incomplete]]] - ERRORS_ALLOW_RETRY: ClassVar[tuple[type[RedisError], ...]] - -class RedisCluster(AbstractRedisCluster, RedisClusterCommands[_StrType]): - user_on_connect_func: Callable[[Connection], object] | None - encoder: Encoder - cluster_error_retry_attempts: int - command_flags: dict[str, str] - node_flags: set[str] - read_from_replicas: bool - reinitialize_counter: int - reinitialize_steps: int - nodes_manager: NodesManager - cluster_response_callbacks: CaseInsensitiveDict[str, Callable[..., Incomplete]] - result_callbacks: CaseInsensitiveDict[str, Callable[[Incomplete, Incomplete], Incomplete]] - commands_parser: CommandsParser - def __init__( # TODO: make @overloads, either `url` or `host:port` can be passed - self, - host: str | None = None, - port: int | None = 6379, - startup_nodes: list[ClusterNode] | None = None, - cluster_error_retry_attempts: int = 3, - retry: Retry | None = None, - require_full_coverage: bool = False, - reinitialize_steps: int = 5, - read_from_replicas: bool = False, - dynamic_startup_nodes: bool = True, - url: str | None = None, - address_remap: Callable[[str, int], tuple[str, int]] | None = None, - **kwargs, - ) -> None: ... - def __enter__(self) -> Self: ... - def __exit__( - self, type: type[BaseException] | None, value: BaseException | None, traceback: TracebackType | None - ) -> None: ... - def __del__(self) -> None: ... - def disconnect_connection_pools(self) -> None: ... - @classmethod - def from_url(cls, url: str, **kwargs) -> Self: ... - def on_connect(self, connection: Connection) -> None: ... - def get_redis_connection(self, node: ClusterNode) -> Redis[Any]: ... - def get_node( - self, host: str | None = None, port: str | int | None = None, node_name: str | None = None - ) -> ClusterNode | None: ... - def get_primaries(self) -> list[ClusterNode]: ... - def get_replicas(self) -> list[ClusterNode]: ... - def get_random_node(self) -> ClusterNode: ... - def get_nodes(self) -> list[ClusterNode]: ... - def get_node_from_key(self, key: _Encodable, replica: bool = False) -> ClusterNode | None: ... - def get_default_node(self) -> ClusterNode | None: ... - def set_default_node(self, node: ClusterNode | None) -> bool: ... - def monitor(self, target_node: Incomplete | None = None): ... - def pubsub( - self, node: Incomplete | None = None, host: Incomplete | None = None, port: Incomplete | None = None, **kwargs - ): ... - def pipeline(self, transaction: Incomplete | None = None, shard_hint: Incomplete | None = None): ... - def lock( - self, - name: str, - timeout: float | None = None, - sleep: float = 0.1, - blocking: bool = True, - blocking_timeout: float | None = None, - lock_class: type[Incomplete] | None = None, - thread_local: bool = True, - ): ... - def keyslot(self, key: _Encodable) -> int: ... - def determine_slot(self, *args): ... - def get_encoder(self) -> Encoder: ... - def get_connection_kwargs(self) -> dict[str, Any]: ... - def execute_command(self, *args, **kwargs): ... - def close(self) -> None: ... - -class ClusterNode: - host: str - port: int - name: str - server_type: str | None - redis_connection: Redis[Incomplete] | None - def __init__( - self, host: str, port: int, server_type: str | None = None, redis_connection: Redis[Incomplete] | None = None - ) -> None: ... - def __eq__(self, obj: object) -> bool: ... - def __del__(self) -> None: ... - -class LoadBalancer: - primary_to_idx: dict[str, int] - start_index: int - def __init__(self, start_index: int = 0) -> None: ... - def get_server_index(self, primary: str, list_size: int) -> int: ... - def reset(self) -> None: ... - -class NodesManager: - nodes_cache: dict[str, ClusterNode] - slots_cache: dict[str, list[ClusterNode]] - startup_nodes: dict[str, ClusterNode] - default_node: ClusterNode | None - from_url: bool - connection_pool_class: type[ConnectionPool] - connection_kwargs: dict[str, Incomplete] # TODO: could be a TypedDict - read_load_balancer: LoadBalancer - address_remap: Callable[[str, int], tuple[str, int]] | None - def __init__( - self, - startup_nodes: Iterable[ClusterNode], - from_url: bool = False, - require_full_coverage: bool = False, - lock: Lock | None = None, - dynamic_startup_nodes: bool = True, - connection_pool_class: type[ConnectionPool] = ..., - address_remap: Callable[[str, int], tuple[str, int]] | None = None, - **kwargs, # TODO: same type as connection_kwargs - ) -> None: ... - def get_node( - self, host: str | None = None, port: int | str | None = None, node_name: str | None = None - ) -> ClusterNode | None: ... - def update_moved_exception(self, exception: MovedError) -> None: ... - def get_node_from_slot(self, slot: str, read_from_replicas: bool = False, server_type: str | None = None) -> ClusterNode: ... - def get_nodes_by_server_type(self, server_type: str) -> list[ClusterNode]: ... - def populate_startup_nodes(self, nodes: Iterable[ClusterNode]) -> None: ... - def check_slots_coverage(self, slots_cache: dict[str, list[ClusterNode]]) -> bool: ... - def create_redis_connections(self, nodes: Iterable[ClusterNode]) -> None: ... - def create_redis_node(self, host: str, port: int | str, **kwargs: Any) -> Redis[Incomplete]: ... - def initialize(self) -> None: ... - def close(self) -> None: ... - def reset(self) -> None: ... - def remap_host_port(self, host: str, port: int) -> tuple[str, int]: ... - -class ClusterPubSub(PubSub): - node: ClusterNode | None - cluster: RedisCluster[Any] - def __init__( - self, - redis_cluster: RedisCluster[Any], - node: ClusterNode | None = None, - host: str | None = None, - port: int | None = None, - **kwargs, - ) -> None: ... - def set_pubsub_node( - self, cluster: RedisCluster[Any], node: ClusterNode | None = None, host: str | None = None, port: int | None = None - ) -> None: ... - def get_pubsub_node(self) -> ClusterNode | None: ... - def execute_command(self, *args, **kwargs) -> None: ... - def get_redis_connection(self) -> Redis[Any] | None: ... - -class ClusterPipeline(RedisCluster[_StrType]): - command_stack: list[Incomplete] - nodes_manager: Incomplete - refresh_table_asap: bool - result_callbacks: Incomplete - startup_nodes: Incomplete - read_from_replicas: bool - command_flags: Incomplete - cluster_response_callbacks: Incomplete - cluster_error_retry_attempts: int - reinitialize_counter: int - reinitialize_steps: int - encoder: Encoder - commands_parser: Incomplete - def __init__( - self, - nodes_manager, - commands_parser, - result_callbacks: Incomplete | None = None, - cluster_response_callbacks: Incomplete | None = None, - startup_nodes: Incomplete | None = None, - read_from_replicas: bool = False, - cluster_error_retry_attempts: int = 3, - reinitialize_steps: int = 5, - lock: Lock | None = None, - **kwargs, - ) -> None: ... - def __len__(self) -> int: ... - def __bool__(self) -> Literal[True]: ... - def execute_command(self, *args, **kwargs): ... - def pipeline_execute_command(self, *args, **options): ... - def raise_first_error(self, stack) -> None: ... - def annotate_exception(self, exception, number, command) -> None: ... - def execute(self, raise_on_error: bool = True): ... - scripts: set[Any] # is only set in `reset()` - watching: bool # is only set in `reset()` - explicit_transaction: bool # is only set in `reset()` - def reset(self) -> None: ... - def send_cluster_commands(self, stack, raise_on_error: bool = True, allow_redirections: bool = True): ... - def eval(self) -> None: ... - def multi(self) -> None: ... - def immediate_execute_command(self, *args, **options) -> None: ... - def load_scripts(self) -> None: ... - def watch(self, *names) -> None: ... - def unwatch(self) -> None: ... - def script_load_for_pipeline(self, *args, **kwargs) -> None: ... - def delete(self, *names): ... - -def block_pipeline_command(name: str) -> Callable[..., NoReturn]: ... - -class PipelineCommand: - args: Sequence[EncodableT] - options: _ParseResponseOptions - position: int | None - result: Any | Exception | None - node: Incomplete | None - asking: bool - def __init__( - self, args: Sequence[EncodableT], options: _ParseResponseOptions | None = None, position: int | None = None - ) -> None: ... - -class _ParseResponseCallback(Protocol): - def __call__(self, connection: Connection, command: EncodableT, /, **kwargs) -> Any: ... - -class NodeCommands: - parse_response: _ParseResponseCallback - connection_pool: ConnectionPool - connection: Connection - commands: list[PipelineCommand] - def __init__( - self, parse_response: _ParseResponseCallback, connection_pool: ConnectionPool, connection: Connection - ) -> None: ... - def append(self, c: PipelineCommand) -> None: ... - def write(self) -> None: ... - def read(self) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/__init__.pyi deleted file mode 100644 index 4959ea0fdf15..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/__init__.pyi +++ /dev/null @@ -1,17 +0,0 @@ -from .cluster import RedisClusterCommands as RedisClusterCommands -from .core import AsyncCoreCommands as AsyncCoreCommands, CoreCommands as CoreCommands -from .helpers import list_or_args as list_or_args -from .parser import CommandsParser as CommandsParser -from .redismodules import RedisModuleCommands as RedisModuleCommands -from .sentinel import AsyncSentinelCommands as AsyncSentinelCommands, SentinelCommands as SentinelCommands - -__all__ = [ - "RedisClusterCommands", - "CommandsParser", - "AsyncCoreCommands", - "CoreCommands", - "list_or_args", - "RedisModuleCommands", - "AsyncSentinelCommands", - "SentinelCommands", -] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/__init__.pyi deleted file mode 100644 index d5ef70ee3202..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/__init__.pyi +++ /dev/null @@ -1,58 +0,0 @@ -from typing import Any - -from .commands import * -from .info import BFInfo as BFInfo, CFInfo as CFInfo, CMSInfo as CMSInfo, TDigestInfo as TDigestInfo, TopKInfo as TopKInfo - -class AbstractBloom: - @staticmethod - def append_items(params, items) -> None: ... - @staticmethod - def append_error(params, error) -> None: ... - @staticmethod - def append_capacity(params, capacity) -> None: ... - @staticmethod - def append_expansion(params, expansion) -> None: ... - @staticmethod - def append_no_scale(params, noScale) -> None: ... - @staticmethod - def append_weights(params, weights) -> None: ... - @staticmethod - def append_no_create(params, noCreate) -> None: ... - @staticmethod - def append_items_and_increments(params, items, increments) -> None: ... - @staticmethod - def append_values_and_weights(params, items, weights) -> None: ... - @staticmethod - def append_max_iterations(params, max_iterations) -> None: ... - @staticmethod - def append_bucket_size(params, bucket_size) -> None: ... - -class CMSBloom(CMSCommands, AbstractBloom): - client: Any - commandmixin: Any - execute_command: Any - def __init__(self, client, **kwargs) -> None: ... - -class TOPKBloom(TOPKCommands, AbstractBloom): - client: Any - commandmixin: Any - execute_command: Any - def __init__(self, client, **kwargs) -> None: ... - -class CFBloom(CFCommands, AbstractBloom): - client: Any - commandmixin: Any - execute_command: Any - def __init__(self, client, **kwargs) -> None: ... - -class TDigestBloom(TDigestCommands, AbstractBloom): - client: Any - commandmixin: Any - execute_command: Any - def __init__(self, client, **kwargs) -> None: ... - -class BFBloom(BFCommands, AbstractBloom): - client: Any - commandmixin: Any - execute_command: Any - def __init__(self, client, **kwargs) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/commands.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/commands.pyi deleted file mode 100644 index 99a296fdc1dd..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/commands.pyi +++ /dev/null @@ -1,112 +0,0 @@ -from _typeshed import Incomplete - -BF_RESERVE: str -BF_ADD: str -BF_MADD: str -BF_INSERT: str -BF_EXISTS: str -BF_MEXISTS: str -BF_SCANDUMP: str -BF_LOADCHUNK: str -BF_INFO: str -CF_RESERVE: str -CF_ADD: str -CF_ADDNX: str -CF_INSERT: str -CF_INSERTNX: str -CF_EXISTS: str -CF_DEL: str -CF_COUNT: str -CF_SCANDUMP: str -CF_LOADCHUNK: str -CF_INFO: str -CMS_INITBYDIM: str -CMS_INITBYPROB: str -CMS_INCRBY: str -CMS_QUERY: str -CMS_MERGE: str -CMS_INFO: str -TOPK_RESERVE: str -TOPK_ADD: str -TOPK_INCRBY: str -TOPK_QUERY: str -TOPK_COUNT: str -TOPK_LIST: str -TOPK_INFO: str -TDIGEST_CREATE: str -TDIGEST_RESET: str -TDIGEST_ADD: str -TDIGEST_MERGE: str -TDIGEST_CDF: str -TDIGEST_QUANTILE: str -TDIGEST_MIN: str -TDIGEST_MAX: str -TDIGEST_INFO: str - -class BFCommands: - def create(self, key, errorRate, capacity, expansion: Incomplete | None = None, noScale: Incomplete | None = None): ... - def add(self, key, item): ... - def madd(self, key, *items): ... - def insert( - self, - key, - items, - capacity: Incomplete | None = None, - error: Incomplete | None = None, - noCreate: Incomplete | None = None, - expansion: Incomplete | None = None, - noScale: Incomplete | None = None, - ): ... - def exists(self, key, item): ... - def mexists(self, key, *items): ... - def scandump(self, key, iter): ... - def loadchunk(self, key, iter, data): ... - def info(self, key): ... - -class CFCommands: - def create( - self, - key, - capacity, - expansion: Incomplete | None = None, - bucket_size: Incomplete | None = None, - max_iterations: Incomplete | None = None, - ): ... - def add(self, key, item): ... - def addnx(self, key, item): ... - def insert(self, key, items, capacity: Incomplete | None = None, nocreate: Incomplete | None = None): ... - def insertnx(self, key, items, capacity: Incomplete | None = None, nocreate: Incomplete | None = None): ... - def exists(self, key, item): ... - def delete(self, key, item): ... - def count(self, key, item): ... - def scandump(self, key, iter): ... - def loadchunk(self, key, iter, data): ... - def info(self, key): ... - -class TOPKCommands: - def reserve(self, key, k, width, depth, decay): ... - def add(self, key, *items): ... - def incrby(self, key, items, increments): ... - def query(self, key, *items): ... - def count(self, key, *items): ... - def list(self, key, withcount: bool = False): ... - def info(self, key): ... - -class TDigestCommands: - def create(self, key, compression: int = 100): ... - def reset(self, key): ... - def add(self, key, values): ... - def merge(self, destination_key, num_keys, *keys, compression: int | None = None, override: bool = False): ... - def min(self, key): ... - def max(self, key): ... - def quantile(self, key, quantile, *quantiles): ... - def cdf(self, key, value, *values): ... - def info(self, key): ... - -class CMSCommands: - def initbydim(self, key, width, depth): ... - def initbyprob(self, key, error, probability): ... - def incrby(self, key, items, increments): ... - def query(self, key, *items): ... - def merge(self, destKey, numKeys, srcKeys, weights=[]): ... - def info(self, key): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/info.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/info.pyi deleted file mode 100644 index 54d1cf044e9e..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/bf/info.pyi +++ /dev/null @@ -1,43 +0,0 @@ -from typing import Any - -class BFInfo: - capacity: Any - size: Any - filterNum: Any - insertedNum: Any - expansionRate: Any - def __init__(self, args) -> None: ... - -class CFInfo: - size: Any - bucketNum: Any - filterNum: Any - insertedNum: Any - deletedNum: Any - bucketSize: Any - expansionRate: Any - maxIteration: Any - def __init__(self, args) -> None: ... - -class CMSInfo: - width: Any - depth: Any - count: Any - def __init__(self, args) -> None: ... - -class TopKInfo: - k: Any - width: Any - depth: Any - decay: Any - def __init__(self, args) -> None: ... - -class TDigestInfo: - compression: Any - capacity: Any - mergedNodes: Any - unmergedNodes: Any - mergedWeight: Any - unmergedWeight: Any - totalCompressions: Any - def __init__(self, args) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/cluster.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/cluster.pyi deleted file mode 100644 index 07d00f9e95c5..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/cluster.pyi +++ /dev/null @@ -1,60 +0,0 @@ -from _typeshed import Incomplete -from typing import NoReturn - -from .core import ACLCommands, DataAccessCommands, ManagementCommands, PubSubCommands, _StrType - -class ClusterMultiKeyCommands: - def mget_nonatomic(self, keys, *args): ... - def mset_nonatomic(self, mapping): ... - def exists(self, *keys): ... - def delete(self, *keys): ... - def touch(self, *keys): ... - def unlink(self, *keys): ... - -class ClusterManagementCommands(ManagementCommands): - def slaveof(self, *args, **kwargs) -> None: ... - def replicaof(self, *args, **kwargs) -> None: ... - def swapdb(self, *args, **kwargs) -> None: ... - -class ClusterDataAccessCommands(DataAccessCommands[_StrType]): - def stralgo( - self, - algo, - value1, - value2, - specific_argument: str = "strings", - len: bool = False, - idx: bool = False, - minmatchlen: Incomplete | None = None, - withmatchlen: bool = False, - **kwargs, - ): ... - -class RedisClusterCommands( - ClusterMultiKeyCommands, ClusterManagementCommands, ACLCommands[_StrType], PubSubCommands, ClusterDataAccessCommands[_StrType] -): - def cluster_addslots(self, target_node, *slots): ... - def cluster_countkeysinslot(self, slot_id): ... - def cluster_count_failure_report(self, node_id): ... - def cluster_delslots(self, *slots): ... - def cluster_failover(self, target_node, option: Incomplete | None = None): ... - def cluster_info(self, target_nodes: Incomplete | None = None): ... - def cluster_keyslot(self, key): ... - def cluster_meet(self, host, port, target_nodes: Incomplete | None = None): ... - def cluster_nodes(self): ... - def cluster_replicate(self, target_nodes, node_id): ... - def cluster_reset(self, soft: bool = True, target_nodes: Incomplete | None = None): ... - def cluster_save_config(self, target_nodes: Incomplete | None = None): ... - def cluster_get_keys_in_slot(self, slot, num_keys): ... - def cluster_set_config_epoch(self, epoch, target_nodes: Incomplete | None = None): ... - def cluster_setslot(self, target_node, node_id, slot_id, state): ... - def cluster_setslot_stable(self, slot_id): ... - def cluster_replicas(self, node_id, target_nodes: Incomplete | None = None): ... - def cluster_slots(self, target_nodes: Incomplete | None = None): ... - def cluster_myshardid(self, target_nodes: Incomplete | None = None): ... - def cluster_links(self, target_node): ... - def cluster_flushslots(self, target_nodes: Incomplete | None = None) -> NoReturn: ... - def cluster_bumpepoch(self, target_nodes: Incomplete | None = None) -> NoReturn: ... - read_from_replicas: bool - def readonly(self, target_nodes: Incomplete | None = None): ... - def readwrite(self, target_nodes: Incomplete | None = None): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/core.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/core.pyi deleted file mode 100644 index dfe2c569bf05..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/core.pyi +++ /dev/null @@ -1,1743 +0,0 @@ -import builtins -from _typeshed import Incomplete, SupportsItems -from collections.abc import AsyncIterator, Awaitable, Callable, Iterable, Iterator, Mapping, Sequence -from datetime import datetime, timedelta -from typing import Any, Generic, Literal, TypeVar, overload - -from ..asyncio.client import Redis as AsyncRedis -from ..client import _CommandOptions, _Key, _Value -from ..typing import ChannelT, EncodableT, KeyT, PatternT, ScriptTextT, StreamIdT - -_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn") -_StrType = TypeVar("_StrType", bound=str | bytes) - -class ACLCommands(Generic[_StrType]): - def acl_cat(self, category: str | None = None, **kwargs: _CommandOptions) -> list[str]: ... - def acl_deluser(self, *username: str, **kwargs: _CommandOptions) -> int: ... - def acl_genpass(self, bits: int | None = None, **kwargs: _CommandOptions) -> str: ... - def acl_getuser(self, username: str, **kwargs: _CommandOptions) -> Any | None: ... - def acl_help(self, **kwargs: _CommandOptions): ... - def acl_list(self, **kwargs: _CommandOptions) -> list[str]: ... - def acl_log(self, count: int | None = None, **kwargs: _CommandOptions): ... - def acl_log_reset(self, **kwargs: _CommandOptions): ... - def acl_load(self, **kwargs: _CommandOptions) -> bool: ... - def acl_save(self, **kwargs: _CommandOptions): ... - def acl_setuser( - self, - username: str, - enabled: bool = False, - nopass: bool = False, - passwords: Sequence[str] | None = None, - hashed_passwords: Sequence[str] | None = None, - categories: Sequence[str] | None = None, - commands: Sequence[str] | None = None, - keys: Sequence[str] | None = None, - channels: Iterable[ChannelT] | None = None, - selectors: Iterable[tuple[str, KeyT]] | None = None, - reset: bool = False, - reset_keys: bool = False, - reset_channels: bool = False, - reset_passwords: bool = False, - **kwargs: _CommandOptions, - ) -> bool: ... - def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ... - def acl_whoami(self, **kwargs: _CommandOptions) -> str: ... - -class AsyncACLCommands(Generic[_StrType]): - async def acl_cat(self, category: str | None = None, **kwargs: _CommandOptions) -> list[str]: ... - async def acl_deluser(self, *username: str, **kwargs: _CommandOptions) -> int: ... - async def acl_genpass(self, bits: int | None = None, **kwargs: _CommandOptions) -> str: ... - async def acl_getuser(self, username: str, **kwargs: _CommandOptions) -> Any | None: ... - async def acl_help(self, **kwargs: _CommandOptions): ... - async def acl_list(self, **kwargs: _CommandOptions) -> list[str]: ... - async def acl_log(self, count: int | None = None, **kwargs: _CommandOptions): ... - async def acl_log_reset(self, **kwargs: _CommandOptions): ... - async def acl_load(self, **kwargs: _CommandOptions) -> bool: ... - async def acl_save(self, **kwargs: _CommandOptions): ... - async def acl_setuser( - self, - username: str, - enabled: bool = False, - nopass: bool = False, - passwords: Sequence[str] | None = None, - hashed_passwords: Sequence[str] | None = None, - categories: Sequence[str] | None = None, - commands: Sequence[str] | None = None, - keys: Sequence[str] | None = None, - channels: Iterable[ChannelT] | None = None, - selectors: Iterable[tuple[str, KeyT]] | None = None, - reset: bool = False, - reset_keys: bool = False, - reset_channels: bool = False, - reset_passwords: bool = False, - **kwargs: _CommandOptions, - ) -> bool: ... - async def acl_users(self, **kwargs: _CommandOptions) -> list[str]: ... - async def acl_whoami(self, **kwargs: _CommandOptions) -> str: ... - -class ManagementCommands: - def bgrewriteaof(self, **kwargs: _CommandOptions): ... - def bgsave(self, schedule: bool = True, **kwargs: _CommandOptions): ... - def role(self): ... - def client_kill(self, address: str, **kwargs: _CommandOptions) -> bool: ... - def client_kill_filter( - self, - _id: Incomplete | None = None, - _type: Incomplete | None = None, - addr: Incomplete | None = None, - skipme: Incomplete | None = None, - laddr: Incomplete | None = None, - user: Incomplete | None = None, - **kwargs: _CommandOptions, - ): ... - def client_info(self, **kwargs: _CommandOptions): ... - def client_list( - self, _type: str | None = None, client_id: list[str] = [], **kwargs: _CommandOptions - ) -> list[dict[str, str]]: ... - def client_getname(self, **kwargs: _CommandOptions) -> str | None: ... - def client_getredir(self, **kwargs: _CommandOptions): ... - def client_reply(self, reply, **kwargs: _CommandOptions): ... - def client_id(self, **kwargs: _CommandOptions) -> int: ... - def client_tracking_on( - self, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - ): ... - def client_tracking_off( - self, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - ): ... - def client_tracking( - self, - on: bool = True, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - **kwargs: _CommandOptions, - ): ... - def client_trackinginfo(self, **kwargs: _CommandOptions): ... - def client_setname(self, name: str, **kwargs: _CommandOptions) -> bool: ... - def client_unblock(self, client_id, error: bool = False, **kwargs: _CommandOptions): ... - def client_pause(self, timeout, all: bool = True, **kwargs: _CommandOptions): ... - def client_unpause(self, **kwargs: _CommandOptions): ... - def client_no_evict(self, mode: str): ... - def client_no_touch(self, mode: str): ... - def command(self, **kwargs: _CommandOptions): ... - def command_info(self, **kwargs: _CommandOptions): ... - def command_count(self, **kwargs: _CommandOptions): ... - def config_get(self, pattern: PatternT = "*", *args: PatternT, **kwargs: _CommandOptions): ... - def config_set(self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions): ... - def config_resetstat(self, **kwargs: _CommandOptions): ... - def config_rewrite(self, **kwargs: _CommandOptions): ... - def dbsize(self, **kwargs: _CommandOptions) -> int: ... - def debug_object(self, key, **kwargs: _CommandOptions): ... - def debug_segfault(self, **kwargs: _CommandOptions): ... - def echo(self, value: _Value, **kwargs: _CommandOptions) -> bytes: ... - def flushall(self, asynchronous: bool = False, **kwargs: _CommandOptions) -> bool: ... - def flushdb(self, asynchronous: bool = False, **kwargs: _CommandOptions) -> bool: ... - def sync(self): ... - def psync(self, replicationid, offset): ... - def swapdb(self, first, second, **kwargs: _CommandOptions): ... - def select(self, index, **kwargs: _CommandOptions): ... - def info(self, section: _Key | None = None, *args: _Key, **kwargs: _CommandOptions) -> Mapping[str, Any]: ... - def lastsave(self, **kwargs: _CommandOptions): ... - def lolwut(self, *version_numbers: _Value, **kwargs: _CommandOptions) -> bytes: ... - def reset(self) -> None: ... - def migrate( - self, - host, - port, - keys, - destination_db, - timeout, - copy: bool = False, - replace: bool = False, - auth: Incomplete | None = None, - **kwargs: _CommandOptions, - ): ... - def object(self, infotype, key, **kwargs: _CommandOptions): ... - def memory_doctor(self, **kwargs: _CommandOptions): ... - def memory_help(self, **kwargs: _CommandOptions): ... - def memory_stats(self, **kwargs: _CommandOptions) -> dict[str, Any]: ... - def memory_malloc_stats(self, **kwargs: _CommandOptions): ... - def memory_usage(self, key, samples: Incomplete | None = None, **kwargs: _CommandOptions): ... - def memory_purge(self, **kwargs: _CommandOptions): ... - def ping(self, **kwargs: _CommandOptions) -> bool: ... - def quit(self, **kwargs: _CommandOptions): ... - def replicaof(self, *args, **kwargs: _CommandOptions): ... - def save(self, **kwargs: _CommandOptions) -> bool: ... - def shutdown( - self, - save: bool = False, - nosave: bool = False, - now: bool = False, - force: bool = False, - abort: bool = False, - **kwargs: _CommandOptions, - ) -> None: ... - def slaveof(self, host: Incomplete | None = None, port: Incomplete | None = None, **kwargs: _CommandOptions): ... - def slowlog_get(self, num: Incomplete | None = None, **kwargs: _CommandOptions): ... - def slowlog_len(self, **kwargs: _CommandOptions): ... - def slowlog_reset(self, **kwargs: _CommandOptions): ... - def time(self, **kwargs: _CommandOptions): ... - def wait(self, num_replicas, timeout, **kwargs: _CommandOptions): ... - -class AsyncManagementCommands: - async def bgrewriteaof(self, **kwargs: _CommandOptions): ... - async def bgsave(self, schedule: bool = True, **kwargs: _CommandOptions): ... - async def role(self): ... - async def client_kill(self, address: str, **kwargs: _CommandOptions) -> bool: ... - async def client_kill_filter( - self, - _id: Incomplete | None = None, - _type: Incomplete | None = None, - addr: Incomplete | None = None, - skipme: Incomplete | None = None, - laddr: Incomplete | None = None, - user: Incomplete | None = None, - **kwargs: _CommandOptions, - ): ... - async def client_info(self, **kwargs: _CommandOptions): ... - async def client_list( - self, _type: str | None = None, client_id: list[str] = [], **kwargs: _CommandOptions - ) -> list[dict[str, str]]: ... - async def client_getname(self, **kwargs: _CommandOptions) -> str | None: ... - async def client_getredir(self, **kwargs: _CommandOptions): ... - async def client_reply(self, reply, **kwargs: _CommandOptions): ... - async def client_id(self, **kwargs: _CommandOptions) -> int: ... - async def client_tracking_on( - self, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - ): ... - async def client_tracking_off( - self, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - ): ... - async def client_tracking( - self, - on: bool = True, - clientid: Incomplete | None = None, - prefix=[], - bcast: bool = False, - optin: bool = False, - optout: bool = False, - noloop: bool = False, - **kwargs: _CommandOptions, - ): ... - async def client_trackinginfo(self, **kwargs: _CommandOptions): ... - async def client_setname(self, name: str, **kwargs: _CommandOptions) -> bool: ... - async def client_unblock(self, client_id, error: bool = False, **kwargs: _CommandOptions): ... - async def client_pause(self, timeout, all: bool = True, **kwargs: _CommandOptions): ... - async def client_unpause(self, **kwargs: _CommandOptions): ... - async def command(self, **kwargs: _CommandOptions): ... - async def command_info(self, **kwargs: _CommandOptions): ... - async def command_count(self, **kwargs: _CommandOptions): ... - async def config_get(self, pattern: PatternT = "*", *args: PatternT, **kwargs: _CommandOptions): ... - async def config_set(self, name: KeyT, value: EncodableT, *args: KeyT | EncodableT, **kwargs: _CommandOptions): ... - async def config_resetstat(self, **kwargs: _CommandOptions): ... - async def config_rewrite(self, **kwargs: _CommandOptions): ... - async def dbsize(self, **kwargs: _CommandOptions) -> int: ... - async def debug_object(self, key, **kwargs: _CommandOptions): ... - async def debug_segfault(self, **kwargs: _CommandOptions): ... - async def echo(self, value: _Value, **kwargs: _CommandOptions) -> bytes: ... - async def flushall(self, asynchronous: bool = False, **kwargs: _CommandOptions) -> bool: ... - async def flushdb(self, asynchronous: bool = False, **kwargs: _CommandOptions) -> bool: ... - async def sync(self): ... - async def psync(self, replicationid, offset): ... - async def swapdb(self, first, second, **kwargs: _CommandOptions): ... - async def select(self, index, **kwargs: _CommandOptions): ... - async def info(self, section: _Key | None = None, *args: _Key, **kwargs: _CommandOptions) -> Mapping[str, Any]: ... - async def lastsave(self, **kwargs: _CommandOptions): ... - async def lolwut(self, *version_numbers: _Value, **kwargs: _CommandOptions) -> bytes: ... - async def reset(self) -> None: ... - async def migrate( - self, - host, - port, - keys, - destination_db, - timeout, - copy: bool = False, - replace: bool = False, - auth: Incomplete | None = None, - **kwargs: _CommandOptions, - ): ... - async def object(self, infotype, key, **kwargs: _CommandOptions): ... - async def memory_doctor(self, **kwargs: _CommandOptions): ... - async def memory_help(self, **kwargs: _CommandOptions): ... - async def memory_stats(self, **kwargs: _CommandOptions) -> dict[str, Any]: ... - async def memory_malloc_stats(self, **kwargs: _CommandOptions): ... - async def memory_usage(self, key, samples: Incomplete | None = None, **kwargs: _CommandOptions): ... - async def memory_purge(self, **kwargs: _CommandOptions): ... - async def ping(self, **kwargs: _CommandOptions) -> bool: ... - async def quit(self, **kwargs: _CommandOptions): ... - async def replicaof(self, *args, **kwargs: _CommandOptions): ... - async def save(self, **kwargs: _CommandOptions) -> bool: ... - async def shutdown( - self, - save: bool = False, - nosave: bool = False, - now: bool = False, - force: bool = False, - abort: bool = False, - **kwargs: _CommandOptions, - ) -> None: ... - async def slaveof(self, host: Incomplete | None = None, port: Incomplete | None = None, **kwargs: _CommandOptions): ... - async def slowlog_get(self, num: Incomplete | None = None, **kwargs: _CommandOptions): ... - async def slowlog_len(self, **kwargs: _CommandOptions): ... - async def slowlog_reset(self, **kwargs: _CommandOptions): ... - async def time(self, **kwargs: _CommandOptions): ... - async def wait(self, num_replicas, timeout, **kwargs: _CommandOptions): ... - -class BasicKeyCommands(Generic[_StrType]): - def append(self, key, value): ... - def bitcount(self, key: _Key, start: int | None = None, end: int | None = None, mode: str | None = None) -> int: ... - def bitfield(self, key, default_overflow: Incomplete | None = None): ... - def bitop(self, operation, dest, *keys): ... - def bitpos(self, key: _Key, bit: int, start: int | None = None, end: int | None = None, mode: str | None = None): ... - def copy(self, source, destination, destination_db: Incomplete | None = None, replace: bool = False): ... - def decr(self, name, amount: int = 1) -> int: ... - def decrby(self, name, amount: int = 1) -> int: ... - def delete(self, *names: _Key) -> int: ... - def __delitem__(self, name: _Key) -> None: ... - def dump(self, name: _Key) -> _StrType | None: ... - def exists(self, *names: _Key) -> int: ... - __contains__ = exists - def expire( - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> bool: ... - def expireat(self, name, when, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False): ... - def get(self, name: _Key) -> _StrType | None: ... - def getdel(self, name: _Key) -> _StrType | None: ... - def getex( - self, - name, - ex: Incomplete | None = None, - px: Incomplete | None = None, - exat: Incomplete | None = None, - pxat: Incomplete | None = None, - persist: bool = False, - ): ... - def __getitem__(self, name: str): ... - def getbit(self, name: _Key, offset: int) -> int: ... - def getrange(self, key, start, end): ... - def getset(self, name, value) -> _StrType | None: ... - def incr(self, name: _Key, amount: int = 1) -> int: ... - def incrby(self, name: _Key, amount: int = 1) -> int: ... - def incrbyfloat(self, name: _Key, amount: float = 1.0) -> float: ... - def keys(self, pattern: _Key = "*", **kwargs: _CommandOptions) -> list[_StrType]: ... - def lmove( - self, - first_list: _Key, - second_list: _Key, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> _Value: ... - def blmove( - self, - first_list: _Key, - second_list: _Key, - timeout: float, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> _Value | None: ... - def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... - def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ... - def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ... - def move(self, name: _Key, db: int) -> bool: ... - def persist(self, name: _Key) -> bool: ... - def pexpire( - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Literal[1, 0]: ... - def pexpireat( - self, name: _Key, when: int | datetime, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Literal[1, 0]: ... - def psetex(self, name, time_ms, value): ... - def pttl(self, name: _Key) -> int: ... - def hrandfield(self, key, count: Incomplete | None = None, withvalues: bool = False): ... - def randomkey(self, **kwargs: _CommandOptions): ... - def rename(self, src, dst): ... - def renamenx(self, src, dst): ... - def restore( - self, - name, - ttl, - value, - replace: bool = False, - absttl: bool = False, - idletime: Incomplete | None = None, - frequency: Incomplete | None = None, - ): ... - def set( - self, - name: _Key, - value: _Value, - ex: None | float | timedelta = None, - px: None | float | timedelta = None, - nx: bool = False, - xx: bool = False, - keepttl: bool = False, - get: bool = False, - exat: Incomplete | None = None, - pxat: Incomplete | None = None, - ) -> bool | None: ... - def __setitem__(self, name, value) -> None: ... - def setbit(self, name: _Key, offset: int, value: int) -> int: ... - def setex(self, name: _Key, time: int | timedelta, value: _Value) -> bool: ... - def setnx(self, name: _Key, value: _Value) -> bool: ... - def setrange(self, name, offset, value): ... - def stralgo( - self, - algo, - value1, - value2, - specific_argument: str = "strings", - len: bool = False, - idx: bool = False, - minmatchlen: Incomplete | None = None, - withmatchlen: bool = False, - **kwargs: _CommandOptions, - ): ... - def strlen(self, name): ... - def substr(self, name, start, end: int = -1): ... - def touch(self, *args): ... - def ttl(self, name: _Key) -> int: ... - def type(self, name): ... - def watch(self, *names): ... - def unwatch(self): ... - def unlink(self, *names: _Key) -> int: ... - -class AsyncBasicKeyCommands(Generic[_StrType]): - async def append(self, key, value): ... - async def bitcount(self, key: _Key, start: int | None = None, end: int | None = None, mode: str | None = None) -> int: ... - async def bitfield(self, key, default_overflow: Incomplete | None = None): ... - async def bitop(self, operation, dest, *keys): ... - async def bitpos(self, key: _Key, bit: int, start: int | None = None, end: int | None = None, mode: str | None = None): ... - async def copy(self, source, destination, destination_db: Incomplete | None = None, replace: bool = False): ... - async def decr(self, name, amount: int = 1) -> int: ... - async def decrby(self, name, amount: int = 1) -> int: ... - async def delete(self, *names: _Key) -> int: ... - async def dump(self, name: _Key) -> _StrType | None: ... - async def exists(self, *names: _Key) -> int: ... - async def expire( - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> bool: ... - async def expireat(self, name, when, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False): ... - async def get(self, name: _Key) -> _StrType | None: ... - async def getdel(self, name: _Key) -> _StrType | None: ... - async def getex( - self, - name, - ex: Incomplete | None = None, - px: Incomplete | None = None, - exat: Incomplete | None = None, - pxat: Incomplete | None = None, - persist: bool = False, - ): ... - async def getbit(self, name: _Key, offset: int) -> int: ... - async def getrange(self, key, start, end): ... - async def getset(self, name, value) -> _StrType | None: ... - async def incr(self, name: _Key, amount: int = 1) -> int: ... - async def incrby(self, name: _Key, amount: int = 1) -> int: ... - async def incrbyfloat(self, name: _Key, amount: float = 1.0) -> float: ... - async def keys(self, pattern: _Key = "*", **kwargs: _CommandOptions) -> list[_StrType]: ... - async def lmove( - self, - first_list: _Key, - second_list: _Key, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> _Value: ... - async def blmove( - self, - first_list: _Key, - second_list: _Key, - timeout: float, - src: Literal["LEFT", "RIGHT"] = "LEFT", - dest: Literal["LEFT", "RIGHT"] = "RIGHT", - ) -> _Value | None: ... - async def mget(self, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... - async def mset(self, mapping: Mapping[_Key, _Value]) -> Literal[True]: ... - async def msetnx(self, mapping: Mapping[_Key, _Value]) -> bool: ... - async def move(self, name: _Key, db: int) -> bool: ... - async def persist(self, name: _Key) -> bool: ... - async def pexpire( - self, name: _Key, time: int | timedelta, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Literal[1, 0]: ... - async def pexpireat( - self, name: _Key, when: int | datetime, nx: bool = False, xx: bool = False, gt: bool = False, lt: bool = False - ) -> Literal[1, 0]: ... - async def psetex(self, name, time_ms, value): ... - async def pttl(self, name: _Key) -> int: ... - async def hrandfield(self, key, count: Incomplete | None = None, withvalues: bool = False): ... - async def randomkey(self, **kwargs: _CommandOptions): ... - async def rename(self, src, dst): ... - async def renamenx(self, src, dst): ... - async def restore( - self, - name, - ttl, - value, - replace: bool = False, - absttl: bool = False, - idletime: Incomplete | None = None, - frequency: Incomplete | None = None, - ): ... - async def set( - self, - name: _Key, - value: _Value, - ex: None | float | timedelta = None, - px: None | float | timedelta = None, - nx: bool = False, - xx: bool = False, - keepttl: bool = False, - get: bool = False, - exat: Incomplete | None = None, - pxat: Incomplete | None = None, - ) -> bool | None: ... - async def setbit(self, name: _Key, offset: int, value: int) -> int: ... - async def setex(self, name: _Key, time: int | timedelta, value: _Value) -> bool: ... - async def setnx(self, name: _Key, value: _Value) -> bool: ... - async def setrange(self, name, offset, value): ... - async def stralgo( - self, - algo, - value1, - value2, - specific_argument: str = "strings", - len: bool = False, - idx: bool = False, - minmatchlen: Incomplete | None = None, - withmatchlen: bool = False, - **kwargs: _CommandOptions, - ): ... - async def strlen(self, name): ... - async def substr(self, name, start, end: int = -1): ... - async def touch(self, *args): ... - async def ttl(self, name: _Key) -> int: ... - async def type(self, name): ... - async def watch(self, *names): ... - async def unwatch(self): ... - async def unlink(self, *names: _Key) -> int: ... - def __getitem__(self, name: str): ... - def __setitem__(self, name, value) -> None: ... - def __delitem__(self, name: _Key) -> None: ... - def __contains__(self, name: _Key) -> None: ... - -class ListCommands(Generic[_StrType]): - @overload - def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = 0) -> tuple[_StrType, _StrType]: ... - @overload - def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... - @overload - def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = 0) -> tuple[_StrType, _StrType]: ... - @overload - def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... - def brpoplpush(self, src, dst, timeout: int | None = 0): ... - def lindex(self, name: _Key, index: int) -> _StrType | None: ... - def linsert( - self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value - ) -> int: ... - def llen(self, name: _Key) -> int: ... - def lpop(self, name, count: int | None = None): ... - def lpush(self, name: _Value, *values: _Value) -> int: ... - def lpushx(self, name, value): ... - def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ... - def lrem(self, name: _Key, count: int, value: _Value) -> int: ... - def lset(self, name: _Key, index: int, value: _Value) -> bool: ... - def ltrim(self, name: _Key, start: int, end: int) -> bool: ... - def rpop(self, name, count: int | None = None): ... - def rpoplpush(self, src, dst): ... - def rpush(self, name: _Value, *values: _Value) -> int: ... - def rpushx(self, name, value): ... - def lpos( - self, name, value, rank: Incomplete | None = None, count: Incomplete | None = None, maxlen: Incomplete | None = None - ): ... - @overload - def sort( - self, - name: _Key, - start: int | None = None, - num: int | None = None, - by: _Key | None = None, - get: _Key | Sequence[_Key] | None = None, - desc: bool = False, - alpha: bool = False, - store: None = None, - groups: bool = False, - ) -> list[_StrType]: ... - @overload - def sort( - self, - name: _Key, - start: int | None = None, - num: int | None = None, - by: _Key | None = None, - get: _Key | Sequence[_Key] | None = None, - desc: bool = False, - alpha: bool = False, - *, - store: _Key, - groups: bool = False, - ) -> int: ... - @overload - def sort( - self, - name: _Key, - start: int | None, - num: int | None, - by: _Key | None, - get: _Key | Sequence[_Key] | None, - desc: bool, - alpha: bool, - store: _Key, - groups: bool = False, - ) -> int: ... - -class AsyncListCommands(Generic[_StrType]): - @overload - async def blpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = 0) -> tuple[_StrType, _StrType]: ... - @overload - async def blpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... - @overload - async def brpop(self, keys: _Value | Iterable[_Value], timeout: Literal[0] | None = 0) -> tuple[_StrType, _StrType]: ... - @overload - async def brpop(self, keys: _Value | Iterable[_Value], timeout: float) -> tuple[_StrType, _StrType] | None: ... - async def brpoplpush(self, src, dst, timeout: int | None = 0): ... - async def lindex(self, name: _Key, index: int) -> _StrType | None: ... - async def linsert( - self, name: _Key, where: Literal["BEFORE", "AFTER", "before", "after"], refvalue: _Value, value: _Value - ) -> int: ... - async def llen(self, name: _Key) -> int: ... - async def lpop(self, name, count: int | None = None): ... - async def lpush(self, name: _Value, *values: _Value) -> int: ... - async def lpushx(self, name, value): ... - async def lrange(self, name: _Key, start: int, end: int) -> list[_StrType]: ... - async def lrem(self, name: _Key, count: int, value: _Value) -> int: ... - async def lset(self, name: _Key, index: int, value: _Value) -> bool: ... - async def ltrim(self, name: _Key, start: int, end: int) -> bool: ... - async def rpop(self, name, count: int | None = None): ... - async def rpoplpush(self, src, dst): ... - async def rpush(self, name: _Value, *values: _Value) -> int: ... - async def rpushx(self, name, value): ... - async def lpos( - self, name, value, rank: Incomplete | None = None, count: Incomplete | None = None, maxlen: Incomplete | None = None - ): ... - @overload - async def sort( - self, - name: _Key, - start: int | None = None, - num: int | None = None, - by: _Key | None = None, - get: _Key | Sequence[_Key] | None = None, - desc: bool = False, - alpha: bool = False, - store: None = None, - groups: bool = False, - ) -> list[_StrType]: ... - @overload - async def sort( - self, - name: _Key, - start: int | None = None, - num: int | None = None, - by: _Key | None = None, - get: _Key | Sequence[_Key] | None = None, - desc: bool = False, - alpha: bool = False, - *, - store: _Key, - groups: bool = False, - ) -> int: ... - @overload - async def sort( - self, - name: _Key, - start: int | None, - num: int | None, - by: _Key | None, - get: _Key | Sequence[_Key] | None, - desc: bool, - alpha: bool, - store: _Key, - groups: bool = False, - ) -> int: ... - -class ScanCommands(Generic[_StrType]): - def scan( - self, - cursor: int = 0, - match: _Key | None = None, - count: int | None = None, - _type: str | None = None, - **kwargs: _CommandOptions, - ) -> tuple[int, list[_StrType]]: ... - def scan_iter( - self, match: _Key | None = None, count: int | None = None, _type: str | None = None, **kwargs: _CommandOptions - ) -> Iterator[_StrType]: ... - def sscan( - self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None - ) -> tuple[int, list[_StrType]]: ... - def sscan_iter(self, name: _Key, match: _Key | None = None, count: int | None = None) -> Iterator[_StrType]: ... - def hscan( - self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None - ) -> tuple[int, dict[_StrType, _StrType]]: ... - def hscan_iter( - self, name: _Key, match: _Key | None = None, count: int | None = None - ) -> Iterator[tuple[_StrType, _StrType]]: ... - @overload - def zscan( - self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None - ) -> tuple[int, list[tuple[_StrType, float]]]: ... - @overload - def zscan( - self, - name: _Key, - cursor: int = 0, - match: _Key | None = None, - count: int | None = None, - *, - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... - @overload - def zscan( - self, - name: _Key, - cursor: int, - match: _Key | None, - count: int | None, - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... - @overload - def zscan_iter(self, name: _Key, match: _Key | None = None, count: int | None = None) -> Iterator[tuple[_StrType, float]]: ... - @overload - def zscan_iter( - self, - name: _Key, - match: _Key | None = None, - count: int | None = None, - *, - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zscan_iter( - self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] - ) -> Iterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... - -class AsyncScanCommands(Generic[_StrType]): - async def scan( - self, - cursor: int = 0, - match: _Key | None = None, - count: int | None = None, - _type: str | None = None, - **kwargs: _CommandOptions, - ) -> tuple[int, list[_StrType]]: ... - def scan_iter( - self, match: _Key | None = None, count: int | None = None, _type: str | None = None, **kwargs: _CommandOptions - ) -> AsyncIterator[_StrType]: ... - async def sscan( - self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None - ) -> tuple[int, list[_StrType]]: ... - def sscan_iter(self, name: _Key, match: _Key | None = None, count: int | None = None) -> AsyncIterator[_StrType]: ... - async def hscan( - self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None - ) -> tuple[int, dict[_StrType, _StrType]]: ... - def hscan_iter( - self, name: _Key, match: _Key | None = None, count: int | None = None - ) -> AsyncIterator[tuple[_StrType, _StrType]]: ... - @overload - async def zscan( - self, name: _Key, cursor: int = 0, match: _Key | None = None, count: int | None = None - ) -> tuple[int, list[tuple[_StrType, float]]]: ... - @overload - async def zscan( - self, - name: _Key, - cursor: int = 0, - match: _Key | None = None, - count: int | None = None, - *, - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... - @overload - async def zscan( - self, - name: _Key, - cursor: int, - match: _Key | None, - count: int | None, - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> tuple[int, list[tuple[_StrType, _ScoreCastFuncReturn]]]: ... - @overload - def zscan_iter( - self, name: _Key, match: _Key | None = None, count: int | None = None - ) -> AsyncIterator[tuple[_StrType, float]]: ... - @overload - def zscan_iter( - self, - name: _Key, - match: _Key | None = None, - count: int | None = None, - *, - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zscan_iter( - self, name: _Key, match: _Key | None, count: int | None, score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] - ) -> AsyncIterator[tuple[_StrType, _ScoreCastFuncReturn]]: ... - -class SetCommands(Generic[_StrType]): - def sadd(self, name: _Key, *values: _Value) -> int: ... - def scard(self, name: _Key) -> int: ... - def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... - def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... - def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - def sismember(self, name: _Key, value: _Value) -> bool: ... - def smembers(self, name: _Key) -> builtins.set[_StrType]: ... - def smismember(self, name, values, *args): ... - def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ... - @overload - def spop(self, name: _Key, count: None = None) -> _Value | None: ... - @overload - def spop(self, name: _Key, count: int) -> list[_Value]: ... - @overload - def srandmember(self, name: _Key, number: None = None) -> _Value | None: ... - @overload - def srandmember(self, name: _Key, number: int) -> list[_Value]: ... - def srem(self, name: _Key, *values: _Value) -> int: ... - def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... - def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - -class AsyncSetCommands(Generic[_StrType]): - async def sadd(self, name: _Key, *values: _Value) -> int: ... - async def scard(self, name: _Key) -> int: ... - async def sdiff(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... - async def sdiffstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - async def sinter(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... - async def sinterstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - async def sismember(self, name: _Key, value: _Value) -> bool: ... - async def smembers(self, name: _Key) -> builtins.set[_StrType]: ... - async def smismember(self, name, values, *args): ... - async def smove(self, src: _Key, dst: _Key, value: _Value) -> bool: ... - @overload - async def spop(self, name: _Key, count: None = None) -> _Value | None: ... - @overload - async def spop(self, name: _Key, count: int) -> list[_Value]: ... - @overload - async def srandmember(self, name: _Key, number: None = None) -> _Value | None: ... - @overload - async def srandmember(self, name: _Key, number: int) -> list[_Value]: ... - async def srem(self, name: _Key, *values: _Value) -> int: ... - async def sunion(self, keys: _Key | Iterable[_Key], *args: _Key) -> builtins.set[_Value]: ... - async def sunionstore(self, dest: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> int: ... - -class StreamCommands: - def xack(self, name, groupname, *ids): ... - def xadd( - self, - name: KeyT, - # Only accepts dict objects, but for variance reasons we use a looser annotation - fields: SupportsItems[bytes | memoryview | str | float, Any], - id: str | int | bytes | memoryview = "*", - maxlen=None, - approximate: bool = True, - nomkstream: bool = False, - minid: Incomplete | None = None, - limit: Incomplete | None = None, - ): ... - def xautoclaim( - self, - name, - groupname, - consumername, - min_idle_time, - start_id: StreamIdT = "0-0", - count: Incomplete | None = None, - justid: bool = False, - ): ... - def xclaim( - self, - name, - groupname, - consumername, - min_idle_time, - message_ids, - idle=None, - time=None, - retrycount=None, - force=False, - justid=False, - ): ... - def xdel(self, name: KeyT, *ids: str | int | bytes | memoryview): ... - def xgroup_create(self, name, groupname, id: str = "$", mkstream: bool = False, entries_read: int | None = None): ... - def xgroup_delconsumer(self, name, groupname, consumername): ... - def xgroup_destroy(self, name, groupname): ... - def xgroup_createconsumer(self, name, groupname, consumername): ... - def xgroup_setid(self, name, groupname, id, entries_read: int | None = None): ... - def xinfo_consumers(self, name, groupname): ... - def xinfo_groups(self, name): ... - def xinfo_stream(self, name, full: bool = False): ... - def xlen(self, name: _Key) -> int: ... - def xpending(self, name, groupname): ... - def xpending_range( - self, name: _Key, groupname, min, max, count: int, consumername: Incomplete | None = None, idle: int | None = None - ): ... - def xrange(self, name, min: str = "-", max: str = "+", count: Incomplete | None = None): ... - def xread(self, streams, count: Incomplete | None = None, block: Incomplete | None = None): ... - def xreadgroup( - self, - groupname, - consumername, - streams, - count: Incomplete | None = None, - block: Incomplete | None = None, - noack: bool = False, - ): ... - def xrevrange(self, name, max: str = "+", min: str = "-", count: Incomplete | None = None): ... - def xtrim( - self, name, maxlen: int | None = None, approximate: bool = True, minid: Incomplete | None = None, limit: int | None = None - ): ... - -class AsyncStreamCommands: - async def xack(self, name, groupname, *ids): ... - async def xadd( - self, - name: KeyT, - # Only accepts dict objects, but for variance reasons we use a looser annotation - fields: SupportsItems[bytes | memoryview | str | float, Any], - id: str | int | bytes | memoryview = "*", - maxlen=None, - approximate: bool = True, - nomkstream: bool = False, - minid: Incomplete | None = None, - limit: Incomplete | None = None, - ): ... - async def xautoclaim( - self, - name, - groupname, - consumername, - min_idle_time, - start_id: StreamIdT = "0-0", - count: Incomplete | None = None, - justid: bool = False, - ): ... - async def xclaim( - self, - name, - groupname, - consumername, - min_idle_time, - message_ids, - idle=None, - time=None, - retrycount=None, - force=False, - justid=False, - ): ... - async def xdel(self, name: KeyT, *ids: str | int | bytes | memoryview): ... - async def xgroup_create(self, name, groupname, id: str = "$", mkstream: bool = False, entries_read: int | None = None): ... - async def xgroup_delconsumer(self, name, groupname, consumername): ... - async def xgroup_destroy(self, name, groupname): ... - async def xgroup_createconsumer(self, name, groupname, consumername): ... - async def xgroup_setid(self, name, groupname, id, entries_read: int | None = None): ... - async def xinfo_consumers(self, name, groupname): ... - async def xinfo_groups(self, name): ... - async def xinfo_stream(self, name, full: bool = False): ... - async def xlen(self, name: _Key) -> int: ... - async def xpending(self, name, groupname): ... - async def xpending_range( - self, name: _Key, groupname, min, max, count: int, consumername: Incomplete | None = None, idle: int | None = None - ): ... - async def xrange(self, name, min: str = "-", max: str = "+", count: Incomplete | None = None): ... - async def xread(self, streams, count: Incomplete | None = None, block: Incomplete | None = None): ... - async def xreadgroup( - self, - groupname, - consumername, - streams, - count: Incomplete | None = None, - block: Incomplete | None = None, - noack: bool = False, - ): ... - async def xrevrange(self, name, max: str = "+", min: str = "-", count: Incomplete | None = None): ... - async def xtrim( - self, name, maxlen: int | None = None, approximate: bool = True, minid: Incomplete | None = None, limit: int | None = None - ): ... - -class SortedSetCommands(Generic[_StrType]): - def zadd( - self, - name: _Key, - mapping: Mapping[_Key, _Value], - nx: bool = False, - xx: bool = False, - ch: bool = False, - incr: bool = False, - gt: Incomplete | None = False, - lt: Incomplete | None = False, - ) -> int: ... - def zcard(self, name: _Key) -> int: ... - def zcount(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zdiff(self, keys, withscores: bool = False): ... - def zdiffstore(self, dest, keys): ... - def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ... - def zinter(self, keys, aggregate: Incomplete | None = None, withscores: bool = False): ... - def zinterstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None) -> int: ... - def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zpopmax(self, name: _Key, count: int | None = None) -> list[tuple[_StrType, float]]: ... - def zpopmin(self, name: _Key, count: int | None = None) -> list[tuple[_StrType, float]]: ... - def zrandmember(self, key, count: Incomplete | None = None, withscores: bool = False): ... - @overload - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = 0) -> tuple[_StrType, _StrType, float]: ... - @overload - def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... - @overload - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = 0) -> tuple[_StrType, _StrType, float]: ... - @overload - def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... - @overload - def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - desc: bool, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - desc: bool, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], float] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, float]]: ... - @overload - def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], float] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, float]]: ... - @overload - def zrange( - self, - name: _Key, - start: int, - end: int, - desc: bool = False, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[_StrType]: ... - @overload - def zrevrange( - self, - name: _Key, - start: int, - end: int, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrevrange( # type: ignore[overload-overlap] - self, name: _Key, start: int, end: int, withscores: Literal[True] - ) -> list[tuple[_StrType, float]]: ... - @overload - def zrevrange( - self, name: _Key, start: int, end: int, withscores: bool = False, score_cast_func: Callable[[Any], Any] = ... - ) -> list[_StrType]: ... - def zrangestore( - self, - dest, - name, - start, - end, - byscore: bool = False, - bylex: bool = False, - desc: bool = False, - offset: Incomplete | None = None, - num: Incomplete | None = None, - ): ... - def zrangebylex( - self, name: _Key, min: _Value, max: _Value, start: int | None = None, num: int | None = None - ) -> list[_StrType]: ... - def zrevrangebylex( - self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None - ) -> list[_StrType]: ... - @overload - def zrangebyscore( # type: ignore[overload-overlap] - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = None, - num: int | None = None, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrangebyscore( # type: ignore[overload-overlap] - self, name: _Key, min: _Value, max: _Value, start: int | None = None, num: int | None = None, *, withscores: Literal[True] - ) -> list[tuple[_StrType, float]]: ... - @overload - def zrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> list[_StrType]: ... - @overload - def zrevrangebyscore( # type: ignore[overload-overlap] - self, - name: _Key, - max: _Value, - min: _Value, - start: int | None = None, - num: int | None = None, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - def zrevrangebyscore( # type: ignore[overload-overlap] - self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None, *, withscores: Literal[True] - ) -> list[tuple[_StrType, float]]: ... - @overload - def zrevrangebyscore( - self, - name: _Key, - max: _Value, - min: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> list[_StrType]: ... - def zrank(self, name: _Key, value: _Value, withscore: bool = False) -> int | None: ... - def zrem(self, name: _Key, *values: _Value) -> int: ... - def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ... - def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ... - def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> int | None: ... - def zscore(self, name: _Key, value: _Value) -> float | None: ... - def zunion(self, keys, aggregate: Incomplete | None = None, withscores: bool = False): ... - def zunionstore(self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None) -> int: ... - def zmscore(self, key, members): ... - -class AsyncSortedSetCommands(Generic[_StrType]): - async def zadd( - self, - name: _Key, - mapping: Mapping[_Key, _Value], - nx: bool = False, - xx: bool = False, - ch: bool = False, - incr: bool = False, - gt: Incomplete | None = False, - lt: Incomplete | None = False, - ) -> int: ... - async def zcard(self, name: _Key) -> int: ... - async def zcount(self, name: _Key, min: _Value, max: _Value) -> int: ... - async def zdiff(self, keys, withscores: bool = False): ... - async def zdiffstore(self, dest, keys): ... - async def zincrby(self, name: _Key, amount: float, value: _Value) -> float: ... - async def zinter(self, keys, aggregate: Incomplete | None = None, withscores: bool = False): ... - async def zinterstore( - self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None - ) -> int: ... - async def zlexcount(self, name: _Key, min: _Value, max: _Value) -> int: ... - async def zpopmax(self, name: _Key, count: int | None = None) -> list[tuple[_StrType, float]]: ... - async def zpopmin(self, name: _Key, count: int | None = None) -> list[tuple[_StrType, float]]: ... - async def zrandmember(self, key, count: Incomplete | None = None, withscores: bool = False): ... - @overload - async def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = 0) -> tuple[_StrType, _StrType, float]: ... - @overload - async def bzpopmax(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... - @overload - async def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: Literal[0] = 0) -> tuple[_StrType, _StrType, float]: ... - @overload - async def bzpopmin(self, keys: _Key | Iterable[_Key], timeout: float) -> tuple[_StrType, _StrType, float] | None: ... - @overload - async def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - desc: bool, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - async def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - desc: bool, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], float] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, float]]: ... - @overload - async def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - desc: bool = False, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - async def zrange( # type: ignore[overload-overlap] - self, - name: _Key, - start: int, - end: int, - desc: bool = False, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], float] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[tuple[_StrType, float]]: ... - @overload - async def zrange( - self, - name: _Key, - start: int, - end: int, - desc: bool = False, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - byscore: bool = False, - bylex: bool = False, - offset: int | None = None, - num: int | None = None, - ) -> list[_StrType]: ... - @overload - async def zrevrange( - self, - name: _Key, - start: int, - end: int, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - async def zrevrange( # type: ignore[overload-overlap] - self, name: _Key, start: int, end: int, withscores: Literal[True] - ) -> list[tuple[_StrType, float]]: ... - @overload - async def zrevrange( - self, name: _Key, start: int, end: int, withscores: bool = False, score_cast_func: Callable[[Any], Any] = ... - ) -> list[_StrType]: ... - async def zrangestore( - self, - dest, - name, - start, - end, - byscore: bool = False, - bylex: bool = False, - desc: bool = False, - offset: Incomplete | None = None, - num: Incomplete | None = None, - ): ... - async def zrangebylex( - self, name: _Key, min: _Value, max: _Value, start: int | None = None, num: int | None = None - ) -> list[_StrType]: ... - async def zrevrangebylex( - self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None - ) -> list[_StrType]: ... - @overload - async def zrangebyscore( # type: ignore[overload-overlap] - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = None, - num: int | None = None, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - async def zrangebyscore( # type: ignore[overload-overlap] - self, name: _Key, min: _Value, max: _Value, start: int | None = None, num: int | None = None, *, withscores: Literal[True] - ) -> list[tuple[_StrType, float]]: ... - @overload - async def zrangebyscore( - self, - name: _Key, - min: _Value, - max: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> list[_StrType]: ... - @overload - async def zrevrangebyscore( # type: ignore[overload-overlap] - self, - name: _Key, - max: _Value, - min: _Value, - start: int | None = None, - num: int | None = None, - *, - withscores: Literal[True], - score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn], - ) -> list[tuple[_StrType, _ScoreCastFuncReturn]]: ... - @overload - async def zrevrangebyscore( # type: ignore[overload-overlap] - self, name: _Key, max: _Value, min: _Value, start: int | None = None, num: int | None = None, *, withscores: Literal[True] - ) -> list[tuple[_StrType, float]]: ... - @overload - async def zrevrangebyscore( - self, - name: _Key, - max: _Value, - min: _Value, - start: int | None = None, - num: int | None = None, - withscores: bool = False, - score_cast_func: Callable[[_StrType], Any] = ..., - ) -> list[_StrType]: ... - async def zrank(self, name: _Key, value: _Value, withscore: bool = False) -> int | None: ... - async def zrem(self, name: _Key, *values: _Value) -> int: ... - async def zremrangebylex(self, name: _Key, min: _Value, max: _Value) -> int: ... - async def zremrangebyrank(self, name: _Key, min: int, max: int) -> int: ... - async def zremrangebyscore(self, name: _Key, min: _Value, max: _Value) -> int: ... - async def zrevrank(self, name: _Key, value: _Value, withscore: bool = False) -> int | None: ... - async def zscore(self, name: _Key, value: _Value) -> float | None: ... - async def zunion(self, keys, aggregate: Incomplete | None = None, withscores: bool = False): ... - async def zunionstore( - self, dest: _Key, keys: Iterable[_Key], aggregate: Literal["SUM", "MIN", "MAX"] | None = None - ) -> int: ... - async def zmscore(self, key, members): ... - -class HyperlogCommands: - def pfadd(self, name: _Key, *values: _Value) -> int: ... - def pfcount(self, name: _Key) -> int: ... - def pfmerge(self, dest: _Key, *sources: _Key) -> bool: ... - -class AsyncHyperlogCommands: - async def pfadd(self, name: _Key, *values: _Value) -> int: ... - async def pfcount(self, name: _Key) -> int: ... - async def pfmerge(self, dest: _Key, *sources: _Key) -> bool: ... - -class HashCommands(Generic[_StrType]): - def hdel(self, name: _Key, *keys: _Key) -> int: ... - def hexists(self, name: _Key, key: _Key) -> bool: ... - def hget(self, name: _Key, key: _Key) -> _StrType | None: ... - def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ... - def hincrby(self, name: _Key, key: _Key, amount: int = 1) -> int: ... - def hincrbyfloat(self, name: _Key, key: _Key, amount: float = 1.0) -> float: ... - def hkeys(self, name: _Key) -> list[_StrType]: ... - def hlen(self, name: _Key) -> int: ... - @overload - def hset( - self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = None, items: Incomplete | None = None - ) -> int: ... - @overload - def hset( - self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Incomplete | None = None - ) -> int: ... - @overload - def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Incomplete | None = None) -> int: ... - def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ... - def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ... - def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... - def hvals(self, name: _Key) -> list[_StrType]: ... - def hstrlen(self, name, key): ... - -class AsyncHashCommands(Generic[_StrType]): - async def hdel(self, name: _Key, *keys: _Key) -> int: ... - async def hexists(self, name: _Key, key: _Key) -> bool: ... - async def hget(self, name: _Key, key: _Key) -> _StrType | None: ... - async def hgetall(self, name: _Key) -> dict[_StrType, _StrType]: ... - async def hincrby(self, name: _Key, key: _Key, amount: int = 1) -> int: ... - async def hincrbyfloat(self, name: _Key, key: _Key, amount: float = 1.0) -> float: ... - async def hkeys(self, name: _Key) -> list[_StrType]: ... - async def hlen(self, name: _Key) -> int: ... - @overload - async def hset( - self, name: _Key, key: _Key, value: _Value, mapping: Mapping[_Key, _Value] | None = None, items: Incomplete | None = None - ) -> int: ... - @overload - async def hset( - self, name: _Key, key: None, value: None, mapping: Mapping[_Key, _Value], items: Incomplete | None = None - ) -> int: ... - @overload - async def hset(self, name: _Key, *, mapping: Mapping[_Key, _Value], items: Incomplete | None = None) -> int: ... - async def hsetnx(self, name: _Key, key: _Key, value: _Value) -> int: ... - async def hmset(self, name: _Key, mapping: Mapping[_Key, _Value]) -> bool: ... - async def hmget(self, name: _Key, keys: _Key | Iterable[_Key], *args: _Key) -> list[_StrType | None]: ... - async def hvals(self, name: _Key) -> list[_StrType]: ... - async def hstrlen(self, name, key): ... - -class AsyncScript: - def __init__(self, registered_client: AsyncRedis[Any], script: ScriptTextT) -> None: ... - async def __call__( - self, keys: Sequence[KeyT] | None = None, args: Iterable[EncodableT] | None = None, client: AsyncRedis[Any] | None = None - ): ... - -class PubSubCommands: - def publish(self, channel: _Key, message: _Key, **kwargs: _CommandOptions) -> int: ... - def pubsub_channels(self, pattern: _Key = "*", **kwargs: _CommandOptions) -> list[str]: ... - def pubsub_numpat(self, **kwargs: _CommandOptions) -> int: ... - def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> list[tuple[str, int]]: ... - -class AsyncPubSubCommands: - async def publish(self, channel: _Key, message: _Key, **kwargs: _CommandOptions) -> int: ... - async def pubsub_channels(self, pattern: _Key = "*", **kwargs: _CommandOptions) -> list[str]: ... - async def pubsub_numpat(self, **kwargs: _CommandOptions) -> int: ... - async def pubsub_numsub(self, *args: _Key, **kwargs: _CommandOptions) -> list[tuple[str, int]]: ... - -class ScriptCommands(Generic[_StrType]): - def eval(self, script, numkeys, *keys_and_args): ... - def evalsha(self, sha, numkeys, *keys_and_args): ... - def script_exists(self, *args): ... - def script_debug(self, *args): ... - def script_flush(self, sync_type: Incomplete | None = None): ... - def script_kill(self): ... - def script_load(self, script): ... - def register_script(self, script: str | _StrType) -> Script: ... - -class AsyncScriptCommands(Generic[_StrType]): - async def eval(self, script, numkeys, *keys_and_args): ... - async def evalsha(self, sha, numkeys, *keys_and_args): ... - async def script_exists(self, *args): ... - async def script_debug(self, *args): ... - async def script_flush(self, sync_type: Incomplete | None = None): ... - async def script_kill(self): ... - async def script_load(self, script): ... - def register_script(self, script: ScriptTextT) -> AsyncScript: ... - -class GeoCommands: - def geoadd(self, name, values, nx: bool = False, xx: bool = False, ch: bool = False): ... - def geodist(self, name, place1, place2, unit: Incomplete | None = None): ... - def geohash(self, name, *values): ... - def geopos(self, name, *values): ... - def georadius( - self, - name, - longitude, - latitude, - radius, - unit: Incomplete | None = None, - withdist: bool = False, - withcoord: bool = False, - withhash: bool = False, - count: Incomplete | None = None, - sort: Incomplete | None = None, - store: Incomplete | None = None, - store_dist: Incomplete | None = None, - any: bool = False, - ): ... - def georadiusbymember( - self, - name, - member, - radius, - unit: Incomplete | None = None, - withdist: bool = False, - withcoord: bool = False, - withhash: bool = False, - count: Incomplete | None = None, - sort: Incomplete | None = None, - store: Incomplete | None = None, - store_dist: Incomplete | None = None, - any: bool = False, - ): ... - def geosearch( - self, - name, - member: Incomplete | None = None, - longitude: Incomplete | None = None, - latitude: Incomplete | None = None, - unit: str = "m", - radius: Incomplete | None = None, - width: Incomplete | None = None, - height: Incomplete | None = None, - sort: Incomplete | None = None, - count: Incomplete | None = None, - any: bool = False, - withcoord: bool = False, - withdist: bool = False, - withhash: bool = False, - ): ... - def geosearchstore( - self, - dest, - name, - member: Incomplete | None = None, - longitude: Incomplete | None = None, - latitude: Incomplete | None = None, - unit: str = "m", - radius: Incomplete | None = None, - width: Incomplete | None = None, - height: Incomplete | None = None, - sort: Incomplete | None = None, - count: Incomplete | None = None, - any: bool = False, - storedist: bool = False, - ): ... - -class AsyncGeoCommands: - async def geoadd(self, name, values, nx: bool = False, xx: bool = False, ch: bool = False): ... - async def geodist(self, name, place1, place2, unit: Incomplete | None = None): ... - async def geohash(self, name, *values): ... - async def geopos(self, name, *values): ... - async def georadius( - self, - name, - longitude, - latitude, - radius, - unit: Incomplete | None = None, - withdist: bool = False, - withcoord: bool = False, - withhash: bool = False, - count: Incomplete | None = None, - sort: Incomplete | None = None, - store: Incomplete | None = None, - store_dist: Incomplete | None = None, - any: bool = False, - ): ... - async def georadiusbymember( - self, - name, - member, - radius, - unit: Incomplete | None = None, - withdist: bool = False, - withcoord: bool = False, - withhash: bool = False, - count: Incomplete | None = None, - sort: Incomplete | None = None, - store: Incomplete | None = None, - store_dist: Incomplete | None = None, - any: bool = False, - ): ... - async def geosearch( - self, - name, - member: Incomplete | None = None, - longitude: Incomplete | None = None, - latitude: Incomplete | None = None, - unit: str = "m", - radius: Incomplete | None = None, - width: Incomplete | None = None, - height: Incomplete | None = None, - sort: Incomplete | None = None, - count: Incomplete | None = None, - any: bool = False, - withcoord: bool = False, - withdist: bool = False, - withhash: bool = False, - ): ... - async def geosearchstore( - self, - dest, - name, - member: Incomplete | None = None, - longitude: Incomplete | None = None, - latitude: Incomplete | None = None, - unit: str = "m", - radius: Incomplete | None = None, - width: Incomplete | None = None, - height: Incomplete | None = None, - sort: Incomplete | None = None, - count: Incomplete | None = None, - any: bool = False, - storedist: bool = False, - ): ... - -class ModuleCommands: - def module_load(self, path, *args): ... - def module_unload(self, name): ... - def module_list(self): ... - def command_info(self): ... - def command_count(self): ... - def command_getkeys(self, *args): ... - def command(self): ... - -class Script: - def __init__(self, registered_client, script) -> None: ... - def __call__(self, keys=[], args=[], client: Incomplete | None = None): ... - -class BitFieldOperation: - def __init__(self, client, key, default_overflow: Incomplete | None = None): ... - def reset(self) -> None: ... - def overflow(self, overflow): ... - def incrby(self, fmt, offset, increment, overflow: Incomplete | None = None): ... - def get(self, fmt, offset): ... - def set(self, fmt, offset, value): ... - @property - def command(self): ... - def execute(self): ... - -class AsyncModuleCommands(ModuleCommands): - async def command_info(self) -> None: ... - -class ClusterCommands: - def cluster(self, cluster_arg: str, *args, **kwargs: _CommandOptions): ... - def readwrite(self, **kwargs: _CommandOptions) -> bool: ... - def readonly(self, **kwargs: _CommandOptions) -> bool: ... - -class AsyncClusterCommands: - async def cluster(self, cluster_arg: str, *args, **kwargs: _CommandOptions): ... - async def readwrite(self, **kwargs: _CommandOptions) -> bool: ... - async def readonly(self, **kwargs: _CommandOptions) -> bool: ... - -class FunctionCommands: - def function_load(self, code: str, replace: bool | None = False) -> Awaitable[str] | str: ... - def function_delete(self, library: str) -> Awaitable[str] | str: ... - def function_flush(self, mode: str = "SYNC") -> Awaitable[str] | str: ... - def function_list(self, library: str | None = "*", withcode: bool | None = False) -> Awaitable[list[Any]] | list[Any]: ... - def fcall(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... - def fcall_ro(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... - def function_dump(self) -> Awaitable[str] | str: ... - def function_restore(self, payload: str, policy: str | None = "APPEND") -> Awaitable[str] | str: ... - def function_kill(self) -> Awaitable[str] | str: ... - def function_stats(self) -> Awaitable[list[Any]] | list[Any]: ... - -class AsyncFunctionCommands: - async def function_load(self, code: str, replace: bool | None = False) -> Awaitable[str] | str: ... - async def function_delete(self, library: str) -> Awaitable[str] | str: ... - async def function_flush(self, mode: str = "SYNC") -> Awaitable[str] | str: ... - async def function_list( - self, library: str | None = "*", withcode: bool | None = False - ) -> Awaitable[list[Any]] | list[Any]: ... - async def fcall(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... - async def fcall_ro(self, function, numkeys: int, *keys_and_args: list[Any] | None) -> Awaitable[str] | str: ... - async def function_dump(self) -> Awaitable[str] | str: ... - async def function_restore(self, payload: str, policy: str | None = "APPEND") -> Awaitable[str] | str: ... - async def function_kill(self) -> Awaitable[str] | str: ... - async def function_stats(self) -> Awaitable[list[Any]] | list[Any]: ... - -class DataAccessCommands( - BasicKeyCommands[_StrType], - HyperlogCommands, - HashCommands[_StrType], - GeoCommands, - ListCommands[_StrType], - ScanCommands[_StrType], - SetCommands[_StrType], - StreamCommands, - SortedSetCommands[_StrType], -): ... -class AsyncDataAccessCommands( - AsyncBasicKeyCommands[_StrType], - AsyncHyperlogCommands, - AsyncHashCommands[_StrType], - AsyncGeoCommands, - AsyncListCommands[_StrType], - AsyncScanCommands[_StrType], - AsyncSetCommands[_StrType], - AsyncStreamCommands, - AsyncSortedSetCommands[_StrType], -): ... -class CoreCommands( - ACLCommands[_StrType], - ClusterCommands, - DataAccessCommands[_StrType], - ManagementCommands, - ModuleCommands, - PubSubCommands, - ScriptCommands[_StrType], -): ... -class AsyncCoreCommands( - AsyncACLCommands[_StrType], - AsyncClusterCommands, - AsyncDataAccessCommands[_StrType], - AsyncManagementCommands, - AsyncModuleCommands, - AsyncPubSubCommands, - AsyncScriptCommands[_StrType], - AsyncFunctionCommands, -): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/__init__.pyi deleted file mode 100644 index a8209b8dc7c1..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/__init__.pyi +++ /dev/null @@ -1,26 +0,0 @@ -from typing import Any - -from .commands import GraphCommands as GraphCommands -from .edge import Edge as Edge -from .node import Node as Node -from .path import Path as Path - -class Graph(GraphCommands): - NAME: Any - client: Any - execute_command: Any - nodes: Any - edges: Any - version: int - def __init__(self, client, name=...) -> None: ... - @property - def name(self): ... - def get_label(self, idx): ... - def get_relation(self, idx): ... - def get_property(self, idx): ... - def add_node(self, node) -> None: ... - def add_edge(self, edge) -> None: ... - def call_procedure(self, procedure, *args, read_only: bool = False, **kwagrs): ... - def labels(self): ... - def relationship_types(self): ... - def property_keys(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/commands.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/commands.pyi deleted file mode 100644 index b57418dddaed..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/commands.pyi +++ /dev/null @@ -1,25 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -class GraphCommands: - def commit(self): ... - version: Any - def query( - self, - q, - params: Incomplete | None = None, - timeout: Incomplete | None = None, - read_only: bool = False, - profile: bool = False, - ): ... - def merge(self, pattern): ... - def delete(self): ... - nodes: Any - edges: Any - def flush(self) -> None: ... - def explain(self, query, params: Incomplete | None = None): ... - def bulk(self, **kwargs) -> None: ... - def profile(self, query): ... - def slowlog(self): ... - def config(self, name, value: Incomplete | None = None, set: bool = False): ... - def list_keys(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/edge.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/edge.pyi deleted file mode 100644 index 3bd36b65f409..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/edge.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -class Edge: - id: Any - relation: Any - properties: Any - src_node: Any - dest_node: Any - def __init__( - self, src_node, relation, dest_node, edge_id: Incomplete | None = None, properties: Incomplete | None = None - ) -> None: ... - def to_string(self): ... - def __eq__(self, rhs): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/exceptions.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/exceptions.pyi deleted file mode 100644 index 6069e0555848..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/exceptions.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from typing import Any - -class VersionMismatchException(Exception): - version: Any - def __init__(self, version) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/node.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/node.pyi deleted file mode 100644 index e7a65537b130..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/node.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -class Node: - id: Any - alias: Any - label: Any - labels: Any - properties: Any - def __init__( - self, - node_id: Incomplete | None = None, - alias: Incomplete | None = None, - label: str | list[str] | None = None, - properties: Incomplete | None = None, - ) -> None: ... - def to_string(self): ... - def __eq__(self, rhs): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/path.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/path.pyi deleted file mode 100644 index 69106f89667b..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/path.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from typing import Any - -class Path: - append_type: Any - def __init__(self, nodes, edges) -> None: ... - @classmethod - def new_empty_path(cls): ... - def nodes(self): ... - def edges(self): ... - def get_node(self, index): ... - def get_relationship(self, index): ... - def first_node(self): ... - def last_node(self): ... - def edge_count(self): ... - def nodes_count(self): ... - def add_node(self, node): ... - def add_edge(self, edge): ... - def __eq__(self, other): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/query_result.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/query_result.pyi deleted file mode 100644 index d9f8b51418a0..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/graph/query_result.pyi +++ /dev/null @@ -1,74 +0,0 @@ -from typing import Any, ClassVar, Literal - -LABELS_ADDED: str -NODES_CREATED: str -NODES_DELETED: str -RELATIONSHIPS_DELETED: str -PROPERTIES_SET: str -RELATIONSHIPS_CREATED: str -INDICES_CREATED: str -INDICES_DELETED: str -CACHED_EXECUTION: str -INTERNAL_EXECUTION_TIME: str -STATS: Any - -class ResultSetColumnTypes: - COLUMN_UNKNOWN: ClassVar[Literal[0]] - COLUMN_SCALAR: ClassVar[Literal[1]] - COLUMN_NODE: ClassVar[Literal[2]] - COLUMN_RELATION: ClassVar[Literal[3]] - -class ResultSetScalarTypes: - VALUE_UNKNOWN: ClassVar[Literal[0]] - VALUE_NULL: ClassVar[Literal[1]] - VALUE_STRING: ClassVar[Literal[2]] - VALUE_INTEGER: ClassVar[Literal[3]] - VALUE_BOOLEAN: ClassVar[Literal[4]] - VALUE_DOUBLE: ClassVar[Literal[5]] - VALUE_ARRAY: ClassVar[Literal[6]] - VALUE_EDGE: ClassVar[Literal[7]] - VALUE_NODE: ClassVar[Literal[8]] - VALUE_PATH: ClassVar[Literal[9]] - VALUE_MAP: ClassVar[Literal[10]] - VALUE_POINT: ClassVar[Literal[11]] - -class QueryResult: - graph: Any - header: Any - result_set: Any - def __init__(self, graph, response, profile: bool = False) -> None: ... - def parse_results(self, raw_result_set) -> None: ... - statistics: Any - def parse_statistics(self, raw_statistics) -> None: ... - def parse_header(self, raw_result_set): ... - def parse_records(self, raw_result_set): ... - def parse_entity_properties(self, props): ... - def parse_string(self, cell): ... - def parse_node(self, cell): ... - def parse_edge(self, cell): ... - def parse_path(self, cell): ... - def parse_map(self, cell): ... - def parse_point(self, cell): ... - def parse_scalar(self, cell): ... - def parse_profile(self, response) -> None: ... - def is_empty(self): ... - @property - def labels_added(self): ... - @property - def nodes_created(self): ... - @property - def nodes_deleted(self): ... - @property - def properties_set(self): ... - @property - def relationships_created(self): ... - @property - def relationships_deleted(self): ... - @property - def indices_created(self): ... - @property - def indices_deleted(self): ... - @property - def cached_execution(self): ... - @property - def run_time_ms(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/helpers.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/helpers.pyi deleted file mode 100644 index b4e5ac7f7677..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/helpers.pyi +++ /dev/null @@ -1,10 +0,0 @@ -def list_or_args(keys, args): ... -def nativestr(x): ... -def delist(x): ... -def parse_to_list(response): ... -def parse_list_to_dict(response): ... -def parse_to_dict(response): ... -def random_string(length: int = 10) -> str: ... -def quote_string(v): ... -def decode_dict_keys(obj): ... -def stringify_param_value(value): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/__init__.pyi deleted file mode 100644 index f9e8825b9a9e..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/__init__.pyi +++ /dev/null @@ -1,15 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -from ...client import Pipeline as ClientPipeline -from .commands import JSONCommands - -class JSON(JSONCommands): - MODULE_CALLBACKS: dict[str, Any] - client: Any - execute_command: Any - MODULE_VERSION: Incomplete | None - def __init__(self, client, version: Incomplete | None = None, decoder=..., encoder=...) -> None: ... - def pipeline(self, transaction: bool = True, shard_hint: Incomplete | None = None) -> Pipeline: ... - -class Pipeline(JSONCommands, ClientPipeline[Incomplete]): ... # type: ignore[misc] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/commands.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/commands.pyi deleted file mode 100644 index 38d4d4c6c6a9..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/commands.pyi +++ /dev/null @@ -1,32 +0,0 @@ -from _typeshed import Incomplete - -class JSONCommands: - def arrappend(self, name: str, path: str | None = ".", *args) -> list[int | None]: ... - def arrindex( - self, name: str, path: str, scalar: int, start: int | None = None, stop: int | None = None - ) -> list[int | None]: ... - def arrinsert(self, name: str, path: str, index: int, *args) -> list[int | None]: ... - def arrlen(self, name: str, path: str | None = ".") -> list[int | None]: ... - def arrpop(self, name: str, path: str | None = ".", index: int | None = -1) -> list[str | None]: ... - def arrtrim(self, name: str, path: str, start: int, stop: int) -> list[int | None]: ... - def type(self, name: str, path: str | None = ".") -> list[str]: ... - def resp(self, name: str, path: str | None = ".") -> list[Incomplete]: ... - def objkeys(self, name, path="."): ... - def objlen(self, name, path="."): ... - def numincrby(self, name, path, number): ... - def nummultby(self, name, path, number): ... - def clear(self, name, path="."): ... - def delete(self, key, path="."): ... - forget = delete - def get(self, name, *args, no_escape: bool = False): ... - def mget(self, keys, path): ... - def set(self, name, path, obj, nx: bool = False, xx: bool = False, decode_keys: bool = False): ... - def set_file(self, name, path, file_name, nx: bool = False, xx: bool = False, decode_keys: bool = False): ... - def set_path(self, json_path, root_folder, nx: bool = False, xx: bool = False, decode_keys: bool = False): ... - def strlen(self, name, path: Incomplete | None = None): ... - def toggle(self, name, path="."): ... - def strappend(self, name, value, path="."): ... - def debug(self, subcommand, key: Incomplete | None = None, path="."): ... - def jsonget(self, *args, **kwargs): ... - def jsonmget(self, *args, **kwargs): ... - def jsonset(self, *args, **kwargs): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/decoders.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/decoders.pyi deleted file mode 100644 index ccea24386cb4..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/decoders.pyi +++ /dev/null @@ -1,4 +0,0 @@ -def bulk_of_jsons(d): ... -def decode_dict_keys(obj): ... -def unstring(obj): ... -def decode_list(b): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/path.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/path.pyi deleted file mode 100644 index bbc35c4f47ef..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/json/path.pyi +++ /dev/null @@ -1,5 +0,0 @@ -class Path: - strPath: str - @staticmethod - def root_path() -> str: ... - def __init__(self, path: str) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/parser.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/parser.pyi deleted file mode 100644 index f764908281bb..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/parser.pyi +++ /dev/null @@ -1,8 +0,0 @@ -from redis.client import AbstractRedis -from redis.typing import EncodableT - -class CommandsParser: - commands: dict[str, str] - def __init__(self, redis_connection: AbstractRedis) -> None: ... - def initialize(self, r: AbstractRedis) -> None: ... - def get_keys(self, redis_conn: AbstractRedis, *args: EncodableT) -> list[EncodableT] | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/redismodules.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/redismodules.pyi deleted file mode 100644 index 6de03ef3edd7..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/redismodules.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from .json import JSON -from .search import Search -from .timeseries import TimeSeries - -class RedisModuleCommands: - def json(self, encoder=..., decoder=...) -> JSON: ... - def ft(self, index_name: str = "idx") -> Search: ... - def ts(self) -> TimeSeries: ... - def bf(self): ... - def cf(self): ... - def cms(self): ... - def topk(self): ... - def tdigest(self): ... - def graph(self, index_name: str = "idx"): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/__init__.pyi deleted file mode 100644 index 3366d4516c95..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/__init__.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from _typeshed import Incomplete - -from .commands import SearchCommands - -class Search(SearchCommands): - class BatchIndexer: - def __init__(self, client, chunk_size: int = 1000) -> None: ... - def add_document( - self, - doc_id, - nosave: bool = False, - score: float = 1.0, - payload: Incomplete | None = None, - replace: bool = False, - partial: bool = False, - no_create: bool = False, - **fields, - ): ... - def add_document_hash(self, doc_id, score: float = 1.0, replace: bool = False): ... - def commit(self): ... - - def __init__(self, client, index_name: str = "idx") -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/aggregation.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/aggregation.pyi deleted file mode 100644 index 48bac2185cf7..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/aggregation.pyi +++ /dev/null @@ -1,53 +0,0 @@ -from typing import Any, ClassVar, Literal - -FIELDNAME: Any - -class Limit: - offset: Any - count: Any - def __init__(self, offset: int = 0, count: int = 0) -> None: ... - def build_args(self): ... - -class Reducer: - NAME: ClassVar[None] - def __init__(self, *args) -> None: ... - def alias(self, alias): ... - @property - def args(self): ... - -class SortDirection: - DIRSTRING: ClassVar[str | None] - field: Any - def __init__(self, field) -> None: ... - -class Asc(SortDirection): - DIRSTRING: ClassVar[Literal["ASC"]] - -class Desc(SortDirection): - DIRSTRING: ClassVar[Literal["DESC"]] - -class AggregateRequest: - def __init__(self, query: str = "*") -> None: ... - def load(self, *fields): ... - def group_by(self, fields, *reducers): ... - def apply(self, **kwexpr): ... - def limit(self, offset, num): ... - def sort_by(self, *fields, **kwargs): ... - def filter(self, expressions): ... - def with_schema(self): ... - def verbatim(self): ... - def cursor(self, count: int = 0, max_idle: float = 0.0): ... - def build_args(self): ... - -class Cursor: - cid: Any - max_idle: int - count: int - def __init__(self, cid) -> None: ... - def build_args(self): ... - -class AggregateResult: - rows: Any - cursor: Any - schema: Any - def __init__(self, rows, cursor, schema) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/commands.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/commands.pyi deleted file mode 100644 index f8a2baf3732f..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/commands.pyi +++ /dev/null @@ -1,111 +0,0 @@ -from _typeshed import Incomplete -from collections.abc import Mapping -from typing import Any, Literal -from typing_extensions import TypeAlias - -from .aggregation import AggregateRequest, AggregateResult, Cursor -from .query import Query -from .result import Result - -_QueryParams: TypeAlias = Mapping[str, str | float] - -NUMERIC: Literal["NUMERIC"] - -CREATE_CMD: Literal["FT.CREATE"] -ALTER_CMD: Literal["FT.ALTER"] -SEARCH_CMD: Literal["FT.SEARCH"] -ADD_CMD: Literal["FT.ADD"] -ADDHASH_CMD: Literal["FT.ADDHASH"] -DROP_CMD: Literal["FT.DROP"] -EXPLAIN_CMD: Literal["FT.EXPLAIN"] -EXPLAINCLI_CMD: Literal["FT.EXPLAINCLI"] -DEL_CMD: Literal["FT.DEL"] -AGGREGATE_CMD: Literal["FT.AGGREGATE"] -PROFILE_CMD: Literal["FT.PROFILE"] -CURSOR_CMD: Literal["FT.CURSOR"] -SPELLCHECK_CMD: Literal["FT.SPELLCHECK"] -DICT_ADD_CMD: Literal["FT.DICTADD"] -DICT_DEL_CMD: Literal["FT.DICTDEL"] -DICT_DUMP_CMD: Literal["FT.DICTDUMP"] -GET_CMD: Literal["FT.GET"] -MGET_CMD: Literal["FT.MGET"] -CONFIG_CMD: Literal["FT.CONFIG"] -TAGVALS_CMD: Literal["FT.TAGVALS"] -ALIAS_ADD_CMD: Literal["FT.ALIASADD"] -ALIAS_UPDATE_CMD: Literal["FT.ALIASUPDATE"] -ALIAS_DEL_CMD: Literal["FT.ALIASDEL"] -INFO_CMD: Literal["FT.INFO"] -SUGADD_COMMAND: Literal["FT.SUGADD"] -SUGDEL_COMMAND: Literal["FT.SUGDEL"] -SUGLEN_COMMAND: Literal["FT.SUGLEN"] -SUGGET_COMMAND: Literal["FT.SUGGET"] -SYNUPDATE_CMD: Literal["FT.SYNUPDATE"] -SYNDUMP_CMD: Literal["FT.SYNDUMP"] - -NOOFFSETS: Literal["NOOFFSETS"] -NOFIELDS: Literal["NOFIELDS"] -STOPWORDS: Literal["STOPWORDS"] -WITHSCORES: Literal["WITHSCORES"] -FUZZY: Literal["FUZZY"] -WITHPAYLOADS: Literal["WITHPAYLOADS"] - -class SearchCommands: - def batch_indexer(self, chunk_size: int = 100): ... - def create_index( - self, - fields, - no_term_offsets: bool = False, - no_field_flags: bool = False, - stopwords: Incomplete | None = None, - definition: Incomplete | None = None, - max_text_fields: bool = False, # added in 4.1.1 - temporary: Incomplete | None = None, # added in 4.1.1 - no_highlight: bool = False, # added in 4.1.1 - no_term_frequencies: bool = False, # added in 4.1.1 - skip_initial_scan: bool = False, # added in 4.1.1 - ): ... - def alter_schema_add(self, fields): ... - def dropindex(self, delete_documents: bool = False): ... - def add_document( - self, - doc_id, - nosave: bool = False, - score: float = 1.0, - payload: Incomplete | None = None, - replace: bool = False, - partial: bool = False, - language: Incomplete | None = None, - no_create: bool = False, - **fields, - ): ... - def add_document_hash(self, doc_id, score: float = 1.0, language: Incomplete | None = None, replace: bool = False): ... - def delete_document(self, doc_id, conn: Incomplete | None = None, delete_actual_document: bool = False): ... - def load_document(self, id): ... - def get(self, *ids): ... - def info(self): ... - def get_params_args(self, query_params: _QueryParams) -> list[Any]: ... - def search(self, query: str | Query, query_params: _QueryParams | None = None) -> Result: ... - def explain(self, query: str | Query, query_params: _QueryParams | None = None): ... - def explain_cli(self, query): ... - def aggregate(self, query: AggregateRequest | Cursor, query_params: _QueryParams | None = None) -> AggregateResult: ... - def profile( - self, query: str | Query | AggregateRequest, limited: bool = False, query_params: Mapping[str, str | float] | None = None - ) -> tuple[Incomplete, Incomplete]: ... - def spellcheck( - self, query, distance: Incomplete | None = None, include: Incomplete | None = None, exclude: Incomplete | None = None - ): ... - def dict_add(self, name, *terms): ... - def dict_del(self, name, *terms): ... - def dict_dump(self, name): ... - def config_set(self, option: str, value: str) -> bool: ... - def config_get(self, option: str) -> dict[str, str]: ... - def tagvals(self, tagfield): ... - def aliasadd(self, alias): ... - def aliasupdate(self, alias): ... - def aliasdel(self, alias): ... - def sugadd(self, key, *suggestions, **kwargs): ... - def suglen(self, key): ... - def sugdel(self, key, string): ... - def sugget(self, key, prefix, fuzzy: bool = False, num: int = 10, with_scores: bool = False, with_payloads: bool = False): ... - def synupdate(self, groupid, skipinitial: bool = False, *terms): ... - def syndump(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/query.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/query.pyi deleted file mode 100644 index eb1846bab957..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/query.pyi +++ /dev/null @@ -1,52 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -class Query: - def __init__(self, query_string) -> None: ... - def query_string(self): ... - def limit_ids(self, *ids): ... - def return_fields(self, *fields): ... - def return_field(self, field, as_field: Incomplete | None = None): ... - def summarize( - self, - fields: Incomplete | None = None, - context_len: Incomplete | None = None, - num_frags: Incomplete | None = None, - sep: Incomplete | None = None, - ): ... - def highlight(self, fields: Incomplete | None = None, tags: Incomplete | None = None): ... - def language(self, language): ... - def slop(self, slop): ... - def in_order(self): ... - def scorer(self, scorer): ... - def get_args(self): ... - def paging(self, offset, num): ... - def verbatim(self): ... - def no_content(self): ... - def no_stopwords(self): ... - def with_payloads(self): ... - def with_scores(self): ... - def limit_fields(self, *fields): ... - def add_filter(self, flt): ... - def sort_by(self, field, asc: bool = True): ... - def expander(self, expander): ... - -class Filter: - args: Any - def __init__(self, keyword, field, *args) -> None: ... - -class NumericFilter(Filter): - INF: str - NEG_INF: str - def __init__(self, field, minval, maxval, minExclusive: bool = False, maxExclusive: bool = False) -> None: ... - -class GeoFilter(Filter): - METERS: str - KILOMETERS: str - FEET: str - MILES: str - def __init__(self, field, lon, lat, radius, unit="km") -> None: ... - -class SortbyField: - args: Any - def __init__(self, field, asc: bool = True) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/result.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/result.pyi deleted file mode 100644 index 046c31705b5c..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/search/result.pyi +++ /dev/null @@ -1,7 +0,0 @@ -from typing import Any - -class Result: - total: Any - duration: Any - docs: Any - def __init__(self, res, hascontent, duration: int = 0, has_payload: bool = False, with_scores: bool = False) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/sentinel.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/sentinel.pyi deleted file mode 100644 index b526a45f14e3..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/sentinel.pyi +++ /dev/null @@ -1,17 +0,0 @@ -class SentinelCommands: - def sentinel(self, *args): ... - def sentinel_get_master_addr_by_name(self, service_name): ... - def sentinel_master(self, service_name): ... - def sentinel_masters(self): ... - def sentinel_monitor(self, name, ip, port, quorum): ... - def sentinel_remove(self, name): ... - def sentinel_sentinels(self, service_name): ... - def sentinel_set(self, name, option, value): ... - def sentinel_slaves(self, service_name): ... - def sentinel_reset(self, pattern): ... - def sentinel_failover(self, new_master_name): ... - def sentinel_ckquorum(self, new_master_name): ... - def sentinel_flushconfig(self): ... - -class AsyncSentinelCommands(SentinelCommands): - async def sentinel(self, *args) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/__init__.pyi deleted file mode 100644 index 95457d6fe4dd..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/__init__.pyi +++ /dev/null @@ -1,14 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -from ...client import Pipeline as ClientPipeline -from .commands import TimeSeriesCommands - -class TimeSeries(TimeSeriesCommands): - MODULE_CALLBACKS: dict[str, Any] - client: Any - execute_command: Any - def __init__(self, client: Incomplete | None = None, **kwargs) -> None: ... - def pipeline(self, transaction: bool = True, shard_hint: Incomplete | None = None) -> Pipeline: ... - -class Pipeline(TimeSeriesCommands, ClientPipeline[Incomplete]): ... # type: ignore[misc] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/commands.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/commands.pyi deleted file mode 100644 index ed70e575b971..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/commands.pyi +++ /dev/null @@ -1,160 +0,0 @@ -from typing import Literal -from typing_extensions import TypeAlias - -_Key: TypeAlias = bytes | str | memoryview - -ADD_CMD: Literal["TS.ADD"] -ALTER_CMD: Literal["TS.ALTER"] -CREATERULE_CMD: Literal["TS.CREATERULE"] -CREATE_CMD: Literal["TS.CREATE"] -DECRBY_CMD: Literal["TS.DECRBY"] -DELETERULE_CMD: Literal["TS.DELETERULE"] -DEL_CMD: Literal["TS.DEL"] -GET_CMD: Literal["TS.GET"] -INCRBY_CMD: Literal["TS.INCRBY"] -INFO_CMD: Literal["TS.INFO"] -MADD_CMD: Literal["TS.MADD"] -MGET_CMD: Literal["TS.MGET"] -MRANGE_CMD: Literal["TS.MRANGE"] -MREVRANGE_CMD: Literal["TS.MREVRANGE"] -QUERYINDEX_CMD: Literal["TS.QUERYINDEX"] -RANGE_CMD: Literal["TS.RANGE"] -REVRANGE_CMD: Literal["TS.REVRANGE"] - -class TimeSeriesCommands: - def create( - self, - key: _Key, - retention_msecs: int | None = None, - uncompressed: bool | None = False, - labels: dict[str, str] | None = None, - chunk_size: int | None = None, - duplicate_policy: str | None = None, - ): ... - def alter( - self, - key: _Key, - retention_msecs: int | None = None, - labels: dict[str, str] | None = None, - chunk_size: int | None = None, - duplicate_policy: str | None = None, - ): ... - def add( - self, - key: _Key, - timestamp: int | str, - value: float, - retention_msecs: int | None = None, - uncompressed: bool | None = False, - labels: dict[str, str] | None = None, - chunk_size: int | None = None, - duplicate_policy: str | None = None, - ): ... - def madd(self, ktv_tuples): ... - def incrby( - self, - key: _Key, - value: float, - timestamp: int | str | None = None, - retention_msecs: int | None = None, - uncompressed: bool | None = False, - labels: dict[str, str] | None = None, - chunk_size: int | None = None, - ): ... - def decrby( - self, - key: _Key, - value: float, - timestamp: int | str | None = None, - retention_msecs: int | None = None, - uncompressed: bool | None = False, - labels: dict[str, str] | None = None, - chunk_size: int | None = None, - ): ... - def delete(self, key, from_time, to_time): ... - def createrule( - self, source_key: _Key, dest_key: _Key, aggregation_type: str, bucket_size_msec: int, align_timestamp: int | None = None - ): ... - def deleterule(self, source_key, dest_key): ... - def range( - self, - key: _Key, - from_time: int | str, - to_time: int | str, - count: int | None = None, - aggregation_type: str | None = None, - bucket_size_msec: int | None = 0, - filter_by_ts: list[int] | None = None, - filter_by_min_value: int | None = None, - filter_by_max_value: int | None = None, - align: int | str | None = None, - latest: bool | None = False, - bucket_timestamp: str | None = None, - empty: bool | None = False, - ): ... - def revrange( - self, - key: _Key, - from_time: int | str, - to_time: int | str, - count: int | None = None, - aggregation_type: str | None = None, - bucket_size_msec: int | None = 0, - filter_by_ts: list[int] | None = None, - filter_by_min_value: int | None = None, - filter_by_max_value: int | None = None, - align: int | str | None = None, - latest: bool | None = False, - bucket_timestamp: str | None = None, - empty: bool | None = False, - ): ... - def mrange( - self, - from_time: int | str, - to_time: int | str, - filters: list[str], - count: int | None = None, - aggregation_type: str | None = None, - bucket_size_msec: int | None = 0, - with_labels: bool | None = False, - filter_by_ts: list[int] | None = None, - filter_by_min_value: int | None = None, - filter_by_max_value: int | None = None, - groupby: str | None = None, - reduce: str | None = None, - select_labels: list[str] | None = None, - align: int | str | None = None, - latest: bool | None = False, - bucket_timestamp: str | None = None, - empty: bool | None = False, - ): ... - def mrevrange( - self, - from_time: int | str, - to_time: int | str, - filters: list[str], - count: int | None = None, - aggregation_type: str | None = None, - bucket_size_msec: int | None = 0, - with_labels: bool | None = False, - filter_by_ts: list[int] | None = None, - filter_by_min_value: int | None = None, - filter_by_max_value: int | None = None, - groupby: str | None = None, - reduce: str | None = None, - select_labels: list[str] | None = None, - align: int | str | None = None, - latest: bool | None = False, - bucket_timestamp: str | None = None, - empty: bool | None = False, - ): ... - def get(self, key: _Key, latest: bool | None = False): ... - def mget( - self, - filters: list[str], - with_labels: bool | None = False, - select_labels: list[str] | None = None, - latest: bool | None = False, - ): ... - def info(self, key): ... - def queryindex(self, filters): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/info.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/info.pyi deleted file mode 100644 index 8b082c7d655e..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/info.pyi +++ /dev/null @@ -1,18 +0,0 @@ -from _typeshed import Incomplete -from typing import Any - -class TSInfo: - rules: list[Any] - labels: list[Any] - sourceKey: Incomplete | None - chunk_count: Incomplete | None - memory_usage: Incomplete | None - total_samples: Incomplete | None - retention_msecs: Incomplete | None - last_time_stamp: Incomplete | None - first_time_stamp: Incomplete | None - - max_samples_per_chunk: Incomplete | None - chunk_size: Incomplete | None - duplicate_policy: Incomplete | None - def __init__(self, args) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/utils.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/utils.pyi deleted file mode 100644 index 4a0d52c4d5cc..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/commands/timeseries/utils.pyi +++ /dev/null @@ -1,5 +0,0 @@ -def list_to_dict(aList): ... -def parse_range(response): ... -def parse_m_range(response): ... -def parse_get(response): ... -def parse_m_get(response): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/connection.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/connection.pyi deleted file mode 100644 index 5a8ae2195751..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/connection.pyi +++ /dev/null @@ -1,289 +0,0 @@ -from _typeshed import Incomplete, Unused -from abc import abstractmethod -from collections.abc import Callable, Iterable, Mapping -from queue import Queue -from socket import socket -from typing import Any, ClassVar -from typing_extensions import Self, TypeAlias - -from .credentials import CredentialProvider -from .retry import Retry - -ssl_available: bool -SYM_STAR: bytes -SYM_DOLLAR: bytes -SYM_CRLF: bytes -SYM_EMPTY: bytes -SERVER_CLOSED_CONNECTION_ERROR: str -NONBLOCKING_EXCEPTIONS: tuple[type[Exception], ...] -NONBLOCKING_EXCEPTION_ERROR_NUMBERS: dict[type[Exception], int] -SENTINEL: object -MODULE_LOAD_ERROR: str -NO_SUCH_MODULE_ERROR: str -MODULE_UNLOAD_NOT_POSSIBLE_ERROR: str -MODULE_EXPORTS_DATA_TYPES_ERROR: str -FALSE_STRINGS: tuple[str, ...] -URL_QUERY_ARGUMENT_PARSERS: dict[str, Callable[[Any], Any]] - -# Options as passed to Pool.get_connection(). -_ConnectionPoolOptions: TypeAlias = Any -_ConnectFunc: TypeAlias = Callable[[Connection], object] - -class BaseParser: - EXCEPTION_CLASSES: ClassVar[dict[str, type[Exception] | dict[str, type[Exception]]]] - @classmethod - def parse_error(cls, response: str) -> Exception: ... - -class SocketBuffer: - socket_read_size: int - bytes_written: int - bytes_read: int - socket_timeout: float | None - def __init__(self, socket: socket, socket_read_size: int, socket_timeout: float | None) -> None: ... - def unread_bytes(self) -> int: ... - def can_read(self, timeout: float | None) -> bool: ... - def read(self, length: int) -> bytes: ... - def readline(self) -> bytes: ... - def get_pos(self) -> int: ... - def rewind(self, pos: int) -> None: ... - def purge(self) -> None: ... - def close(self) -> None: ... - -class PythonParser(BaseParser): - encoding: str - socket_read_size: int - encoder: Encoder | None - def __init__(self, socket_read_size: int) -> None: ... - def __del__(self) -> None: ... - def on_connect(self, connection: Connection) -> None: ... - def on_disconnect(self) -> None: ... - def can_read(self, timeout: float | None) -> bool: ... - def read_response(self, disable_decoding: bool = False) -> Any: ... # `str | bytes` or `list[str | bytes]` - -class HiredisParser(BaseParser): - socket_read_size: int - def __init__(self, socket_read_size: int) -> None: ... - def __del__(self) -> None: ... - def on_connect(self, connection: Connection, **kwargs) -> None: ... - def on_disconnect(self) -> None: ... - def can_read(self, timeout: float | None) -> bool: ... - def read_from_socket(self, timeout: float | None = ..., raise_on_timeout: bool = True) -> bool: ... - def read_response(self, disable_decoding: bool = False) -> Any: ... # `str | bytes` or `list[str | bytes]` - -DefaultParser: type[BaseParser] # Hiredis or PythonParser - -_Encodable: TypeAlias = str | bytes | memoryview | bool | float - -class Encoder: - encoding: str - encoding_errors: str - decode_responses: bool - def __init__(self, encoding: str, encoding_errors: str, decode_responses: bool) -> None: ... - def encode(self, value: _Encodable) -> bytes: ... - def decode(self, value: str | bytes | memoryview, force: bool = False) -> str: ... - -class AbstractConnection: - pid: int - db: int - client_name: str | None - credential_provider: CredentialProvider | None - password: str | None - username: str | None - socket_timeout: float | None - socket_connect_timeout: float | None - retry_on_timeout: bool - retry_on_error: list[type[Exception]] - retry: Retry - health_check_interval: int - next_health_check: int - redis_connect_func: _ConnectFunc | None - encoder: Encoder - - def __init__( - self, - db: int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[Exception]] = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - command_packer: Incomplete | None = None, - ) -> None: ... - @abstractmethod - def repr_pieces(self) -> list[tuple[str, Any]]: ... - def register_connect_callback(self, callback: _ConnectFunc) -> None: ... - def clear_connect_callbacks(self) -> None: ... - def set_parser(self, parser_class: type[BaseParser]) -> None: ... - def connect(self) -> None: ... - def on_connect(self) -> None: ... - def disconnect(self, *args: Unused) -> None: ... # 'args' added in redis 4.1.2 - def check_health(self) -> None: ... - def send_packed_command(self, command: str | Iterable[str], check_health: bool = True) -> None: ... - def send_command(self, *args, **kwargs) -> None: ... - def can_read(self, timeout: float | None = 0) -> bool: ... - def read_response( - self, disable_decoding: bool = False, *, disconnect_on_error: bool = True - ) -> Any: ... # `str | bytes` or `list[str | bytes]` - def pack_command(self, *args) -> list[bytes]: ... - def pack_commands(self, commands: Iterable[Iterable[Incomplete]]) -> list[bytes]: ... - -class Connection(AbstractConnection): - host: str - port: int - socket_keepalive: bool - socket_keepalive_options: Mapping[str, int | str] - socket_type: int - def __init__( - self, - host: str = "localhost", - port: int = 6379, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[str, int | str] | None = None, - socket_type: int = 0, - *, - db: int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[Exception]] = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - command_packer: Incomplete | None = None, - ) -> None: ... - def repr_pieces(self) -> list[tuple[str, Any]]: ... - -class SSLConnection(Connection): - keyfile: Any - certfile: Any - cert_reqs: Any - ca_certs: Any - ca_path: Incomplete | None - check_hostname: bool - certificate_password: Incomplete | None - ssl_validate_ocsp: bool - ssl_validate_ocsp_stapled: bool # added in 4.1.1 - ssl_ocsp_context: Incomplete | None # added in 4.1.1 - ssl_ocsp_expected_cert: Incomplete | None # added in 4.1.1 - def __init__( - self, - ssl_keyfile=None, - ssl_certfile=None, - ssl_cert_reqs="required", - ssl_ca_certs=None, - ssl_ca_data: Incomplete | None = None, - ssl_check_hostname: bool = False, - ssl_ca_path: Incomplete | None = None, - ssl_password: Incomplete | None = None, - ssl_validate_ocsp: bool = False, - ssl_validate_ocsp_stapled: bool = False, # added in 4.1.1 - ssl_ocsp_context: Incomplete | None = None, # added in 4.1.1 - ssl_ocsp_expected_cert: Incomplete | None = None, # added in 4.1.1 - *, - host: str = "localhost", - port: int = 6379, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - socket_keepalive: bool = False, - socket_keepalive_options: Mapping[str, int | str] | None = None, - socket_type: int = 0, - db: int = 0, - password: str | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[Exception]] = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - command_packer: Incomplete | None = None, - ) -> None: ... - -class UnixDomainSocketConnection(AbstractConnection): - path: str - def __init__( - self, - path: str = "", - *, - db: int = 0, - password: str | None = None, - socket_timeout: float | None = None, - socket_connect_timeout: float | None = None, - retry_on_timeout: bool = False, - retry_on_error: list[type[Exception]] = ..., - encoding: str = "utf-8", - encoding_errors: str = "strict", - decode_responses: bool = False, - parser_class: type[BaseParser] = ..., - socket_read_size: int = 65536, - health_check_interval: int = 0, - client_name: str | None = None, - username: str | None = None, - retry: Retry | None = None, - redis_connect_func: _ConnectFunc | None = None, - credential_provider: CredentialProvider | None = None, - command_packer: Incomplete | None = None, - ) -> None: ... - def repr_pieces(self) -> list[tuple[str, Any]]: ... - -# TODO: make generic on `connection_class` -class ConnectionPool: - connection_class: type[Connection] - connection_kwargs: dict[str, Any] - max_connections: int - pid: int - @classmethod - def from_url(cls, url: str, *, db: int = ..., decode_components: bool = ..., **kwargs) -> Self: ... - def __init__( - self, connection_class: type[AbstractConnection] = ..., max_connections: int | None = None, **connection_kwargs - ) -> None: ... - def reset(self) -> None: ... - def get_connection(self, command_name: Unused, *keys, **options: _ConnectionPoolOptions) -> Connection: ... - def make_connection(self) -> Connection: ... - def release(self, connection: Connection) -> None: ... - def disconnect(self, inuse_connections: bool = True) -> None: ... - def get_encoder(self) -> Encoder: ... - def owns_connection(self, connection: Connection) -> bool: ... - -class BlockingConnectionPool(ConnectionPool): - queue_class: type[Queue[Any]] - timeout: float - pool: Queue[Connection | None] # might not be defined - def __init__( - self, - max_connections: int = 50, - timeout: float = 20, - connection_class: type[Connection] = ..., - queue_class: type[Queue[Any]] = ..., - **connection_kwargs, - ) -> None: ... - def disconnect(self) -> None: ... # type: ignore[override] - -def to_bool(value: object) -> bool: ... -def parse_url(url: str) -> dict[str, Any]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/crc.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/crc.pyi deleted file mode 100644 index cfd7e8fe83cf..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/crc.pyi +++ /dev/null @@ -1,5 +0,0 @@ -from redis.typing import EncodedT - -REDIS_CLUSTER_HASH_SLOTS: int - -def key_slot(key: EncodedT, bucket: int = 16384) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/credentials.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/credentials.pyi deleted file mode 100644 index 7a2d78ecb0cf..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/credentials.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from abc import abstractmethod - -class CredentialProvider: - @abstractmethod - def get_credentials(self) -> tuple[str] | tuple[str, str]: ... - -class UsernamePasswordCredentialProvider(CredentialProvider): - username: str - password: str - def __init__(self, username: str | None = None, password: str | None = None) -> None: ... - def get_credentials(self) -> tuple[str] | tuple[str, str]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/exceptions.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/exceptions.pyi deleted file mode 100644 index 1820d3d9163d..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/exceptions.pyi +++ /dev/null @@ -1,42 +0,0 @@ -class RedisError(Exception): ... -class AuthenticationError(RedisError): ... -class ConnectionError(RedisError): ... -class TimeoutError(RedisError): ... -class AuthorizationError(ConnectionError): ... -class BusyLoadingError(ConnectionError): ... -class InvalidResponse(RedisError): ... -class ResponseError(RedisError): ... -class DataError(RedisError): ... -class PubSubError(RedisError): ... -class WatchError(RedisError): ... -class NoScriptError(ResponseError): ... -class ExecAbortError(ResponseError): ... -class ReadOnlyError(ResponseError): ... -class NoPermissionError(ResponseError): ... -class ModuleError(ResponseError): ... -class LockError(RedisError, ValueError): ... -class LockNotOwnedError(LockError): ... -class ChildDeadlockedError(Exception): ... -class AuthenticationWrongNumberOfArgsError(ResponseError): ... -class RedisClusterException(Exception): ... -class ClusterError(RedisError): ... - -class ClusterDownError(ClusterError, ResponseError): - args: tuple[str] - message: str - def __init__(self, resp: str) -> None: ... - -class AskError(ResponseError): - args: tuple[str] - message: str - slot_id: int - node_addr: tuple[str, int] - host: str - port: int - def __init__(self, resp: str) -> None: ... - -class TryAgainError(ResponseError): ... -class ClusterCrossSlotError(ResponseError): ... -class MovedError(AskError): ... -class MasterDownError(ClusterDownError): ... -class SlotNotCoveredError(RedisClusterException): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/lock.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/lock.pyi deleted file mode 100644 index 3bbb410aed53..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/lock.pyi +++ /dev/null @@ -1,56 +0,0 @@ -from _typeshed import Incomplete -from types import TracebackType -from typing import Any, ClassVar, Protocol -from typing_extensions import Self - -from redis.client import Redis - -class _Local(Protocol): - token: str | bytes | None - -class Lock: - LUA_EXTEND_SCRIPT: ClassVar[str] - LUA_REACQUIRE_SCRIPT: ClassVar[str] - LUA_RELEASE_SCRIPT: ClassVar[str] - lua_extend: ClassVar[Incomplete | None] - lua_reacquire: ClassVar[Incomplete | None] - lua_release: ClassVar[Incomplete | None] - redis: Redis[Any] - name: str - timeout: float | None - sleep: float - blocking: bool - blocking_timeout: float | None - thread_local: bool - local: _Local - def __init__( - self, - redis: Redis[Any], - name: str, - timeout: float | None = None, - sleep: float = 0.1, - blocking: bool = True, - blocking_timeout: float | None = None, - thread_local: bool = True, - ) -> None: ... - def register_scripts(self) -> None: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None - ) -> bool | None: ... - def acquire( - self, - sleep: float | None = None, - blocking: bool | None = None, - blocking_timeout: float | None = None, - token: str | bytes | None = None, - ) -> bool: ... - def do_acquire(self, token: str | bytes) -> bool: ... - def locked(self) -> bool: ... - def owned(self) -> bool: ... - def release(self) -> None: ... - def do_release(self, expected_token: str | bytes) -> None: ... - def extend(self, additional_time: float, replace_ttl: bool = False) -> bool: ... - def do_extend(self, additional_time: float, replace_ttl: bool) -> bool: ... - def reacquire(self) -> bool: ... - def do_reacquire(self) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/ocsp.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/ocsp.pyi deleted file mode 100644 index 5fc72e08e073..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/ocsp.pyi +++ /dev/null @@ -1,21 +0,0 @@ -from _typeshed import Incomplete -from ssl import SSLObject, SSLSocket -from typing import Literal - -from cryptography.x509.base import Certificate -from OpenSSL.SSL import Connection - -def ocsp_staple_verifier(con: Connection, ocsp_bytes: bytes, expected: bytes | None = None) -> Literal[True]: ... - -class OCSPVerifier: - SOCK: SSLObject | SSLSocket - HOST: str - PORT: int - CA_CERTS: str | None - def __init__(self, sock: SSLObject | SSLSocket, host: str, port: int, ca_certs: str | None = None) -> None: ... - # cryptography.x509.general_name.GeneralName.value is typed as Any - def components_from_socket(self) -> tuple[Certificate, Incomplete | None, Incomplete]: ... - def components_from_direct_connection(self) -> tuple[Certificate, Incomplete | None, Incomplete]: ... - def build_certificate_url(self, server: str, cert: Certificate, issuer_cert: Certificate) -> str: ... - def check_certificate(self, server: str, cert: Certificate, issuer_url: str | bytes) -> Literal[True]: ... - def is_valid(self) -> Literal[True]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/retry.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/retry.pyi deleted file mode 100644 index ec20224e8756..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/retry.pyi +++ /dev/null @@ -1,11 +0,0 @@ -from collections.abc import Callable, Iterable -from typing import TypeVar - -from redis.backoff import AbstractBackoff - -_T = TypeVar("_T") - -class Retry: - def __init__(self, backoff: AbstractBackoff, retries: int, supported_errors: tuple[type[Exception], ...] = ...) -> None: ... - def update_supported_errors(self, specified_errors: Iterable[type[Exception]]) -> None: ... - def call_with_retry(self, do: Callable[[], _T], fail: Callable[[Exception], object]) -> _T: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/sentinel.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/sentinel.pyi deleted file mode 100644 index 843c2fa181ac..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/sentinel.pyi +++ /dev/null @@ -1,62 +0,0 @@ -from collections.abc import Iterable, Iterator -from typing import Any, Literal, TypeVar, overload -from typing_extensions import TypeAlias - -from redis.client import Redis -from redis.commands.sentinel import SentinelCommands -from redis.connection import Connection, ConnectionPool, SSLConnection -from redis.exceptions import ConnectionError - -_RedisT = TypeVar("_RedisT", bound=Redis[Any]) -_AddressAndPort: TypeAlias = tuple[str, int] -_SentinelState: TypeAlias = dict[str, Any] # TODO: this can be a TypedDict - -class MasterNotFoundError(ConnectionError): ... -class SlaveNotFoundError(ConnectionError): ... - -class SentinelManagedConnection(Connection): - connection_pool: SentinelConnectionPool - def __init__(self, *, connection_pool: SentinelConnectionPool, **kwargs) -> None: ... - def connect_to(self, address: _AddressAndPort) -> None: ... - def connect(self) -> None: ... - # The result can be either `str | bytes` or `list[str | bytes]` - def read_response(self, disable_decoding: bool = False, *, disconnect_on_error: bool = False) -> Any: ... - -class SentinelManagedSSLConnection(SentinelManagedConnection, SSLConnection): ... - -class SentinelConnectionPool(ConnectionPool): - is_master: bool - check_connection: bool - service_name: str - sentinel_manager: Sentinel - def __init__(self, service_name: str, sentinel_manager: Sentinel, **kwargs) -> None: ... - def reset(self) -> None: ... - def owns_connection(self, connection: Connection) -> bool: ... - def get_master_address(self) -> _AddressAndPort: ... - def rotate_slaves(self) -> Iterator[_AddressAndPort]: ... - -class Sentinel(SentinelCommands): - sentinel_kwargs: dict[str, Any] - sentinels: list[Redis[Any]] - min_other_sentinels: int - connection_kwargs: dict[str, Any] - def __init__( - self, - sentinels: Iterable[_AddressAndPort], - min_other_sentinels: int = 0, - sentinel_kwargs: dict[str, Any] | None = None, - **connection_kwargs, - ) -> None: ... - def check_master_state(self, state: _SentinelState, service_name: str) -> bool: ... - def discover_master(self, service_name: str) -> _AddressAndPort: ... - def filter_slaves(self, slaves: Iterable[_SentinelState]) -> list[_AddressAndPort]: ... - def discover_slaves(self, service_name: str) -> list[_AddressAndPort]: ... - @overload - def master_for(self, service_name: str, *, connection_pool_class=..., **kwargs) -> Redis[Any]: ... - @overload - def master_for(self, service_name: str, redis_class: type[_RedisT], connection_pool_class=..., **kwargs) -> _RedisT: ... - @overload - def slave_for(self, service_name: str, *, connection_pool_class=..., **kwargs) -> Redis[Any]: ... - @overload - def slave_for(self, service_name: str, redis_class: type[_RedisT], connection_pool_class=..., **kwargs) -> _RedisT: ... - def execute_command(self, *args, **kwargs) -> Literal[True]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/typing.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/typing.pyi deleted file mode 100644 index 304a35c4548b..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/typing.pyi +++ /dev/null @@ -1,34 +0,0 @@ -from collections.abc import Iterable -from datetime import datetime, timedelta -from typing import Any, Protocol, TypeVar -from typing_extensions import TypeAlias - -from redis.asyncio.connection import ConnectionPool as AsyncConnectionPool -from redis.connection import ConnectionPool - -# The following type aliases exist at runtime. -EncodedT: TypeAlias = bytes | memoryview -DecodedT: TypeAlias = str | int | float -EncodableT: TypeAlias = EncodedT | DecodedT -AbsExpiryT: TypeAlias = int | datetime -ExpiryT: TypeAlias = int | timedelta -ZScoreBoundT: TypeAlias = float | str -BitfieldOffsetT: TypeAlias = int | str -_StringLikeT: TypeAlias = bytes | str | memoryview # noqa: Y043 -KeyT: TypeAlias = _StringLikeT -PatternT: TypeAlias = _StringLikeT -FieldT: TypeAlias = EncodableT -KeysT: TypeAlias = KeyT | Iterable[KeyT] -ChannelT: TypeAlias = _StringLikeT -GroupT: TypeAlias = _StringLikeT -ConsumerT: TypeAlias = _StringLikeT -StreamIdT: TypeAlias = int | _StringLikeT -ScriptTextT: TypeAlias = _StringLikeT -TimeoutSecT: TypeAlias = int | float | _StringLikeT -AnyKeyT = TypeVar("AnyKeyT", bytes, str, memoryview) # noqa: Y001 -AnyFieldT = TypeVar("AnyFieldT", bytes, str, memoryview) # noqa: Y001 -AnyChannelT = TypeVar("AnyChannelT", bytes, str, memoryview) # noqa: Y001 - -class CommandsProtocol(Protocol): - connection_pool: AsyncConnectionPool[Any] | ConnectionPool - def execute_command(self, *args, **options): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/utils.pyi b/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/utils.pyi deleted file mode 100644 index 87194a8427bb..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/redis/redis/utils.pyi +++ /dev/null @@ -1,22 +0,0 @@ -from _typeshed import Unused -from collections.abc import Iterable, Mapping -from contextlib import AbstractContextManager -from typing import Any, Literal, TypeVar, overload - -from .client import Pipeline, Redis, _StrType - -_T = TypeVar("_T") - -HIREDIS_AVAILABLE: bool -CRYPTOGRAPHY_AVAILABLE: bool - -@overload -def from_url(url: str, *, db: int = ..., decode_responses: Literal[True], **kwargs: Any) -> Redis[str]: ... -@overload -def from_url(url: str, *, db: int = ..., decode_responses: Literal[False] = False, **kwargs: Any) -> Redis[bytes]: ... -def pipeline(redis_obj: Redis[_StrType]) -> AbstractContextManager[Pipeline[_StrType]]: ... -def str_if_bytes(value: str | bytes) -> str: ... -def safe_str(value: object) -> str: ... -def dict_merge(*dicts: Mapping[str, _T]) -> dict[str, _T]: ... -def list_keys_to_dict(key_list, callback): ... # unused, alias for `dict.fromkeys` -def merge_result(command: Unused, res: Mapping[Any, Iterable[_T]]) -> list[_T]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/requests-oauthlib/requests_oauthlib/oauth1_auth.pyi b/packages/pyright-internal/typeshed-fallback/stubs/requests-oauthlib/requests_oauthlib/oauth1_auth.pyi index 2db50b97e4b3..d5fcd8ace105 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/requests-oauthlib/requests_oauthlib/oauth1_auth.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/requests-oauthlib/requests_oauthlib/oauth1_auth.pyi @@ -23,7 +23,7 @@ class OAuth1(AuthBase): signature_type="AUTH_HEADER", rsa_key: Incomplete | None = None, verifier: Incomplete | None = None, - decoding: str = "utf-8", + decoding: str | None = "utf-8", client_class: type[Client] | None = None, force_include_body: bool = False, *, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml index 6e08e2f6d1bd..617bc4ef5ec8 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml @@ -1,14 +1,4 @@ version = "0.13.2" # Requires a version of numpy and matplotlib with a `py.typed` file -# -# TODO: Specifying the python-version for matplotlib should not be necessary, -# because of the requires_python field. However, this needs changes to -# get_typeshed_stub_version.py (see there). -requires = [ - "matplotlib>=3.8; python_version>='3.9'", - "numpy>=1.20", - "pandas-stubs", -] -# matplotlib>=3.8 requires Python >=3.9 -requires_python = ">=3.9" +requires = ["matplotlib>=3.8", "numpy>=1.20", "pandas-stubs"] upstream_repository = "https://github.com/mwaskom/seaborn" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/seaborn/seaborn/algorithms.pyi b/packages/pyright-internal/typeshed-fallback/stubs/seaborn/seaborn/algorithms.pyi index 85bd6ab68284..d413cdee161c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/seaborn/seaborn/algorithms.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/seaborn/seaborn/algorithms.pyi @@ -1,22 +1,22 @@ from collections.abc import Callable -from typing import Any +from typing import Any, overload +from typing_extensions import deprecated from numpy.typing import ArrayLike, NDArray from .utils import _Seed -# TODO: This crashes stubtest. Uncomment when mypy 1.8 is released with the fix https://github.com/python/mypy/pull/16457 -# @overload -# def bootstrap( -# *args: ArrayLike, -# n_boot: int = 10000, -# func: str | Callable[..., Any] = "mean", -# axis: int | None = None, -# units: ArrayLike | None = None, -# seed: _Seed | None = None, -# ) -> NDArray[Any]: ... -# @overload -# @deprecated("Parameter `random_seed` is deprecated in favor of `seed`") +@overload +def bootstrap( + *args: ArrayLike, + n_boot: int = 10000, + func: str | Callable[..., Any] = "mean", + axis: int | None = None, + units: ArrayLike | None = None, + seed: _Seed | None = None, +) -> NDArray[Any]: ... +@overload +@deprecated("Parameter `random_seed` is deprecated in favor of `seed`") def bootstrap( *args: ArrayLike, n_boot: int = 10000, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml index 8b7ea28be095..2c4861bf93f4 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml @@ -1,4 +1,4 @@ -version = "75.6.*" +version = "75.8.*" upstream_repository = "https://github.com/pypa/setuptools" extra_description = """\ If using `setuptools >= 71.1` *only* for `pkg_resources`, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi index 5fb3f42316bf..2c22e460989c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/cmd.pyi @@ -16,6 +16,11 @@ class Command: distribution: Distribution # Any to work around variance issues sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]] + user_options: ClassVar[ + # Specifying both because list is invariant. Avoids mypy override assignment issues + list[tuple[str, str, str]] + | list[tuple[str, str | None, str]] + ] def __init__(self, dist: Distribution) -> None: ... def ensure_finalized(self) -> None: ... @abstractmethod diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/bdist.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/bdist.pyi index 0d699298314b..95944c0c9750 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/bdist.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/bdist.pyi @@ -13,7 +13,7 @@ class ListCompat(dict[str, tuple[str, str]]): class bdist(Command): description: ClassVar[str] - user_options: ClassVar[list[tuple[str, str | None, str | None]]] + user_options: ClassVar[list[tuple[str, str | None, str]]] boolean_options: ClassVar[list[str]] help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]] no_format_option: ClassVar[tuple[str, ...]] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/install_data.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/install_data.pyi index b18b100068b4..dd9abc9af594 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/install_data.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/command/install_data.pyi @@ -1,10 +1,11 @@ from _typeshed import Incomplete +from typing import ClassVar from ..cmd import Command class install_data(Command): description: str - user_options: Incomplete + user_options: ClassVar[list[tuple[str, str | None, str]]] boolean_options: Incomplete install_dir: Incomplete outfiles: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/dist.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/dist.pyi index 969573e48b32..ab09b24d7f02 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/dist.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/dist.pyi @@ -152,24 +152,24 @@ class Distribution: def get_obsoletes(self) -> list[str]: ... # Default attributes generated in __init__ from self.display_option_names - help_commands: bool | Literal[0] - name: str | Literal[0] - version: str | Literal[0] - fullname: str | Literal[0] - author: str | Literal[0] - author_email: str | Literal[0] - maintainer: str | Literal[0] - maintainer_email: str | Literal[0] - contact: str | Literal[0] - contact_email: str | Literal[0] - url: str | Literal[0] - license: str | Literal[0] - licence: str | Literal[0] - description: str | Literal[0] - long_description: str | Literal[0] - platforms: str | list[str] | Literal[0] - classifiers: str | list[str] | Literal[0] - keywords: str | list[str] | Literal[0] - provides: list[str] | Literal[0] - requires: list[str] | Literal[0] - obsoletes: list[str] | Literal[0] + help_commands: bool + name: str | Literal[False] + version: str | Literal[False] + fullname: str | Literal[False] + author: str | Literal[False] + author_email: str | Literal[False] + maintainer: str | Literal[False] + maintainer_email: str | Literal[False] + contact: str | Literal[False] + contact_email: str | Literal[False] + url: str | Literal[False] + license: str | Literal[False] + licence: str | Literal[False] + description: str | Literal[False] + long_description: str | Literal[False] + platforms: str | list[str] | Literal[False] + classifiers: str | list[str] | Literal[False] + keywords: str | list[str] | Literal[False] + provides: list[str] | Literal[False] + requires: list[str] | Literal[False] + obsoletes: list[str] | Literal[False] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/extension.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/extension.pyi index 970c70a64437..1aee26696a94 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/extension.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/_distutils/extension.pyi @@ -1,10 +1,9 @@ from _typeshed import StrPath -from os import PathLike -from pathlib import Path +from collections.abc import Iterable class Extension: name: str - sources: list[str] | list[StrPath] + sources: list[str] include_dirs: list[str] define_macros: list[tuple[str, str | None]] undef_macros: list[str] @@ -22,7 +21,7 @@ class Extension: def __init__( self, name: str, - sources: list[str] | list[PathLike[str]] | list[Path] | list[StrPath], + sources: Iterable[StrPath], include_dirs: list[str] | None = None, define_macros: list[tuple[str, str | None]] | None = None, undef_macros: list[str] | None = None, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py310.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py310.pyi deleted file mode 100644 index 9e27329c7d96..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py310.pyi +++ /dev/null @@ -1,9 +0,0 @@ -import sys - -__all__ = ["tomllib"] - -if sys.version_info >= (3, 11): - import tomllib -else: - # This is actually vendored - import tomli as tomllib # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py311.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py311.pyi deleted file mode 100644 index a71f08223eb5..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py311.pyi +++ /dev/null @@ -1,4 +0,0 @@ -from _typeshed import StrOrBytesPath -from shutil import _OnExcCallback - -def shutil_rmtree(path: StrOrBytesPath, ignore_errors: bool = False, onexc: _OnExcCallback | None = None) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py312.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py312.pyi deleted file mode 100644 index 0b3a667177e4..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py312.pyi +++ /dev/null @@ -1,3 +0,0 @@ -from typing import Final - -PTH_ENCODING: Final[str | None] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py39.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py39.pyi deleted file mode 100644 index 06fd40663b10..000000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py39.pyi +++ /dev/null @@ -1,7 +0,0 @@ -import sys -from typing import Final - -if sys.version_info >= (3, 10): - LOCALE_ENCODING: Final = "locale" -else: - LOCALE_ENCODING: Final = None diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/extension.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/extension.pyi index 300a51b6a7b0..0f9c99214ad2 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/extension.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/extension.pyi @@ -1,6 +1,5 @@ from _typeshed import StrPath -from os import PathLike -from pathlib import Path +from collections.abc import Iterable from ._distutils.extension import Extension as _Extension @@ -11,7 +10,7 @@ class Extension(_Extension): def __init__( self, name: str, - sources: list[str] | list[PathLike[str]] | list[Path] | list[StrPath], + sources: Iterable[StrPath], include_dirs: list[str] | None = None, define_macros: list[tuple[str, str | None]] | None = None, undef_macros: list[str] | None = None, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_enum.pyi b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_enum.pyi index 130510da9841..c36e15fed401 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_enum.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_enum.pyi @@ -1,5 +1,5 @@ from enum import IntEnum -class ParamEnum(IntEnum): +class ParamEnum(IntEnum): # type: ignore[misc] # Enum with no members @classmethod def get_value(cls, item: str) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/six/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/six/METADATA.toml index 1e209ddf8e10..81454f85efcb 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/six/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/six/METADATA.toml @@ -1,2 +1,2 @@ -version = "1.16.*" +version = "1.17.*" upstream_repository = "https://github.com/benjaminp/six" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tabulate/tabulate/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/tabulate/tabulate/__init__.pyi index 383c29242ea6..f258717ad56f 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/tabulate/tabulate/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/tabulate/tabulate/__init__.pyi @@ -44,7 +44,8 @@ multiline_formats: dict[str, str] def simple_separated_format(separator: str) -> TableFormat: ... def tabulate( - tabular_data: Mapping[str, Iterable[Any]] | Iterable[Iterable[Any]], + # The key is converted using str(). + tabular_data: Mapping[Any, Iterable[Any]] | Iterable[Iterable[Any]], headers: str | dict[str, str] | Sequence[str] = (), tablefmt: str | TableFormat = "simple", floatfmt: str | Iterable[str] = "g", diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/asyncio.pyi b/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/asyncio.pyi index bef9dc177f29..ca28b90f0df7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/asyncio.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/tqdm/tqdm/asyncio.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete, SupportsWrite -from collections.abc import Awaitable, Callable, Generator, Iterable, Iterator, Mapping +from collections.abc import AsyncIterator, Awaitable, Callable, Generator, Iterable, Iterator, Mapping from typing import NoReturn, TypeVar, overload from typing_extensions import Self @@ -84,7 +84,7 @@ class tqdm_asyncio(std_tqdm[_T]): @overload def __init__( self, - iterable: Iterable[_T], + iterable: Iterable[_T] | AsyncIterator[_T], desc: str | None = ..., total: float | None = ..., leave: bool | None = ..., diff --git a/packages/pyright-internal/typeshed-fallback/stubs/vobject/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/vobject/METADATA.toml index 9f14a75bf6ed..aa38629db388 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/vobject/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/vobject/METADATA.toml @@ -1,2 +1,2 @@ -version = "0.9.*" -upstream_repository = "https://github.com/eventable/vobject" +version = "~=0.9.9" +upstream_repository = "https://github.com/py-vobject/vobject" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/__init__.pyi index eb51038c1ba0..f2c0c922b49b 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/__init__.pyi @@ -1,8 +1,6 @@ -from typing import Final +from .base import VERSION as VERSION, Component -from .base import Component +__version__ = VERSION def iCalendar() -> Component: ... def vCard() -> Component: ... - -VERSION: Final[str] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/base.pyi b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/base.pyi index 21870581ceee..11cc2cf30e13 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/base.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/base.pyi @@ -1,7 +1,10 @@ import logging from _typeshed import Incomplete, SupportsWrite from collections.abc import Iterable, Iterator -from typing import Any, Literal, TypeVar, overload +from typing import Any, Final, Literal, TypeVar, overload + +_V = TypeVar("_V", bound=VBase) +_W = TypeVar("_W", bound=SupportsWrite[bytes]) logger: logging.Logger DEBUG: bool @@ -12,8 +15,7 @@ SPACE: str TAB: str SPACEORTAB: str -_V = TypeVar("_V", bound=VBase) -_W = TypeVar("_W", bound=SupportsWrite[bytes]) +VERSION: Final[str] class VBase: group: Incomplete | None @@ -23,7 +25,7 @@ class VBase: def __init__(self, group: Incomplete | None = None) -> None: ... def copy(self, copyit: VBase) -> None: ... def validate(self, *args, **kwds) -> bool: ... - def getChildren(self) -> list[Any]: ... + def getChildren(self) -> list[Incomplete]: ... def clearBehavior(self, cascade: bool = True) -> None: ... def autoBehavior(self, cascade: bool = False) -> None: ... def setBehavior(self, behavior, cascade: bool = True) -> None: ... @@ -50,13 +52,13 @@ class VBase: def toVName(name, stripNum: int = 0, upper: bool = False): ... class ContentLine(VBase): - name: Any - encoded: Any - params: Any - singletonparams: Any - isNative: Any - lineNumber: Any - value: Any + name: Incomplete + encoded: Incomplete + params: Incomplete + singletonparams: Incomplete + isNative: Incomplete + lineNumber: Incomplete + value: Incomplete def __init__( self, name, @@ -82,7 +84,7 @@ class ContentLine(VBase): class Component(VBase): contents: dict[str, list[VBase]] - name: Any + name: Incomplete useBegin: bool def __init__(self, name: Incomplete | None = None, *args, **kwds) -> None: ... @classmethod @@ -90,7 +92,7 @@ class Component(VBase): def copy(self, copyit) -> None: ... def setProfile(self, name) -> None: ... def __getattr__(self, name: str): ... - normal_attributes: Any + normal_attributes: Incomplete def __setattr__(self, name: str, value) -> None: ... def __delattr__(self, name: str) -> None: ... def getChildValue(self, childName, default: Incomplete | None = None, childNumber: int = 0): ... @@ -105,7 +107,7 @@ class Component(VBase): @overload def add(self, objOrName: str, group: str | None = None) -> Any: ... # returns VBase sub-class def remove(self, obj) -> None: ... - def getChildren(self) -> list[Any]: ... + def getChildren(self) -> list[Incomplete]: ... def components(self) -> Iterable[Component]: ... def lines(self): ... def sortChildKeys(self): ... @@ -116,25 +118,25 @@ class Component(VBase): def prettyPrint(self, level: int = 0, tabwidth: int = 3) -> None: ... class VObjectError(Exception): - msg: Any - lineNumber: Any + msg: Incomplete + lineNumber: Incomplete def __init__(self, msg, lineNumber: Incomplete | None = None) -> None: ... class ParseError(VObjectError): ... class ValidateError(VObjectError): ... class NativeError(VObjectError): ... -patterns: Any -param_values_re: Any -params_re: Any -line_re: Any -begin_re: Any +patterns: Incomplete +param_values_re: Incomplete +params_re: Incomplete +line_re: Incomplete +begin_re: Incomplete def parseParams(string): ... def parseLine(line, lineNumber: Incomplete | None = None): ... -wrap_re: Any -logical_lines_re: Any +wrap_re: Incomplete +logical_lines_re: Incomplete testLines: str def getLogicalLines(fp, allowQP: bool = True) -> None: ... @@ -144,7 +146,7 @@ def foldOneLine(outbuf, input, lineLength: int = 75) -> None: ... def defaultSerialize(obj, buf, lineLength): ... class Stack: - stack: Any + stack: Incomplete def __len__(self) -> int: ... def top(self): ... def topName(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/behavior.pyi b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/behavior.pyi index 25cde219e859..3ca757bcaa32 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/behavior.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/behavior.pyi @@ -1,17 +1,18 @@ -from typing import Any +from _typeshed import Incomplete +from typing import ClassVar class Behavior: name: str description: str versionString: str - knownChildren: Any + knownChildren: ClassVar[dict[str, tuple[int, int | None, int | None]]] quotedPrintable: bool - defaultBehavior: Any + defaultBehavior: Incomplete hasNative: bool isComponent: bool allowGroup: bool forceUTC: bool - sortFirst: Any + sortFirst: Incomplete @classmethod def validate(cls, obj, raiseException: bool = False, complainUnrecognized: bool = False): ... @classmethod diff --git a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/icalendar.pyi b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/icalendar.pyi index 75dff2e523f5..0071b69745f3 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/icalendar.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/icalendar.pyi @@ -1,18 +1,19 @@ +import datetime from _typeshed import Incomplete from datetime import timedelta -from typing import Any +from typing import Any, Final from .base import Component from .behavior import Behavior -DATENAMES: tuple[str, ...] -RULENAMES: tuple[str, ...] -DATESANDRULES: tuple[str, ...] -PRODID: str -WEEKDAYS: tuple[str, ...] -FREQUENCIES: tuple[str, ...] -zeroDelta: timedelta -twoHours: timedelta +DATENAMES: Final[tuple[str, ...]] +RULENAMES: Final[tuple[str, ...]] +DATESANDRULES: Final[tuple[str, ...]] +PRODID: Final[str] +WEEKDAYS: Final[tuple[str, ...]] +FREQUENCIES: Final[tuple[str, ...]] +ZERO_DELTA: Final[timedelta] +twoHours: Final[timedelta] def toUnicode(s: str | bytes) -> str: ... def registerTzid(tzid, tzinfo) -> None: ... @@ -22,19 +23,19 @@ utc: Any # dateutil.tz.tz.tzutc class TimezoneComponent(Component): isNative: bool - behavior: Any - tzinfo: Any + behavior: Incomplete + tzinfo: Incomplete name: str useBegin: bool def __init__(self, tzinfo: Incomplete | None = None, *args, **kwds) -> None: ... @classmethod def registerTzinfo(cls, tzinfo): ... def gettzinfo(self): ... - tzid: Any - daylight: Any - standard: Any + tzid: Incomplete + daylight: Incomplete + standard: Incomplete def settzinfo(self, tzinfo, start: int = 2000, end: int = 2030): ... - normal_attributes: Any + normal_attributes: Incomplete @staticmethod def pickTzid(tzinfo, allowUTC: bool = False): ... def prettyPrint(self, level, tabwidth) -> None: ... # type: ignore[override] @@ -44,7 +45,7 @@ class RecurringComponent(Component): def __init__(self, *args, **kwds) -> None: ... def getrruleset(self, addRDate: bool = False): ... def setrruleset(self, rruleset): ... - rruleset: Any + rruleset: Incomplete def __setattr__(self, name, value) -> None: ... class TextBehavior(Behavior): @@ -55,7 +56,7 @@ class TextBehavior(Behavior): def encode(cls, line) -> None: ... class VCalendarComponentBehavior(Behavior): - defaultBehavior: Any + defaultBehavior: Incomplete isComponent: bool class RecurringBehavior(VCalendarComponentBehavior): @@ -105,8 +106,7 @@ class VCalendar2_0(VCalendarComponentBehavior): name: str description: str versionString: str - sortFirst: Any - knownChildren: Any + sortFirst: Incomplete @classmethod def generateImplicitParameters(cls, obj) -> None: ... @classmethod @@ -116,8 +116,7 @@ class VTimezone(VCalendarComponentBehavior): name: str hasNative: bool description: str - sortFirst: Any - knownChildren: Any + sortFirst: Incomplete @classmethod def validate(cls, obj, raiseException, *args): ... @staticmethod @@ -129,37 +128,31 @@ class TZID(Behavior): ... class DaylightOrStandard(VCalendarComponentBehavior): hasNative: bool - knownChildren: Any class VEvent(RecurringBehavior): name: str - sortFirst: Any + sortFirst: Incomplete description: str - knownChildren: Any @classmethod def validate(cls, obj, raiseException, *args): ... class VTodo(RecurringBehavior): name: str description: str - knownChildren: Any @classmethod def validate(cls, obj, raiseException, *args): ... class VJournal(RecurringBehavior): name: str - knownChildren: Any class VFreeBusy(VCalendarComponentBehavior): name: str description: str - sortFirst: Any - knownChildren: Any + sortFirst: Incomplete class VAlarm(VCalendarComponentBehavior): name: str description: str - knownChildren: Any @staticmethod def generateImplicitParameters(obj) -> None: ... @classmethod @@ -168,16 +161,14 @@ class VAlarm(VCalendarComponentBehavior): class VAvailability(VCalendarComponentBehavior): name: str description: str - sortFirst: Any - knownChildren: Any + sortFirst: Incomplete @classmethod def validate(cls, obj, raiseException, *args): ... class Available(RecurringBehavior): name: str - sortFirst: Any + sortFirst: Incomplete description: str - knownChildren: Any @classmethod def validate(cls, obj, raiseException, *args): ... @@ -212,9 +203,9 @@ class FreeBusy(PeriodBehavior): class RRule(Behavior): ... -utcDateTimeList: Any -dateTimeOrDateList: Any -textList: Any +utcDateTimeList: Incomplete +dateTimeOrDateList: Incomplete +textList: Incomplete def numToDigits(num, places): ... def timedeltaToString(delta): ... @@ -225,7 +216,7 @@ def deltaToOffset(delta): ... def periodToString(period, convertToUTC: bool = False): ... def isDuration(s): ... def stringToDate(s): ... -def stringToDateTime(s, tzinfo: Incomplete | None = None): ... +def stringToDateTime(s, tzinfo: datetime.tzinfo | None = None, strict: bool = False) -> datetime.datetime: ... escapableCharList: str diff --git a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/vcard.pyi b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/vcard.pyi index 20a80ec22db0..e5ef420bc4a1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/vcard.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/vcard.pyi @@ -1,27 +1,26 @@ from _typeshed import Incomplete -from typing import Any from .behavior import Behavior class Name: - family: Any - given: Any - additional: Any - prefix: Any - suffix: Any + family: Incomplete + given: Incomplete + additional: Incomplete + prefix: Incomplete + suffix: Incomplete def __init__(self, family: str = "", given: str = "", additional: str = "", prefix: str = "", suffix: str = "") -> None: ... @staticmethod def toString(val): ... def __eq__(self, other): ... class Address: - box: Any - extended: Any - street: Any - city: Any - region: Any - code: Any - country: Any + box: Incomplete + extended: Incomplete + street: Incomplete + city: Incomplete + region: Incomplete + code: Incomplete + country: Incomplete def __init__( self, street: str = "", @@ -34,8 +33,8 @@ class Address: ) -> None: ... @staticmethod def toString(val, join_char: str = "\n"): ... - lines: Any - one_line: Any + lines: Incomplete + one_line: Incomplete def __eq__(self, other): ... class VCardTextBehavior(Behavior): @@ -48,15 +47,14 @@ class VCardTextBehavior(Behavior): class VCardBehavior(Behavior): allowGroup: bool - defaultBehavior: Any + defaultBehavior: Incomplete class VCard3_0(VCardBehavior): name: str description: str versionString: str isComponent: bool - sortFirst: Any - knownChildren: Any + sortFirst: Incomplete @classmethod def generateImplicitParameters(cls, obj) -> None: ... @@ -68,6 +66,8 @@ class Label(VCardTextBehavior): name: str description: str +class GEO(VCardBehavior): ... + wacky_apple_photo_serialize: bool REALLY_LARGE: float @@ -84,8 +84,8 @@ def splitFields(string): ... def toList(stringOrList): ... def serializeFields(obj, order: Incomplete | None = None): ... -NAME_ORDER: Any -ADDRESS_ORDER: Any +NAME_ORDER: Incomplete +ADDRESS_ORDER: Incomplete class NameBehavior(VCardBehavior): hasNative: bool diff --git a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/win32tz.pyi b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/win32tz.pyi index 32936fbe519d..1cf86d5f13c1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/win32tz.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/vobject/vobject/win32tz.pyi @@ -1,17 +1,17 @@ import datetime import sys -from typing import Any +from _typeshed import Incomplete if sys.platform == "win32": - handle: Any - tzparent: Any - parentsize: Any - localkey: Any - WEEKS: Any + handle: Incomplete + tzparent: Incomplete + parentsize: Incomplete + localkey: Incomplete + WEEKS: Incomplete def list_timezones(): ... class win32tz(datetime.tzinfo): - data: Any + data: Incomplete def __init__(self, name) -> None: ... def utcoffset(self, dt): ... def dst(self, dt): ... @@ -20,21 +20,21 @@ if sys.platform == "win32": def pickNthWeekday(year, month, dayofweek, hour, minute, whichweek): ... class win32tz_data: - display: Any - dstname: Any - stdname: Any - stdoffset: Any - dstoffset: Any - stdmonth: Any - stddayofweek: Any - stdweeknumber: Any - stdhour: Any - stdminute: Any - dstmonth: Any - dstdayofweek: Any - dstweeknumber: Any - dsthour: Any - dstminute: Any + display: Incomplete + dstname: Incomplete + stdname: Incomplete + stdoffset: Incomplete + dstoffset: Incomplete + stdmonth: Incomplete + stddayofweek: Incomplete + stdweeknumber: Incomplete + stdhour: Incomplete + stdminute: Incomplete + dstmonth: Incomplete + dstdayofweek: Incomplete + dstweeknumber: Incomplete + dsthour: Incomplete + dstminute: Incomplete def __init__(self, path) -> None: ... def valuesToDict(key): ...