diff --git a/packages/pyright-internal/typeshed-fallback/commit.txt b/packages/pyright-internal/typeshed-fallback/commit.txt index 79f3d310a..3caecd219 100644 --- a/packages/pyright-internal/typeshed-fallback/commit.txt +++ b/packages/pyright-internal/typeshed-fallback/commit.txt @@ -1 +1 @@ -58f2a795bac5924367d21961af53a32af7bb5727 +82199768bf2e651804cb718f4b570af6d41333d9 diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS b/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS index a8526aab9..89754f65f 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS +++ b/packages/pyright-internal/typeshed-fallback/stdlib/VERSIONS @@ -34,6 +34,7 @@ _dummy_thread: 3.0-3.8 _dummy_threading: 3.0-3.8 _heapq: 3.0- _imp: 3.0- +_interpchannels: 3.13- _json: 3.0- _locale: 3.0- _lsprof: 3.0- @@ -65,9 +66,9 @@ array: 3.0- ast: 3.0- asynchat: 3.0-3.11 asyncio: 3.4- -asyncio.mixins: 3.10- asyncio.exceptions: 3.8- asyncio.format_helpers: 3.7- +asyncio.mixins: 3.10- asyncio.runners: 3.7- asyncio.staggered: 3.8- asyncio.taskgroups: 3.11- @@ -270,6 +271,7 @@ threading: 3.0- time: 3.0- timeit: 3.0- tkinter: 3.0- +tkinter.tix: 3.0-3.12 token: 3.0- tokenize: 3.0- tomllib: 3.11- diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_ast.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_ast.pyi index 4d4ffbbd0..d14c6d39a 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_ast.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_ast.pyi @@ -11,7 +11,7 @@ if sys.version_info >= (3, 13): PyCF_OPTIMIZED_AST: Literal[33792] # Used for node end positions in constructor keyword arguments -_EndPositionT = typing_extensions.TypeVar("_EndPositionT", int, int | None, default=int | None) # noqa: Y023 +_EndPositionT = typing_extensions.TypeVar("_EndPositionT", int, int | None, default=int | None) # Alias used for fields that must always be valid identifiers # A string `x` counts as a valid identifier if both the following are True diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi index 6f3fbd807..eb1d7b9bd 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_curses.pyi @@ -63,8 +63,7 @@ A_COLOR: int A_DIM: int A_HORIZONTAL: int A_INVIS: int -if sys.platform != "darwin": - A_ITALIC: int +A_ITALIC: int A_LEFT: int A_LOW: int A_NORMAL: int diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_interpchannels.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_interpchannels.pyi new file mode 100644 index 000000000..b77fe321a --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_interpchannels.pyi @@ -0,0 +1,84 @@ +from _typeshed import structseq +from typing import Final, Literal, SupportsIndex, final +from typing_extensions import Buffer, Self + +class ChannelError(RuntimeError): ... +class ChannelClosedError(ChannelError): ... +class ChannelEmptyError(ChannelError): ... +class ChannelNotEmptyError(ChannelError): ... +class ChannelNotFoundError(ChannelError): ... + +# Mark as final, since instantiating ChannelID is not supported. +@final +class ChannelID: + @property + def end(self) -> Literal["send", "recv", "both"]: ... + @property + def send(self) -> Self: ... + @property + def recv(self) -> Self: ... + def __eq__(self, other: object) -> bool: ... + def __ge__(self, other: ChannelID) -> bool: ... + def __gt__(self, other: ChannelID) -> bool: ... + def __hash__(self) -> int: ... + def __index__(self) -> int: ... + def __int__(self) -> int: ... + def __le__(self, other: ChannelID) -> bool: ... + def __lt__(self, other: ChannelID) -> bool: ... + def __ne__(self, other: object) -> bool: ... + +@final +class ChannelInfo(structseq[int], tuple[bool, bool, bool, int, int, int, int, int]): + __match_args__: Final = ( + "open", + "closing", + "closed", + "count", + "num_interp_send", + "num_interp_send_released", + "num_interp_recv", + "num_interp_recv_released", + ) + @property + def open(self) -> bool: ... + @property + def closing(self) -> bool: ... + @property + def closed(self) -> bool: ... + @property + def count(self) -> int: ... # type: ignore[override] + @property + def num_interp_send(self) -> int: ... + @property + def num_interp_send_released(self) -> int: ... + @property + def num_interp_recv(self) -> int: ... + @property + def num_interp_recv_released(self) -> int: ... + @property + def num_interp_both(self) -> int: ... + @property + def num_interp_both_recv_released(self) -> int: ... + @property + def num_interp_both_send_released(self) -> int: ... + @property + def num_interp_both_released(self) -> int: ... + @property + def recv_associated(self) -> bool: ... + @property + def recv_released(self) -> bool: ... + @property + def send_associated(self) -> bool: ... + @property + def send_released(self) -> bool: ... + +def create() -> ChannelID: ... +def destroy(cid: SupportsIndex) -> None: ... +def list_all() -> list[ChannelID]: ... +def list_interpreters(cid: SupportsIndex, *, send: bool) -> list[int]: ... +def send(cid: SupportsIndex, obj: object, *, blocking: bool = True, timeout: float | None = None) -> None: ... +def send_buffer(cid: SupportsIndex, obj: Buffer, *, blocking: bool = True, timeout: float | None = None) -> None: ... +def recv(cid: SupportsIndex, default: object = ...) -> object: ... +def close(cid: SupportsIndex, *, send: bool = False, recv: bool = False) -> None: ... +def get_info(cid: SupportsIndex) -> ChannelInfo: ... +def release(cid: SupportsIndex, *, send: bool = False, recv: bool = False, force: bool = False) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi index 3340df424..aea74c8be 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_tkinter.pyi @@ -1,5 +1,7 @@ import sys +from collections.abc import Callable from typing import Any, ClassVar, Literal, final +from typing_extensions import TypeAlias # _tkinter is meant to be only used internally by tkinter, but some tkinter # functions e.g. return _tkinter.Tcl_Obj objects. Tcl_Obj represents a Tcl @@ -30,6 +32,8 @@ class Tcl_Obj: class TclError(Exception): ... +_TkinterTraceFunc: TypeAlias = Callable[[tuple[str, ...]], object] + # This class allows running Tcl code. Tkinter uses it internally a lot, and # it's often handy to drop a piece of Tcl code into a tkinter program. Example: # @@ -86,6 +90,9 @@ class TkappType: def unsetvar(self, *args, **kwargs): ... def wantobjects(self, *args, **kwargs): ... def willdispatch(self): ... + if sys.version_info >= (3, 12): + def gettrace(self, /) -> _TkinterTraceFunc | None: ... + def settrace(self, func: _TkinterTraceFunc | None, /) -> None: ... # These should be kept in sync with tkinter.tix constants, except ALL_EVENTS which doesn't match TCL_ALL_EVENTS ALL_EVENTS: Literal[-3] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/_weakref.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/_weakref.pyi index 61365645d..f142820c5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/_weakref.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/_weakref.pyi @@ -21,8 +21,9 @@ class ProxyType(Generic[_T]): # "weakproxy" def __getattr__(self, attr: str) -> Any: ... class ReferenceType(Generic[_T]): - __callback__: Callable[[ReferenceType[_T]], Any] - def __new__(cls, o: _T, callback: Callable[[ReferenceType[_T]], Any] | None = ..., /) -> Self: ... + __callback__: Callable[[Self], Any] + def __new__(cls, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> Self: ... + def __init__(self, o: _T, callback: Callable[[Self], Any] | None = ..., /) -> None: ... def __call__(self) -> _T | None: ... def __eq__(self, value: object, /) -> bool: ... def __hash__(self) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi index 1956d08c9..bc781ec8e 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/argparse.pyi @@ -32,6 +32,7 @@ _T = TypeVar("_T") _ActionT = TypeVar("_ActionT", bound=Action) _ArgumentParserT = TypeVar("_ArgumentParserT", bound=ArgumentParser) _N = TypeVar("_N") +_ActionType: TypeAlias = Callable[[str], Any] | FileType | str # more precisely, Literal["store", "store_const", "store_true", # "store_false", "append", "append_const", "count", "help", "version", # "extend"], but using this would make it hard to annotate callers @@ -89,7 +90,7 @@ class _ActionsContainer: nargs: int | _NArgsStr | _SUPPRESS_T | None = None, const: Any = ..., default: Any = ..., - type: Callable[[str], _T] | FileType = ..., + type: _ActionType = ..., choices: Iterable[_T] | None = ..., required: bool = ..., help: str | None = ..., @@ -313,7 +314,7 @@ class Action(_AttributeHolder): nargs: int | str | None const: Any default: Any - type: Callable[[str], Any] | FileType | None + type: _ActionType | None choices: Iterable[Any] | None required: bool help: str | None @@ -699,6 +700,7 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]): add_help: bool = ..., allow_abbrev: bool = ..., exit_on_error: bool = ..., + **kwargs: Any, # Accepting any additional kwargs for custom parser classes ) -> _ArgumentParserT: ... elif sys.version_info >= (3, 9): def add_parser( @@ -721,6 +723,7 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]): add_help: bool = ..., allow_abbrev: bool = ..., exit_on_error: bool = ..., + **kwargs: Any, # Accepting any additional kwargs for custom parser classes ) -> _ArgumentParserT: ... else: def add_parser( @@ -742,6 +745,7 @@ class _SubParsersAction(Action, Generic[_ArgumentParserT]): conflict_handler: str = ..., add_help: bool = ..., allow_abbrev: bool = ..., + **kwargs: Any, # Accepting any additional kwargs for custom parser classes ) -> _ArgumentParserT: ... def _get_subactions(self) -> list[Action]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi index c0345eb1b..8c2664666 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/events.pyi @@ -16,23 +16,40 @@ from .tasks import Task from .transports import BaseTransport, DatagramTransport, ReadTransport, SubprocessTransport, Transport, WriteTransport from .unix_events import AbstractChildWatcher -__all__ = ( - "AbstractEventLoopPolicy", - "AbstractEventLoop", - "AbstractServer", - "Handle", - "TimerHandle", - "get_event_loop_policy", - "set_event_loop_policy", - "get_event_loop", - "set_event_loop", - "new_event_loop", - "get_child_watcher", - "set_child_watcher", - "_set_running_loop", - "get_running_loop", - "_get_running_loop", -) +if sys.version_info >= (3, 14): + __all__ = ( + "AbstractEventLoopPolicy", + "AbstractEventLoop", + "AbstractServer", + "Handle", + "TimerHandle", + "get_event_loop_policy", + "set_event_loop_policy", + "get_event_loop", + "set_event_loop", + "new_event_loop", + "_set_running_loop", + "get_running_loop", + "_get_running_loop", + ) +else: + __all__ = ( + "AbstractEventLoopPolicy", + "AbstractEventLoop", + "AbstractServer", + "Handle", + "TimerHandle", + "get_event_loop_policy", + "set_event_loop_policy", + "get_event_loop", + "set_event_loop", + "new_event_loop", + "get_child_watcher", + "set_child_watcher", + "_set_running_loop", + "get_running_loop", + "_get_running_loop", + ) _T = TypeVar("_T") _Ts = TypeVarTuple("_Ts") @@ -541,18 +558,19 @@ class AbstractEventLoopPolicy: @abstractmethod def new_event_loop(self) -> AbstractEventLoop: ... # Child processes handling (Unix only). - if sys.version_info >= (3, 12): - @abstractmethod - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - def get_child_watcher(self) -> AbstractChildWatcher: ... - @abstractmethod - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... - else: - @abstractmethod - def get_child_watcher(self) -> AbstractChildWatcher: ... - @abstractmethod - def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... + if sys.version_info < (3, 14): + if sys.version_info >= (3, 12): + @abstractmethod + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + def get_child_watcher(self) -> AbstractChildWatcher: ... + @abstractmethod + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... + else: + @abstractmethod + def get_child_watcher(self) -> AbstractChildWatcher: ... + @abstractmethod + def set_child_watcher(self, watcher: AbstractChildWatcher) -> None: ... class BaseDefaultEventLoopPolicy(AbstractEventLoopPolicy, metaclass=ABCMeta): def get_event_loop(self) -> AbstractEventLoop: ... @@ -565,15 +583,16 @@ def get_event_loop() -> AbstractEventLoop: ... def set_event_loop(loop: AbstractEventLoop | None) -> None: ... def new_event_loop() -> AbstractEventLoop: ... -if sys.version_info >= (3, 12): - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - def get_child_watcher() -> AbstractChildWatcher: ... - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... +if sys.version_info < (3, 14): + if sys.version_info >= (3, 12): + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + def get_child_watcher() -> AbstractChildWatcher: ... + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... -else: - def get_child_watcher() -> AbstractChildWatcher: ... - def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... + else: + def get_child_watcher() -> AbstractChildWatcher: ... + def set_child_watcher(watcher: AbstractChildWatcher) -> None: ... def _set_running_loop(loop: AbstractEventLoop | None, /) -> None: ... def _get_running_loop() -> AbstractEventLoop: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi index c16a1919b..4613bca70 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/tasks.pyi @@ -70,7 +70,10 @@ _T4 = TypeVar("_T4") _T5 = TypeVar("_T5") _T6 = TypeVar("_T6") _FT = TypeVar("_FT", bound=Future[Any]) -_FutureLike: TypeAlias = Future[_T] | Generator[Any, None, _T] | Awaitable[_T] +if sys.version_info >= (3, 12): + _FutureLike: TypeAlias = Future[_T] | Awaitable[_T] +else: + _FutureLike: TypeAlias = Future[_T] | Generator[Any, None, _T] | Awaitable[_T] _TaskYieldType: TypeAlias = Future[object] | None FIRST_COMPLETED = concurrent.futures.FIRST_COMPLETED 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 e9274b853..3a2c62646 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/unix_events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/unix_events.pyi @@ -13,51 +13,54 @@ _Ts = TypeVarTuple("_Ts") # This is also technically not available on Win, # but other parts of typeshed need this definition. # So, it is special cased. -if sys.version_info >= (3, 12): - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - class AbstractChildWatcher: - @abstractmethod - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - @abstractmethod - def remove_child_handler(self, pid: int) -> bool: ... - @abstractmethod - def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - @abstractmethod - def close(self) -> None: ... - @abstractmethod - def __enter__(self) -> Self: ... - @abstractmethod - def __exit__( - self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None - ) -> None: ... - @abstractmethod - def is_active(self) -> bool: ... +if sys.version_info < (3, 14): + if sys.version_info >= (3, 12): + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + class AbstractChildWatcher: + @abstractmethod + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + @abstractmethod + def remove_child_handler(self, pid: int) -> bool: ... + @abstractmethod + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + @abstractmethod + def close(self) -> None: ... + @abstractmethod + def __enter__(self) -> Self: ... + @abstractmethod + def __exit__( + self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None + ) -> None: ... + @abstractmethod + def is_active(self) -> bool: ... -else: - class AbstractChildWatcher: - @abstractmethod - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - @abstractmethod - def remove_child_handler(self, pid: int) -> bool: ... - @abstractmethod - def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - @abstractmethod - def close(self) -> None: ... - @abstractmethod - def __enter__(self) -> Self: ... - @abstractmethod - def __exit__( - self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None - ) -> None: ... - @abstractmethod - def is_active(self) -> bool: ... + else: + class AbstractChildWatcher: + @abstractmethod + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + @abstractmethod + def remove_child_handler(self, pid: int) -> bool: ... + @abstractmethod + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + @abstractmethod + def close(self) -> None: ... + @abstractmethod + def __enter__(self) -> Self: ... + @abstractmethod + def __exit__( + self, typ: type[BaseException] | None, exc: BaseException | None, tb: types.TracebackType | None + ) -> None: ... + @abstractmethod + def is_active(self) -> bool: ... if sys.platform != "win32": - if sys.version_info >= (3, 9): + if sys.version_info >= (3, 14): + __all__ = ("SelectorEventLoop", "DefaultEventLoopPolicy") + elif sys.version_info >= (3, 9): __all__ = ( "SelectorEventLoop", "AbstractChildWatcher", @@ -79,118 +82,137 @@ if sys.platform != "win32": "DefaultEventLoopPolicy", ) - # Doesn't actually have ABCMeta metaclass at runtime, but mypy complains if we don't have it in the stub. - # See discussion in #7412 - class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta): - def close(self) -> None: ... - def is_active(self) -> bool: ... - def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + if sys.version_info < (3, 14): + if sys.version_info >= (3, 12): + # Doesn't actually have ABCMeta metaclass at runtime, but mypy complains if we don't have it in the stub. + # See discussion in #7412 + class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta): + def close(self) -> None: ... + def is_active(self) -> bool: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - if sys.version_info >= (3, 12): - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - class SafeChildWatcher(BaseChildWatcher): - def __enter__(self) -> Self: ... - def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ... - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - def remove_child_handler(self, pid: int) -> bool: ... + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + class SafeChildWatcher(BaseChildWatcher): + def __enter__(self) -> Self: ... + def __exit__( + self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None + ) -> None: ... + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - class FastChildWatcher(BaseChildWatcher): - def __enter__(self) -> Self: ... - def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ... - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - def remove_child_handler(self, pid: int) -> bool: ... + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + class FastChildWatcher(BaseChildWatcher): + def __enter__(self) -> Self: ... + def __exit__( + self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None + ) -> None: ... + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... - else: - class SafeChildWatcher(BaseChildWatcher): - def __enter__(self) -> Self: ... - def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ... - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - def remove_child_handler(self, pid: int) -> bool: ... + else: + # Doesn't actually have ABCMeta metaclass at runtime, but mypy complains if we don't have it in the stub. + # See discussion in #7412 + class BaseChildWatcher(AbstractChildWatcher, metaclass=ABCMeta): + def close(self) -> None: ... + def is_active(self) -> bool: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - class FastChildWatcher(BaseChildWatcher): - def __enter__(self) -> Self: ... - def __exit__(self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None) -> None: ... - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - def remove_child_handler(self, pid: int) -> bool: ... + class SafeChildWatcher(BaseChildWatcher): + def __enter__(self) -> Self: ... + def __exit__( + self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None + ) -> None: ... + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... + + class FastChildWatcher(BaseChildWatcher): + def __enter__(self) -> Self: ... + def __exit__( + self, a: type[BaseException] | None, b: BaseException | None, c: types.TracebackType | None + ) -> None: ... + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... class _UnixSelectorEventLoop(BaseSelectorEventLoop): ... class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy): - if sys.version_info >= (3, 12): - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - def get_child_watcher(self) -> AbstractChildWatcher: ... - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ... - else: - def get_child_watcher(self) -> AbstractChildWatcher: ... - def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ... + if sys.version_info < (3, 14): + if sys.version_info >= (3, 12): + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + def get_child_watcher(self) -> AbstractChildWatcher: ... + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ... + else: + def get_child_watcher(self) -> AbstractChildWatcher: ... + def set_child_watcher(self, watcher: AbstractChildWatcher | None) -> None: ... SelectorEventLoop = _UnixSelectorEventLoop DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy - if sys.version_info >= (3, 12): - @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") - class MultiLoopChildWatcher(AbstractChildWatcher): - def is_active(self) -> bool: ... + if sys.version_info < (3, 14): + if sys.version_info >= (3, 12): + @deprecated("Deprecated as of Python 3.12; will be removed in Python 3.14") + class MultiLoopChildWatcher(AbstractChildWatcher): + def is_active(self) -> bool: ... + def close(self) -> None: ... + def __enter__(self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + ) -> None: ... + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + + else: + class MultiLoopChildWatcher(AbstractChildWatcher): + def is_active(self) -> bool: ... + def close(self) -> None: ... + def __enter__(self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + ) -> None: ... + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + + if sys.version_info < (3, 14): + class ThreadedChildWatcher(AbstractChildWatcher): + def is_active(self) -> Literal[True]: ... def close(self) -> None: ... def __enter__(self) -> Self: ... def __exit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None ) -> None: ... + def __del__(self) -> None: ... def add_child_handler( self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] ) -> None: ... def remove_child_handler(self, pid: int) -> bool: ... def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - else: - class MultiLoopChildWatcher(AbstractChildWatcher): - def is_active(self) -> bool: ... - def close(self) -> None: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None - ) -> None: ... - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - def remove_child_handler(self, pid: int) -> bool: ... - def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - - class ThreadedChildWatcher(AbstractChildWatcher): - def is_active(self) -> Literal[True]: ... - def close(self) -> None: ... - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None - ) -> None: ... - def __del__(self) -> None: ... - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - def remove_child_handler(self, pid: int) -> bool: ... - def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - - if sys.version_info >= (3, 9): - class PidfdChildWatcher(AbstractChildWatcher): - def __enter__(self) -> Self: ... - def __exit__( - self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None - ) -> None: ... - def is_active(self) -> bool: ... - def close(self) -> None: ... - def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... - def add_child_handler( - self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] - ) -> None: ... - def remove_child_handler(self, pid: int) -> bool: ... + if sys.version_info >= (3, 9): + class PidfdChildWatcher(AbstractChildWatcher): + def __enter__(self) -> Self: ... + def __exit__( + self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: types.TracebackType | None + ) -> None: ... + def is_active(self) -> bool: ... + def close(self) -> None: ... + def attach_loop(self, loop: AbstractEventLoop | None) -> None: ... + def add_child_handler( + self, pid: int, callback: Callable[[int, int, Unpack[_Ts]], object], *args: Unpack[_Ts] + ) -> None: ... + def remove_child_handler(self, pid: int) -> bool: ... 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 9c150ee16..97aa52ff8 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/windows_events.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/asyncio/windows_events.pyi @@ -74,8 +74,9 @@ if sys.platform == "win32": class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy): _loop_factory: ClassVar[type[SelectorEventLoop]] - def get_child_watcher(self) -> NoReturn: ... - def set_child_watcher(self, watcher: Any) -> NoReturn: ... + if sys.version_info < (3, 14): + def get_child_watcher(self) -> NoReturn: ... + def set_child_watcher(self, watcher: Any) -> NoReturn: ... class WindowsProactorEventLoopPolicy(events.BaseDefaultEventLoopPolicy): _loop_factory: ClassVar[type[ProactorEventLoop]] diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi index 53e00ec6a..ef5d7f305 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/builtins.pyi @@ -1673,9 +1673,9 @@ def pow(base: float, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> @overload def pow(base: complex, exp: complex | _SupportsSomeKindOfPow, mod: None = None) -> complex: ... @overload -def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... +def pow(base: _SupportsPow2[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] @overload -def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... +def pow(base: _SupportsPow3NoneOnly[_E, _T_co], exp: _E, mod: None = None) -> _T_co: ... # type: ignore[overload-overlap] @overload def pow(base: _SupportsPow3[_E, _M, _T_co], exp: _E, mod: _M) -> _T_co: ... @overload diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi index 30489e6f8..626608e8a 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/dataclasses.pyi @@ -108,7 +108,7 @@ class _DefaultFactory(Protocol[_T_co]): class Field(Generic[_T]): name: str - type: Type[_T] + type: Type[_T] | str | Any default: _T | Literal[_MISSING_TYPE.MISSING] default_factory: _DefaultFactory[_T] | Literal[_MISSING_TYPE.MISSING] repr: bool diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/logging/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/logging/__init__.pyi index f25abff83..4c6163257 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/logging/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/logging/__init__.pyi @@ -8,7 +8,7 @@ from string import Template from time import struct_time from types import FrameType, TracebackType from typing import Any, ClassVar, Generic, Literal, Protocol, TextIO, TypeVar, overload -from typing_extensions import Self, TypeAlias +from typing_extensions import Self, TypeAlias, deprecated if sys.version_info >= (3, 11): from types import GenericAlias @@ -574,11 +574,8 @@ def disable(level: int = 50) -> None: ... def addLevelName(level: int, levelName: str) -> None: ... @overload def getLevelName(level: int) -> str: ... - -# The str -> int case is considered a mistake, but retained for backward -# compatibility. See -# https://docs.python.org/3/library/logging.html#logging.getLevelName. @overload +@deprecated("The str -> int case is considered a mistake.") def getLevelName(level: str) -> Any: ... if sys.version_info >= (3, 11): diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi index 2d27e7b2a..7688970e5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/mmap.pyi @@ -1,7 +1,7 @@ import sys from _typeshed import ReadableBuffer, Unused from collections.abc import Iterable, Iterator, Sized -from typing import NoReturn, overload +from typing import Final, NoReturn, overload from typing_extensions import Self ACCESS_DEFAULT: int @@ -113,3 +113,9 @@ if sys.platform != "linux" and sys.platform != "darwin" and sys.platform != "win if sys.version_info >= (3, 10) and sys.platform == "darwin": MADV_FREE_REUSABLE: int MADV_FREE_REUSE: int + +if sys.version_info >= (3, 13) and sys.platform != "win32": + MAP_32BIT: Final = 32768 + +if sys.version_info >= (3, 13) and sys.platform == "darwin": + MAP_TPRO: Final = 524288 diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi index 9a45a8155..605be4686 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/context.pyi @@ -92,17 +92,21 @@ class BaseContext: @overload def Value(self, typecode_or_type: str | type[_CData], *args: Any, lock: bool | _LockLike = True) -> Any: ... @overload + def Array( + self, typecode_or_type: type[_SimpleCData[_T]], size_or_initializer: int | Sequence[Any], *, lock: Literal[False] + ) -> SynchronizedArray[_T]: ... + @overload def Array( self, typecode_or_type: type[c_char], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True ) -> SynchronizedString: ... @overload def Array( - self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[False] - ) -> SynchronizedArray[_CT]: ... - @overload - def Array( - self, typecode_or_type: type[_CT], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True - ) -> SynchronizedArray[_CT]: ... + self, + typecode_or_type: type[_SimpleCData[_T]], + size_or_initializer: int | Sequence[Any], + *, + lock: Literal[True] | _LockLike = True, + ) -> SynchronizedArray[_T]: ... @overload def Array( self, typecode_or_type: str, size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi index 4093a97e6..2b96ff047 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/multiprocessing/sharedctypes.pyi @@ -39,12 +39,20 @@ def Array( ) -> _CT: ... @overload def Array( - typecode_or_type: type[_CT], + typecode_or_type: type[c_char], size_or_initializer: int | Sequence[Any], *, lock: Literal[True] | _LockLike = True, ctx: BaseContext | None = None, -) -> SynchronizedArray[_CT]: ... +) -> SynchronizedString: ... +@overload +def Array( + typecode_or_type: type[_SimpleCData[_T]], + size_or_initializer: int | Sequence[Any], + *, + lock: Literal[True] | _LockLike = True, + ctx: BaseContext | None = None, +) -> SynchronizedArray[_T]: ... @overload def Array( typecode_or_type: str, @@ -65,9 +73,11 @@ def copy(obj: _CT) -> _CT: ... @overload def synchronized(obj: _SimpleCData[_T], lock: _LockLike | None = None, ctx: Any | None = None) -> Synchronized[_T]: ... @overload -def synchronized(obj: ctypes.Array[c_char], lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedString: ... +def synchronized(obj: ctypes.Array[c_char], lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedString: ... # type: ignore @overload -def synchronized(obj: ctypes.Array[_CT], lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedArray[_CT]: ... +def synchronized( + obj: ctypes.Array[_SimpleCData[_T]], lock: _LockLike | None = None, ctx: Any | None = None +) -> SynchronizedArray[_T]: ... @overload def synchronized(obj: _CT, lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedBase[_CT]: ... @@ -89,19 +99,30 @@ class SynchronizedBase(Generic[_CT]): class Synchronized(SynchronizedBase[_SimpleCData[_T]], Generic[_T]): value: _T -class SynchronizedArray(SynchronizedBase[ctypes.Array[_CT]], Generic[_CT]): +class SynchronizedArray(SynchronizedBase[ctypes.Array[_SimpleCData[_T]]], Generic[_T]): def __len__(self) -> int: ... @overload - def __getitem__(self, i: slice) -> list[_CT]: ... + def __getitem__(self, i: slice) -> list[_T]: ... @overload - def __getitem__(self, i: int) -> _CT: ... + def __getitem__(self, i: int) -> _T: ... @overload - def __setitem__(self, i: slice, value: Iterable[_CT]) -> None: ... + def __setitem__(self, i: slice, value: Iterable[_T]) -> None: ... @overload - def __setitem__(self, i: int, value: _CT) -> None: ... - def __getslice__(self, start: int, stop: int) -> list[_CT]: ... - def __setslice__(self, start: int, stop: int, values: Iterable[_CT]) -> None: ... + def __setitem__(self, i: int, value: _T) -> None: ... + def __getslice__(self, start: int, stop: int) -> list[_T]: ... + def __setslice__(self, start: int, stop: int, values: Iterable[_T]) -> None: ... + +class SynchronizedString(SynchronizedArray[bytes]): + @overload # type: ignore[override] + def __getitem__(self, i: slice) -> bytes: ... + @overload # type: ignore[override] + def __getitem__(self, i: int) -> bytes: ... + @overload # type: ignore[override] + def __setitem__(self, i: slice, value: bytes) -> None: ... + @overload # type: ignore[override] + def __setitem__(self, i: int, value: bytes) -> None: ... # type: ignore[override] + def __getslice__(self, start: int, stop: int) -> bytes: ... # type: ignore[override] + def __setslice__(self, start: int, stop: int, values: bytes) -> None: ... # type: ignore[override] -class SynchronizedString(SynchronizedArray[c_char]): value: bytes raw: bytes diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi index 31c5d2aa3..9b00117a5 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/os/__init__.pyi @@ -914,8 +914,8 @@ if sys.platform != "win32": def forkpty() -> tuple[int, int]: ... # some flavors of Unix def killpg(pgid: int, signal: int, /) -> None: ... def nice(increment: int, /) -> int: ... - if sys.platform != "darwin": - def plock(op: int, /) -> None: ... # ???op is int? + if sys.platform != "darwin" and sys.platform != "linux": + def plock(op: int, /) -> None: ... class _wrap_close(_TextIOWrapper): def __init__(self, stream: _TextIOWrapper, proc: Popen[str]) -> None: ... @@ -1141,16 +1141,16 @@ if sys.version_info >= (3, 10) and sys.platform == "linux": if sys.version_info >= (3, 12) and sys.platform == "linux": CLONE_FILES: int CLONE_FS: int - CLONE_NEWCGROUP: int - CLONE_NEWIPC: int - CLONE_NEWNET: int + CLONE_NEWCGROUP: int # Linux 4.6+ + CLONE_NEWIPC: int # Linux 2.6.19+ + CLONE_NEWNET: int # Linux 2.6.24+ CLONE_NEWNS: int - CLONE_NEWPID: int - CLONE_NEWTIME: int - CLONE_NEWUSER: int - CLONE_NEWUTS: int + CLONE_NEWPID: int # Linux 3.8+ + CLONE_NEWTIME: int # Linux 5.6+ + CLONE_NEWUSER: int # Linux 3.8+ + CLONE_NEWUTS: int # Linux 2.6.19+ CLONE_SIGHAND: int - CLONE_SYSVSEM: int + CLONE_SYSVSEM: int # Linux 2.6.26+ CLONE_THREAD: int CLONE_VM: int def unshare(flags: int) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/posixpath.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/posixpath.pyi index e5f5fa0d8..31406f8df 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/posixpath.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/posixpath.pyi @@ -77,11 +77,7 @@ pathsep: LiteralString defpath: LiteralString devnull: LiteralString -# Overloads are necessary to work around python/mypy#3644. -@overload -def abspath(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def abspath(path: AnyStr) -> AnyStr: ... +def abspath(path: PathLike[AnyStr] | AnyStr) -> AnyStr: ... @overload def basename(p: PathLike[AnyStr]) -> AnyStr: ... @overload @@ -90,14 +86,8 @@ def basename(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... def dirname(p: PathLike[AnyStr]) -> AnyStr: ... @overload def dirname(p: AnyOrLiteralStr) -> AnyOrLiteralStr: ... -@overload -def expanduser(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def expanduser(path: AnyStr) -> AnyStr: ... -@overload -def expandvars(path: PathLike[AnyStr]) -> AnyStr: ... -@overload -def expandvars(path: AnyStr) -> AnyStr: ... +def expanduser(path: PathLike[AnyStr] | AnyStr) -> AnyStr: ... +def expandvars(path: PathLike[AnyStr] | AnyStr) -> AnyStr: ... @overload def normcase(s: PathLike[AnyStr]) -> AnyStr: ... @overload diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/spwd.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/spwd.pyi index 67ad3bfc7..3a5d39997 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/spwd.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/spwd.pyi @@ -36,6 +36,11 @@ if sys.platform != "win32": def sp_expire(self) -> int: ... @property def sp_flag(self) -> int: ... + # Deprecated aliases below. + @property + def sp_nam(self) -> str: ... + @property + def sp_pwd(self) -> str: ... def getspall() -> list[struct_spwd]: ... def getspnam(arg: str, /) -> struct_spwd: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/subprocess.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/subprocess.pyi index 6234ecc02..b01bac245 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/subprocess.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/subprocess.pyi @@ -889,6 +889,7 @@ if sys.version_info >= (3, 11): start_new_session: bool = False, pass_fds: Collection[int] = ..., *, + encoding: str | None = None, timeout: float | None = None, text: bool | None = None, user: str | int | None = None, @@ -920,6 +921,7 @@ elif sys.version_info >= (3, 10): start_new_session: bool = False, pass_fds: Collection[int] = ..., *, + encoding: str | None = None, timeout: float | None = None, text: bool | None = None, user: str | int | None = None, @@ -950,6 +952,7 @@ elif sys.version_info >= (3, 9): start_new_session: bool = False, pass_fds: Collection[int] = ..., *, + encoding: str | None = None, timeout: float | None = None, text: bool | None = None, user: str | int | None = None, @@ -978,6 +981,7 @@ else: start_new_session: bool = False, pass_fds: Collection[int] = ..., *, + encoding: str | None = None, timeout: float | None = None, text: bool | None = None, ) -> int: ... @@ -1005,6 +1009,7 @@ if sys.version_info >= (3, 11): pass_fds: Collection[int] = ..., timeout: float | None = ..., *, + encoding: str | None = None, text: bool | None = None, user: str | int | None = None, group: str | int | None = None, @@ -1036,6 +1041,7 @@ elif sys.version_info >= (3, 10): pass_fds: Collection[int] = ..., timeout: float | None = ..., *, + encoding: str | None = None, text: bool | None = None, user: str | int | None = None, group: str | int | None = None, @@ -1066,6 +1072,7 @@ elif sys.version_info >= (3, 9): pass_fds: Collection[int] = ..., timeout: float | None = ..., *, + encoding: str | None = None, text: bool | None = None, user: str | int | None = None, group: str | int | None = None, @@ -1094,6 +1101,7 @@ else: pass_fds: Collection[int] = ..., timeout: float | None = ..., *, + encoding: str | None = None, text: bool | None = None, ) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi index e52099464..d6adf21c1 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/tarfile.pyi @@ -103,10 +103,13 @@ PAX_NAME_FIELDS: set[str] ENCODING: str +_FileCreationModes: TypeAlias = Literal["a", "w", "x"] + +@overload def open( name: StrOrBytesPath | None = None, mode: str = "r", - fileobj: IO[bytes] | None = None, # depends on mode + fileobj: IO[bytes] | None = None, bufsize: int = 10240, *, format: int | None = ..., @@ -121,6 +124,25 @@ def open( compresslevel: int | None = ..., preset: Literal[0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | None = ..., ) -> TarFile: ... +@overload +def open( + name: StrOrBytesPath | None = None, + mode: _FileCreationModes = ..., + fileobj: _Fileobj | 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 = ..., + compresslevel: int | None = ..., + preset: int | None = ..., +) -> TarFile: ... class ExFileObject(io.BufferedReader): def __init__(self, tarfile: TarFile, tarinfo: TarInfo) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi index d244d54f2..294a1cb12 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/telnetlib.pyi @@ -88,6 +88,7 @@ NOOPT: bytes class Telnet: host: str | None # undocumented + sock: socket.socket | None # undocumented def __init__(self, host: str | None = None, port: int = 0, timeout: float = ...) -> None: ... def open(self, host: str, port: int = 0, timeout: float = ...) -> None: ... def msg(self, msg: str, *args: Any) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi index f04b2d858..92427f91f 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/typing.pyi @@ -21,7 +21,7 @@ from types import ( TracebackType, WrapperDescriptorType, ) -from typing_extensions import Never as _Never, ParamSpec as _ParamSpec +from typing_extensions import Never as _Never, ParamSpec as _ParamSpec, deprecated if sys.version_info >= (3, 9): from types import GenericAlias @@ -991,11 +991,30 @@ class ForwardRef: def __init__(self, arg: str, is_argument: bool = True) -> None: ... if sys.version_info >= (3, 13): + @overload + @deprecated( + "Failing to pass a value to the 'type_params' parameter of ForwardRef._evaluate() is deprecated, " + "as it leads to incorrect behaviour when evaluating a stringified annotation " + "that references a PEP 695 type parameter. It will be disallowed in Python 3.15." + ) + def _evaluate( + self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None, *, recursive_guard: frozenset[str] + ) -> Any | None: ... + @overload def _evaluate( self, globalns: dict[str, Any] | None, localns: dict[str, Any] | None, - type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ..., + type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...], + *, + recursive_guard: frozenset[str], + ) -> Any | None: ... + elif sys.version_info >= (3, 12): + def _evaluate( + self, + globalns: dict[str, Any] | None, + localns: dict[str, Any] | None, + type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] | None = None, *, recursive_guard: frozenset[str], ) -> Any | None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi index e34512423..aaba7ffc9 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/weakref.pyi @@ -41,7 +41,10 @@ _P = ParamSpec("_P") ProxyTypes: tuple[type[Any], ...] class WeakMethod(ref[_CallableT]): - def __new__(cls, meth: _CallableT, callback: Callable[[Self], object] | None = None) -> Self: ... + # `ref` is implemented in `C` so positional-only arguments are enforced, but not in `WeakMethod`. + def __new__( # pyright: ignore[reportInconsistentConstructor] + cls, meth: _CallableT, callback: Callable[[Self], Any] | None = None + ) -> Self: ... def __call__(self) -> _CallableT | None: ... def __eq__(self, other: object) -> bool: ... def __ne__(self, other: object) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stdlib/xml/sax/handler.pyi b/packages/pyright-internal/typeshed-fallback/stdlib/xml/sax/handler.pyi index 30fe31d51..7b7c69048 100644 --- a/packages/pyright-internal/typeshed-fallback/stdlib/xml/sax/handler.pyi +++ b/packages/pyright-internal/typeshed-fallback/stdlib/xml/sax/handler.pyi @@ -14,7 +14,7 @@ class ContentHandler: def startDocument(self) -> None: ... def endDocument(self) -> None: ... def startPrefixMapping(self, prefix: str | None, uri: str) -> None: ... - def endPrefixMapping(self, prefix) -> None: ... + def endPrefixMapping(self, prefix: str | None) -> None: ... def startElement(self, name: str, attrs: xmlreader.AttributesImpl) -> None: ... def endElement(self, name: str) -> None: ... def startElementNS(self, name: tuple[str, str], qname: str, attrs: xmlreader.AttributesNSImpl) -> None: ... 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 ca444323b..68fdd4cf9 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 @@ -7,8 +7,8 @@ from typing_extensions import ParamSpec, TypeAlias from flask import Flask from flask.testing import FlaskClient -from .namespace import Namespace -from .test_client import SocketIOTestClient +from .namespace import Namespace as Namespace +from .test_client import SocketIOTestClient as SocketIOTestClient _P = ParamSpec("_P") _R_co = TypeVar("_R_co", covariant=True) @@ -96,9 +96,9 @@ class SocketIO: port: int | None = None, *, debug: bool = True, - use_reloader: bool, + use_reloader: bool = ..., reloader_options: dict[str, Incomplete] = {}, - log_output: bool, + log_output: bool = ..., allow_unsafe_werkzeug: bool = False, **kwargs, ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/METADATA.toml index 950f1bd80..d649874b9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/METADATA.toml @@ -1,4 +1,4 @@ -version = "23.2.*" +version = "24.1.*" upstream_repository = "https://github.com/Tinche/aiofiles" [tool.stubtest] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/base.pyi b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/base.pyi index c705acb30..ea79abf48 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/base.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/base.pyi @@ -1,12 +1,11 @@ -from collections.abc import Callable, Coroutine, Generator, Iterator -from types import CodeType, FrameType, TracebackType, coroutine +from collections.abc import Awaitable, Callable, Generator +from contextlib import AbstractAsyncContextManager +from types import TracebackType from typing import Any, BinaryIO, Generic, TextIO, TypeVar from typing_extensions import Self _T = TypeVar("_T") -_T_co = TypeVar("_T_co", covariant=True) _V_co = TypeVar("_V_co", covariant=True) -_T_contra = TypeVar("_T_contra", contravariant=True) class AsyncBase(Generic[_T]): def __init__(self, file: str, loop: Any, executor: Any) -> None: ... @@ -16,22 +15,9 @@ class AsyncBase(Generic[_T]): class AsyncIndirectBase(AsyncBase[_T]): def __init__(self, name: str, loop: Any, executor: Any, indirect: Callable[[], TextIO | BinaryIO]) -> None: ... -class AiofilesContextManager(Generic[_T_co, _T_contra, _V_co]): - def __init__(self, coro: Coroutine[_T_co, _T_contra, _V_co]) -> None: ... - def send(self, value: _T_contra) -> _T_co: ... - def throw(self, typ: type[BaseException], val: BaseException | object = None, tb: TracebackType | None = None) -> _T_co: ... - def close(self) -> None: ... - @property - def gi_frame(self) -> FrameType: ... - @property - def gi_running(self) -> bool: ... - @property - def gi_code(self) -> CodeType: ... - def __next__(self) -> _T_co: ... - @coroutine - def __iter__(self) -> Iterator[Coroutine[_T_co, _T_contra, _V_co]]: ... - def __await__(self) -> Generator[Any, None, _V_co]: ... - async def __anext__(self) -> _V_co: ... +class AiofilesContextManager(Awaitable[_V_co], AbstractAsyncContextManager[_V_co]): + def __init__(self, coro: Awaitable[_V_co]) -> None: ... + def __await__(self) -> Generator[Any, Any, _V_co]: ... async def __aenter__(self) -> _V_co: ... async def __aexit__( self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None diff --git a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/os.pyi b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/os.pyi index 54e601040..5a3de3b59 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/os.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/os.pyi @@ -27,6 +27,7 @@ __all__ = [ "scandir", "access", "wrap", + "getcwd", ] if sys.platform != "win32": @@ -118,6 +119,7 @@ async def listdir(path: int, *, loop: AbstractEventLoop | None = ..., executor: async def access( path: FileDescriptorOrPath, mode: int, *, dir_fd: int | None = None, effective_ids: bool = False, follow_symlinks: bool = True ) -> bool: ... +async def getcwd() -> str: ... if sys.platform != "win32": from os import statvfs_result diff --git a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/ospath.pyi b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/ospath.pyi index 384996d24..a58637536 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/ospath.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/ospath.pyi @@ -1,7 +1,8 @@ from _typeshed import FileDescriptorOrPath from asyncio.events import AbstractEventLoop from collections.abc import Awaitable, Callable -from typing import Any, TypeVar +from os import PathLike +from typing import Any, AnyStr, TypeVar _R = TypeVar("_R") @@ -9,6 +10,8 @@ def wrap(func: Callable[..., _R]) -> Callable[..., Awaitable[_R]]: ... async def exists(path: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... async def isfile(path: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... async def isdir(s: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... +async def islink(path: FileDescriptorOrPath) -> bool: ... +async def ismount(path: FileDescriptorOrPath) -> bool: ... async def getsize(filename: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> int: ... async def getmtime(filename: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... async def getatime(filename: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> float: ... @@ -17,5 +20,4 @@ async def samefile( f1: FileDescriptorOrPath, f2: FileDescriptorOrPath, *, loop: AbstractEventLoop | None = ..., executor: Any = ... ) -> bool: ... async def sameopenfile(fp1: int, fp2: int, *, loop: AbstractEventLoop | None = ..., executor: Any = ...) -> bool: ... -async def islink(path: FileDescriptorOrPath) -> bool: ... -async def ismount(path: FileDescriptorOrPath) -> bool: ... +async def abspath(path: PathLike[AnyStr] | AnyStr) -> AnyStr: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/tempfile/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/tempfile/__init__.pyi index bfee5b17a..e8016aa8d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/tempfile/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/tempfile/__init__.pyi @@ -1,3 +1,4 @@ +import sys from _typeshed import ( BytesPath, Incomplete, @@ -10,77 +11,13 @@ from _typeshed import ( StrPath, ) from asyncio import AbstractEventLoop -from typing import AnyStr, Literal, TypeVar, overload +from typing import AnyStr, Literal, overload from ..base import AiofilesContextManager from ..threadpool.binary import AsyncBufferedIOBase, AsyncBufferedReader, AsyncFileIO from ..threadpool.text import AsyncTextIOWrapper from .temptypes import AsyncTemporaryDirectory -_T_co = TypeVar("_T_co", covariant=True) -_V_co = TypeVar("_V_co", covariant=True) -_T_contra = TypeVar("_T_contra", contravariant=True) - -# Text mode: always returns AsyncTextIOWrapper -@overload -def NamedTemporaryFile( - mode: OpenTextMode, - buffering: int = -1, - encoding: str | None = None, - newline: str | None = None, - suffix: AnyStr | None = None, - prefix: AnyStr | None = None, - dir: StrOrBytesPath | None = None, - delete: bool = True, - loop: AbstractEventLoop | None = None, - executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... - -# Unbuffered binary: returns a FileIO -@overload -def NamedTemporaryFile( - mode: OpenBinaryMode, - buffering: Literal[0], - encoding: None = None, - newline: None = None, - suffix: AnyStr | None = None, - prefix: AnyStr | None = None, - dir: StrOrBytesPath | None = None, - delete: bool = True, - loop: AbstractEventLoop | None = None, - executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncFileIO]: ... - -# Buffered binary reading/updating: AsyncBufferedReader -@overload -def NamedTemporaryFile( - mode: OpenBinaryModeReading | OpenBinaryModeUpdating = "w+b", - buffering: Literal[-1, 1] = -1, - encoding: None = None, - newline: None = None, - suffix: AnyStr | None = None, - prefix: AnyStr | None = None, - dir: StrOrBytesPath | None = None, - delete: bool = True, - loop: AbstractEventLoop | None = None, - executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedReader]: ... - -# Buffered binary writing: AsyncBufferedIOBase -@overload -def NamedTemporaryFile( - mode: OpenBinaryModeWriting, - buffering: Literal[-1, 1] = -1, - encoding: None = None, - newline: None = None, - suffix: AnyStr | None = None, - prefix: AnyStr | None = None, - dir: StrOrBytesPath | None = None, - delete: bool = True, - loop: AbstractEventLoop | None = None, - executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... - # Text mode: always returns AsyncTextIOWrapper @overload def TemporaryFile( @@ -93,7 +30,7 @@ def TemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... # Unbuffered binary: returns a FileIO @overload @@ -107,7 +44,7 @@ def TemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncFileIO]: ... +) -> AiofilesContextManager[AsyncFileIO]: ... # Buffered binary reading/updating: AsyncBufferedReader @overload @@ -121,7 +58,7 @@ def TemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedReader]: ... +) -> AiofilesContextManager[AsyncBufferedReader]: ... # Buffered binary writing: AsyncBufferedIOBase @overload @@ -135,7 +72,134 @@ def TemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... + +# 3.12 added `delete_on_close` +if sys.version_info >= (3, 12): + # Text mode: always returns AsyncTextIOWrapper + @overload + def NamedTemporaryFile( + mode: OpenTextMode, + buffering: int = -1, + encoding: str | None = None, + newline: str | None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncTextIOWrapper]: ... + + # Unbuffered binary: returns a FileIO + @overload + def NamedTemporaryFile( + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncFileIO]: ... + + # Buffered binary reading/updating: AsyncBufferedReader + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = "w+b", + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedReader]: ... + + # Buffered binary writing: AsyncBufferedIOBase + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + delete_on_close: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedIOBase]: ... + +else: + # Text mode: always returns AsyncTextIOWrapper + @overload + def NamedTemporaryFile( + mode: OpenTextMode, + buffering: int = -1, + encoding: str | None = None, + newline: str | None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncTextIOWrapper]: ... + + # Unbuffered binary: returns a FileIO + @overload + def NamedTemporaryFile( + mode: OpenBinaryMode, + buffering: Literal[0], + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncFileIO]: ... + + # Buffered binary reading/updating: AsyncBufferedReader + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeReading | OpenBinaryModeUpdating = "w+b", + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedReader]: ... + + # Buffered binary writing: AsyncBufferedIOBase + @overload + def NamedTemporaryFile( + mode: OpenBinaryModeWriting, + buffering: Literal[-1, 1] = -1, + encoding: None = None, + newline: None = None, + suffix: AnyStr | None = None, + prefix: AnyStr | None = None, + dir: StrOrBytesPath | None = None, + delete: bool = True, + loop: AbstractEventLoop | None = None, + executor: Incomplete | None = None, + ) -> AiofilesContextManager[AsyncBufferedIOBase]: ... # Text mode: always returns AsyncTextIOWrapper @overload @@ -151,7 +215,7 @@ def SpooledTemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... @overload def SpooledTemporaryFile( max_size: int, @@ -164,7 +228,7 @@ def SpooledTemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... # Unbuffered binary: returns a FileIO @overload @@ -180,7 +244,7 @@ def SpooledTemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncFileIO]: ... +) -> AiofilesContextManager[AsyncFileIO]: ... @overload def SpooledTemporaryFile( max_size: int, @@ -193,7 +257,7 @@ def SpooledTemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncFileIO]: ... +) -> AiofilesContextManager[AsyncFileIO]: ... # Buffered binary reading/updating: AsyncBufferedReader @overload @@ -208,7 +272,7 @@ def SpooledTemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedReader]: ... +) -> AiofilesContextManager[AsyncBufferedReader]: ... # Buffered binary writing: AsyncBufferedIOBase @overload @@ -224,7 +288,7 @@ def SpooledTemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... @overload def SpooledTemporaryFile( max_size: int, @@ -237,7 +301,7 @@ def SpooledTemporaryFile( dir: StrOrBytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... @overload def TemporaryDirectory( suffix: str | None = None, @@ -245,7 +309,7 @@ def TemporaryDirectory( dir: StrPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManagerTempDir[None, None, AsyncTemporaryDirectory]: ... +) -> AiofilesContextManagerTempDir: ... @overload def TemporaryDirectory( suffix: bytes | None = None, @@ -253,7 +317,7 @@ def TemporaryDirectory( dir: BytesPath | None = None, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManagerTempDir[None, None, AsyncTemporaryDirectory]: ... +) -> AiofilesContextManagerTempDir: ... -class AiofilesContextManagerTempDir(AiofilesContextManager[_T_co, _T_contra, _V_co]): +class AiofilesContextManagerTempDir(AiofilesContextManager[AsyncTemporaryDirectory]): async def __aenter__(self) -> str: ... # type: ignore[override] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/threadpool/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/threadpool/__init__.pyi index a7154e759..00c587ccd 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/threadpool/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/aiofiles/aiofiles/threadpool/__init__.pyi @@ -32,7 +32,7 @@ def open( *, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncTextIOWrapper]: ... +) -> AiofilesContextManager[AsyncTextIOWrapper]: ... # Unbuffered binary: returns a FileIO @overload @@ -48,7 +48,7 @@ def open( *, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncFileIO]: ... +) -> AiofilesContextManager[AsyncFileIO]: ... # Buffered binary reading/updating: AsyncBufferedReader @overload @@ -64,7 +64,7 @@ def open( *, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedReader]: ... +) -> AiofilesContextManager[AsyncBufferedReader]: ... # Buffered binary writing: AsyncBufferedIOBase @overload @@ -80,7 +80,7 @@ def open( *, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, AsyncBufferedIOBase]: ... +) -> AiofilesContextManager[AsyncBufferedIOBase]: ... # Buffering cannot be determined: fall back to _UnknownAsyncBinaryIO @overload @@ -96,7 +96,7 @@ def open( *, loop: AbstractEventLoop | None = None, executor: Incomplete | None = None, -) -> AiofilesContextManager[None, None, _UnknownAsyncBinaryIO]: ... +) -> AiofilesContextManager[_UnknownAsyncBinaryIO]: ... stdin: AsyncTextIndirectIOWrapper stdout: AsyncTextIndirectIOWrapper diff --git a/packages/pyright-internal/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi b/packages/pyright-internal/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi index c8de113d3..da161a870 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/assertpy/assertpy/extracting.pyi @@ -1,7 +1,13 @@ +from collections.abc import Callable, Iterable as _Iterable, Mapping from typing import Any from typing_extensions import Self __tracebackhide__: bool class ExtractingMixin: - def extracting(self, *names: Any, **kwargs: dict[str, Any]) -> Self: ... + def extracting( + self, + *names: str, + filter: str | Mapping[str, Any] | Callable[[Any], bool], + sort: str | _Iterable[str] | Callable[[Any], Any], + ) -> Self: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/_types.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/_types.pyi new file mode 100644 index 000000000..a146f2a1e --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/_types.pyi @@ -0,0 +1,8 @@ +# Internal-use module for types shared by multiple modules. +# This does not match a module in docker-py. + +from typing_extensions import TypeAlias + +# Type alias for JSON, explained at: +# https://github.com/python/typing/issues/182#issuecomment-1320974824. +JSON: TypeAlias = dict[str, JSON] | list[JSON] | str | int | float | bool | None diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/container.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/container.pyi index 453863adc..e87d26cca 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/container.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/container.pyi @@ -154,10 +154,10 @@ class ContainerApiMixin: def rename(self, container: _Container, name: str) -> None: ... def resize(self, container: _Container, height: int, width: int) -> None: ... def restart(self, container: _Container, timeout: int = 10) -> None: ... - def start(self, container: _Container, *args, **kwargs) -> None: ... + def start(self, container: _Container) -> None: ... def stats(self, container: _Container, decode: bool | None = None, stream: bool = True, one_shot: bool | None = None): ... def stop(self, container: _Container, timeout: int | None = None) -> None: ... - def top(self, container: _Container, ps_args: str | None = None): ... + def top(self, container: _Container, ps_args: str | None = None) -> str: ... def unpause(self, container: _Container) -> None: ... def update_container( self, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/image.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/image.pyi index f274a2338..034bd633b 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/image.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/image.pyi @@ -1,4 +1,5 @@ from _typeshed import Incomplete +from typing import Any log: Incomplete @@ -39,9 +40,9 @@ class ImageApiMixin: repository: str, tag: str | None = None, stream: bool = False, - auth_config: Incomplete | None = None, + auth_config: dict[str, Any] | None = None, decode: bool = False, - platform: Incomplete | None = None, + platform: str | None = None, all_tags: bool = False, ): ... def push( diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/network.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/network.pyi index f387a42e3..fff9fdfdb 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/network.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/api/network.pyi @@ -1,28 +1,45 @@ from _typeshed import Incomplete +from typing import Any, Literal, TypedDict, type_check_only +from typing_extensions import TypeAlias + +from docker.types import IPAMConfig + +@type_check_only +class _HasId(TypedDict): + Id: str + +@type_check_only +class _HasID(TypedDict): + ID: str + +_Network: TypeAlias = _HasId | _HasID | str +_Container: TypeAlias = _HasId | _HasID | str class NetworkApiMixin: def networks(self, names: Incomplete | None = None, ids: Incomplete | None = None, filters: Incomplete | None = None): ... def create_network( self, - name, - driver: Incomplete | None = None, - options: Incomplete | None = None, - ipam: Incomplete | None = None, - check_duplicate: Incomplete | None = None, + name: str, + driver: str | None = None, + options: dict[str, Any] | None = None, + ipam: IPAMConfig | None = None, + check_duplicate: bool | None = None, internal: bool = False, - labels: Incomplete | None = None, + labels: dict[str, Any] | None = None, enable_ipv6: bool = False, - attachable: Incomplete | None = None, - scope: Incomplete | None = None, - ingress: Incomplete | None = None, - ): ... + attachable: bool | None = None, + scope: Literal["local", "global", "swarm"] | None = None, + ingress: bool | None = None, + ) -> dict[str, str]: ... def prune_networks(self, filters: Incomplete | None = None): ... - def remove_network(self, net_id) -> None: ... - def inspect_network(self, net_id, verbose: Incomplete | None = None, scope: Incomplete | None = None): ... + def remove_network(self, net_id: _Network) -> None: ... + def inspect_network( + self, net_id: _Network, verbose: bool | None = None, scope: Literal["local", "global", "swarm"] | None = None + ): ... def connect_container_to_network( self, - container, - net_id, + container: _Container, + net_id: str, ipv4_address: Incomplete | None = None, ipv6_address: Incomplete | None = None, aliases: Incomplete | None = None, @@ -31,4 +48,4 @@ class NetworkApiMixin: driver_opt: Incomplete | None = None, mac_address: Incomplete | None = None, ) -> None: ... - def disconnect_container_from_network(self, container, net_id, force: bool = False) -> None: ... + def disconnect_container_from_network(self, container: _Container, net_id: str, force: bool = False) -> 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 eeb40ee19..7ffe863dc 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 @@ -71,22 +71,37 @@ class Container(Model): follow: bool | None = None, until: datetime.datetime | float | None = None, ) -> bytes: ... - def pause(self): ... + def pause(self) -> None: ... def put_archive(self, path: str, data) -> bool: ... - def remove(self, **kwargs) -> None: ... + def remove(self, *, v: bool = False, link: bool = False, force: bool = False) -> None: ... def rename(self, name: str): ... def resize(self, height: int, width: int): ... - def restart(self, **kwargs): ... - def start(self, **kwargs) -> None: ... + def restart(self, *, timeout: float | None = 10): ... + def start(self) -> None: ... def stats(self, **kwargs): ... def stop(self, *, timeout: float | None = None) -> None: ... - def top(self, **kwargs): ... + def top(self, *, ps_args: str | None = None) -> str: ... def unpause(self): ... - def update(self, **kwargs): ... + def update( + self, + *, + blkio_weight: int | None = None, + cpu_period: int | None = None, + cpu_quota: int | None = None, + cpu_shares: int | None = None, + cpuset_cpus: str | None = None, + cpuset_mems: str | None = None, + mem_limit: float | str | None = None, + mem_reservation: float | str | None = None, + memswap_limit: int | str | None = None, + kernel_memory: int | str | None = None, + restart_policy: Incomplete | None = None, + ): ... def wait(self, *, timeout: float | None = None, condition: Literal["not-running", "next-exit", "removed"] | None = None): ... class ContainerCollection(Collection[Container]): model: type[Container] + @overload def run( self, image: str | Image, @@ -94,8 +109,22 @@ class ContainerCollection(Collection[Container]): stdout: bool = True, stderr: bool = False, remove: bool = False, + *, + detach: Literal[False] = False, **kwargs, - ): ... + ) -> bytes: ... + @overload + def run( + self, + image: str | Image, + command: str | list[str] | None = None, + stdout: bool = True, + stderr: bool = False, + remove: bool = False, + *, + detach: Literal[True], + **kwargs, + ) -> Container: ... def create(self, image: str, command: str | list[str] | None = None, **kwargs) -> Container: ... # type:ignore[override] def get(self, container_id: str) -> Container: ... def list( diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/images.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/images.pyi index 8646399ce..279bd6dcf 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/images.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/images.pyi @@ -1,11 +1,21 @@ from collections.abc import Iterator -from typing import Any, Literal, overload +from io import StringIO +from typing import IO, Any, Literal, TypedDict, overload, type_check_only from typing_extensions import TypeAlias +from docker._types import JSON + from .resource import Collection, Model _ImageList: TypeAlias = list[Image] # To resolve conflicts with a method called "list" +@type_check_only +class _ContainerLimits(TypedDict, total=False): + memory: int + memswap: int + cpushares: int + cpusetcpus: str + class Image(Model): @property def labels(self) -> dict[str, Any]: ... @@ -31,17 +41,69 @@ class RegistryData(Model): class ImageCollection(Collection[Image]): model: type[Image] - def build(self, **kwargs) -> tuple[Image, Iterator[Any]]: ... + def build( + self, + *, + path: str | None = None, + fileobj: StringIO | IO[bytes] | None = None, + tag: str | None = None, + quiet: bool = False, + nocache: bool = False, + rm: bool = False, + timeout: int | None = None, + custom_context: bool = False, + encoding: str | None = None, + pull: bool = False, + forcerm: bool = False, + dockerfile: str | None = None, + buildargs: dict[str, Any] | None = None, + container_limits: _ContainerLimits | None = None, + shmsize: int | None = None, + labels: dict[str, Any] | None = None, + # need to use list, because the type must be json serializable + cache_from: list[str] | None = None, + target: str | None = None, + network_mode: str | None = None, + squash: bool | None = None, + extra_hosts: list[str] | dict[str, str] | None = None, + platform: str | None = None, + isolation: str | None = None, + use_config_proxy: bool = True, + ) -> tuple[Image, Iterator[JSON]]: ... def get(self, name: str) -> Image: ... def get_registry_data(self, name, auth_config: dict[str, Any] | None = None) -> RegistryData: ... def list(self, name: str | None = None, all: bool = False, filters: dict[str, Any] | None = None) -> _ImageList: ... def load(self, data: bytes) -> _ImageList: ... @overload - def pull(self, repository: str, tag: str | None = None, all_tags: Literal[False] = False, **kwargs) -> Image: ... + def pull( + self, + repository: str, + tag: str | None = None, + all_tags: Literal[False] = False, + *, + platform: str | None = None, + auth_config: dict[str, Any] | None = None, + ) -> Image: ... @overload - def pull(self, repository: str, tag: str | None = None, *, all_tags: Literal[True], **kwargs) -> _ImageList: ... + def pull( + self, + repository: str, + tag: str | None = None, + *, + all_tags: Literal[True], + auth_config: dict[str, Any] | None = None, + platform: str | None = None, + ) -> _ImageList: ... @overload - def pull(self, repository: str, tag: str | None, all_tags: Literal[True], **kwargs) -> _ImageList: ... + def pull( + self, + repository: str, + tag: str | None, + all_tags: Literal[True], + *, + auth_config: dict[str, Any] | None = None, + platform: str | None = None, + ) -> _ImageList: ... def push(self, repository: str, tag: str | None = None, **kwargs): ... def remove(self, *args, **kwargs) -> None: ... def search(self, *args, **kwargs): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/networks.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/networks.pyi index e84babdfe..86cca6416 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/networks.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/models/networks.pyi @@ -1,4 +1,6 @@ -from typing import Any +from typing import Any, Literal + +from docker.types import IPAMConfig from .containers import Container from .resource import Collection, Model @@ -14,7 +16,22 @@ class Network(Model): class NetworkCollection(Collection[Network]): model: type[Network] - def create(self, name: str, *args, **kwargs) -> Network: ... # type:ignore[override] - def get(self, network_id: str, *args, **kwargs) -> Network: ... # type:ignore[override] + def create( # type:ignore[override] + self, + name: str, + driver: str | None = None, + options: dict[str, Any] | None = None, + ipam: IPAMConfig | None = None, + check_duplicate: bool | None = None, + internal: bool = False, + labels: dict[str, Any] | None = None, + enable_ipv6: bool = False, + attachable: bool | None = None, + scope: Literal["local", "global", "swarm"] | None = None, + ingress: bool | None = None, + ) -> Network: ... + def get( + self, network_id: str, verbose: bool | None = None, scope: Literal["local", "global", "swarm"] | None = None + ) -> Network: ... # type:ignore[override] def list(self, *args, **kwargs) -> list[Network]: ... def prune(self, filters: dict[str, Any] | None = None) -> dict[str, Any]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/types/containers.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/types/containers.pyi index 891137e94..d3b3a2fb6 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/types/containers.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/types/containers.pyi @@ -1,6 +1,14 @@ from _typeshed import Incomplete +from pathlib import Path +from typing import Literal, TypedDict, type_check_only from .base import DictType +from .services import Mount + +@type_check_only +class ContainerWeightDevice(TypedDict): + Path: Path + Weight: int class LogConfigTypesEnum: JSON: Incomplete @@ -63,71 +71,71 @@ class DeviceRequest(DictType): class HostConfig(dict[str, Incomplete]): def __init__( self, - version, + version: str, binds: Incomplete | None = None, port_bindings: Incomplete | None = None, - lxc_conf: Incomplete | None = None, + lxc_conf: dict[Incomplete, Incomplete] | None = None, publish_all_ports: bool = False, - links: Incomplete | None = None, + links: dict[str, str | None] | None = None, privileged: bool = False, - dns: Incomplete | None = None, - dns_search: Incomplete | None = None, - volumes_from: Incomplete | None = None, - network_mode: Incomplete | None = None, - restart_policy: Incomplete | None = None, - cap_add: Incomplete | None = None, - cap_drop: Incomplete | None = None, - devices: Incomplete | None = None, - extra_hosts: Incomplete | None = None, - read_only: Incomplete | None = None, - pid_mode: Incomplete | None = None, - ipc_mode: Incomplete | None = None, - security_opt: Incomplete | None = None, - ulimits: Incomplete | None = None, - log_config: Incomplete | None = None, - mem_limit: Incomplete | None = None, - memswap_limit: Incomplete | None = None, - mem_reservation: Incomplete | None = None, - kernel_memory: Incomplete | None = None, - mem_swappiness: Incomplete | None = None, - cgroup_parent: Incomplete | None = None, - group_add: Incomplete | None = None, - cpu_quota: Incomplete | None = None, - cpu_period: Incomplete | None = None, - blkio_weight: Incomplete | None = None, - blkio_weight_device: Incomplete | None = None, + dns: list[Incomplete] | None = None, + dns_search: list[Incomplete] | None = None, + volumes_from: list[str] | None = None, + network_mode: str | None = None, + restart_policy: dict[Incomplete, Incomplete] | None = None, + cap_add: list[str] | None = None, + cap_drop: list[str] | None = None, + devices: list[str] | None = None, + extra_hosts: dict[Incomplete, Incomplete] | None = None, + read_only: bool | None = None, + pid_mode: str | None = None, + ipc_mode: str | None = None, + security_opt: list[str] | None = None, + ulimits: list[Ulimit] | None = None, + log_config: LogConfig | None = None, + mem_limit: str | int | None = None, + memswap_limit: str | int | None = None, + mem_reservation: str | int | None = None, + kernel_memory: str | int | None = None, + mem_swappiness: int | None = None, + cgroup_parent: str | None = None, + group_add: list[str | int] | None = None, + cpu_quota: int | None = None, + cpu_period: int | None = None, + blkio_weight: int | None = None, + blkio_weight_device: list[ContainerWeightDevice] | None = None, device_read_bps: Incomplete | None = None, device_write_bps: Incomplete | None = None, device_read_iops: Incomplete | None = None, device_write_iops: Incomplete | None = None, oom_kill_disable: bool = False, - shm_size: Incomplete | None = None, - sysctls: Incomplete | None = None, - tmpfs: Incomplete | None = None, - oom_score_adj: Incomplete | None = None, - dns_opt: Incomplete | None = None, - cpu_shares: Incomplete | None = None, - cpuset_cpus: Incomplete | None = None, - userns_mode: Incomplete | None = None, - uts_mode: Incomplete | None = None, - pids_limit: Incomplete | None = None, - isolation: Incomplete | None = None, + shm_size: str | int | None = None, + sysctls: dict[Incomplete, Incomplete] | None = None, + tmpfs: dict[str, str] | None = None, + oom_score_adj: int | None = None, + dns_opt: list[Incomplete] | None = None, + cpu_shares: int | None = None, + cpuset_cpus: str | None = None, + userns_mode: str | None = None, + uts_mode: str | None = None, + pids_limit: int | None = None, + isolation: str | None = None, auto_remove: bool = False, - storage_opt: Incomplete | None = None, - init: Incomplete | None = None, - init_path: Incomplete | None = None, - volume_driver: Incomplete | None = None, - cpu_count: Incomplete | None = None, - cpu_percent: Incomplete | None = None, - nano_cpus: Incomplete | None = None, - cpuset_mems: Incomplete | None = None, - runtime: Incomplete | None = None, - mounts: Incomplete | None = None, - cpu_rt_period: Incomplete | None = None, - cpu_rt_runtime: Incomplete | None = None, - device_cgroup_rules: Incomplete | None = None, - device_requests: Incomplete | None = None, - cgroupns: Incomplete | None = None, + storage_opt: dict[Incomplete, Incomplete] | None = None, + init: bool | None = None, + init_path: str | None = None, + volume_driver: str | None = None, + cpu_count: int | None = None, + cpu_percent: int | None = None, + nano_cpus: int | None = None, + cpuset_mems: str | None = None, + runtime: str | None = None, + mounts: list[Mount] | None = None, + cpu_rt_period: int | None = None, + cpu_rt_runtime: int | None = None, + device_cgroup_rules: list[Incomplete] | None = None, + device_requests: list[DeviceRequest] | None = None, + cgroupns: Literal["private", "host"] | None = None, ) -> None: ... def host_config_type_error(param, param_value, expected): ... @@ -138,27 +146,27 @@ def host_config_incompatible_error(param, param_value, incompatible_param): ... class ContainerConfig(dict[str, Incomplete]): def __init__( self, - version, + version: str, image, - command, - hostname: Incomplete | None = None, - user: Incomplete | None = None, + command: str | list[str], + hostname: str | None = None, + user: str | int | None = None, detach: bool = False, stdin_open: bool = False, tty: bool = False, - ports: Incomplete | None = None, - environment: Incomplete | None = None, - volumes: Incomplete | None = None, + ports: dict[str, int | None] | None = None, + environment: dict[str, str] | list[str] | None = None, + volumes: str | list[str] | None = None, network_disabled: bool = False, - entrypoint: Incomplete | None = None, - working_dir: Incomplete | None = None, - domainname: Incomplete | None = None, + entrypoint: str | list[str] | None = None, + working_dir: str | None = None, + domainname: str | None = None, host_config: Incomplete | None = None, - mac_address: Incomplete | None = None, - labels: Incomplete | None = None, - stop_signal: Incomplete | None = None, + mac_address: str | None = None, + labels: dict[str, str] | list[str] | None = None, + stop_signal: str | None = None, networking_config: Incomplete | None = None, healthcheck: Incomplete | None = None, - stop_timeout: Incomplete | None = None, - runtime: Incomplete | None = None, + stop_timeout: int | None = None, + runtime: str | None = None, ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/utils/json_stream.pyi b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/utils/json_stream.pyi index 39ddd9d18..883144018 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/utils/json_stream.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/docker/docker/utils/json_stream.pyi @@ -1,17 +1,14 @@ import json from collections.abc import Callable, Generator, Iterator from typing import Any -from typing_extensions import TypeAlias + +from docker._types import JSON json_decoder: json.JSONDecoder -# Type alias for JSON, explained at: -# https://github.com/python/typing/issues/182#issuecomment-1320974824. -_JSON: TypeAlias = dict[str, _JSON] | list[_JSON] | str | int | float | bool | None - def stream_as_text(stream: Iterator[str | bytes]) -> Generator[str, None, None]: ... -def json_splitter(buffer: str) -> tuple[_JSON, str] | None: ... -def json_stream(stream: Iterator[str]) -> Generator[_JSON, None, None]: ... +def json_splitter(buffer: str) -> tuple[JSON, str] | None: ... +def json_stream(stream: Iterator[str]) -> Generator[JSON, None, None]: ... def line_splitter(buffer: str, separator: str = "\n") -> tuple[str, str] | None: ... def split_buffer( stream: Iterator[str | bytes], splitter: Callable[[str], tuple[str, str]] | None = None, decoder: Callable[[str], Any] = ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/flake8/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/flake8/METADATA.toml index 36c0facd5..8400594dc 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/flake8/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/flake8/METADATA.toml @@ -1,3 +1,3 @@ -version = "7.0.*" +version = "7.1.*" upstream_repository = "https://github.com/pycqa/flake8" requires = ["types-pyflakes"] 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 9c891c60c..f364de981 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/fpdf.pyi @@ -25,9 +25,11 @@ from .enums import ( RenderStyle, TableBordersLayout, TableCellFillMode, + TableHeadingsDisplay, TextDirection, TextMarkupType, TextMode as TextMode, + VAlign, WrapMode as WrapMode, XPos as XPos, YPos as YPos, @@ -41,14 +43,14 @@ from .image_datastructures import ( ImageInfo as ImageInfo, RasterImageInfo as RasterImageInfo, VectorImageInfo as VectorImageInfo, - _AlignLiteral, + _TextAlign, ) from .output import OutputProducer, PDFPage from .recorder import FPDFRecorder from .structure_tree import StructureTreeBuilder from .syntax import DestinationXYZ from .table import Table -from .util import _Unit +from .util import Padding, _Unit __all__ = [ "FPDF", @@ -489,7 +491,7 @@ class FPDF(GraphicsStateMixin): ncols: int = 1, gutter: float = 10, balance: bool = False, - text_align: Align | _AlignLiteral = "LEFT", + text_align: str | _TextAlign | tuple[_TextAlign | str, ...] = "LEFT", line_height: float = 1, l_margin: float | None = None, r_margin: float | None = None, @@ -570,17 +572,26 @@ class FPDF(GraphicsStateMixin): self, rows: Iterable[Incomplete] = (), *, - align: str | Align = "CENTER", + # Keep in sync with `fpdf.table.Table`: + align: str | _TextAlign = "CENTER", + v_align: str | VAlign = "MIDDLE", borders_layout: str | TableBordersLayout = ..., cell_fill_color: int | tuple[Incomplete, ...] | DeviceGray | DeviceRGB | None = None, cell_fill_mode: str | TableCellFillMode = ..., col_widths: int | tuple[int, ...] | None = None, first_row_as_headings: bool = True, + gutter_height: float = 0, + gutter_width: float = 0, headings_style: FontFace = ..., line_height: int | None = None, markdown: bool = False, - text_align: str | Align = "JUSTIFY", + text_align: str | _TextAlign | tuple[str | _TextAlign, ...] = "JUSTIFY", width: int | None = None, + wrapmode: WrapMode = ..., + padding: float | Padding | None = None, + outer_border_width: float | None = None, + num_heading_rows: int = 1, + repeat_headings: TableHeadingsDisplay | int = 1, ) -> _GeneratorContextManager[Table]: ... @overload def output( # type: ignore[overload-overlap] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_datastructures.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_datastructures.pyi index 06f422893..b81fb5865 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_datastructures.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/image_datastructures.pyi @@ -31,6 +31,7 @@ _AlignLiteral: TypeAlias = Literal[ "r", "j", ] +_TextAlign: TypeAlias = Align | _AlignLiteral class ImageInfo(dict[str, Any]): @property @@ -43,7 +44,7 @@ class ImageInfo(dict[str, Any]): def rendered_height(self) -> int: ... def scale_inside_box(self, x: float, y: float, w: float, h: float) -> tuple[float, float, float, float]: ... @staticmethod - def x_by_align(x: Align | _AlignLiteral, w: float, pdf: FPDF, keep_aspect_ratio: Literal[False]) -> float: ... + def x_by_align(x: _TextAlign, w: float, pdf: FPDF, keep_aspect_ratio: Literal[False]) -> float: ... class RasterImageInfo(ImageInfo): def size_in_document_units(self, w: float, h: float, scale=1) -> tuple[float, float]: ... 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 daea652fd..a3430949d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/table.pyi @@ -10,6 +10,7 @@ from .drawing import DeviceGray, DeviceRGB from .enums import Align, TableBordersLayout, TableCellFillMode, TableHeadingsDisplay, TableSpan, VAlign, WrapMode from .fonts import FontFace from .fpdf import FPDF +from .image_datastructures import _TextAlign from .util import Padding DEFAULT_HEADINGS_STYLE: FontFace @@ -22,7 +23,8 @@ class Table: fpdf: FPDF, rows: Iterable[str] = (), *, - align: str | Align = "CENTER", + # Keep in sync with `fpdf.fpdf.FPDF.table`: + align: str | _TextAlign = "CENTER", v_align: str | VAlign = "MIDDLE", borders_layout: str | TableBordersLayout = ..., cell_fill_color: int | tuple[Incomplete, ...] | DeviceGray | DeviceRGB | None = None, @@ -34,7 +36,7 @@ class Table: headings_style: FontFace = ..., line_height: int | None = None, markdown: bool = False, - text_align: str | Align = "JUSTIFY", + text_align: str | _TextAlign | tuple[str | _TextAlign, ...] = "JUSTIFY", width: int | None = None, wrapmode: WrapMode = ..., padding: float | Padding | None = None, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/text_region.pyi b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/text_region.pyi index bbdf463b3..a9d4c2920 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/text_region.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/fpdf2/fpdf/text_region.pyi @@ -4,7 +4,7 @@ from typing import NamedTuple from typing_extensions import Self from .enums import Align, WrapMode -from .image_datastructures import RasterImageInfo, VectorImageInfo, _AlignLiteral +from .image_datastructures import RasterImageInfo, VectorImageInfo, _TextAlign class Extents(NamedTuple): left: float @@ -24,7 +24,7 @@ class LineWrapper(NamedTuple): class Paragraph: pdf: Incomplete - text_align: Incomplete + text_align: Align line_height: Incomplete top_margin: Incomplete bottom_margin: Incomplete @@ -34,7 +34,7 @@ class Paragraph: def __init__( self, region, - text_align: Incomplete | None = None, + text_align: _TextAlign | None = None, line_height: Incomplete | None = None, top_margin: float = 0, bottom_margin: float = 0, @@ -67,7 +67,7 @@ class ImageParagraph: self, region, name, - align: Align | _AlignLiteral | None = None, + align: _TextAlign | None = None, width: float | None = None, height: float | None = None, fill_width: bool = False, @@ -93,7 +93,7 @@ class ParagraphCollectorMixin: pdf, *args, text: str | None = None, - text_align: Align | _AlignLiteral = "LEFT", + text_align: _TextAlign = "LEFT", line_height: float = 1.0, print_sh: bool = False, skip_leading_spaces: bool = False, @@ -108,7 +108,7 @@ class ParagraphCollectorMixin: def ln(self, h: float | None = None) -> None: ... def paragraph( self, - text_align: Incomplete | None = None, + text_align: _TextAlign | None = None, line_height: Incomplete | None = None, skip_leading_spaces: bool = False, top_margin: int = 0, @@ -119,7 +119,7 @@ class ParagraphCollectorMixin: def image( self, name, - align: Align | _AlignLiteral | None = None, + align: _TextAlign | None = None, width: float | None = None, height: float | None = None, fill_width: bool = False, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/METADATA.toml index 77829fb62..cbdd4b60f 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.20.*" +version = "2.21.*" # upstream_repository = closed-source diff --git a/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/hdbcli/dbapi.pyi b/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/hdbcli/dbapi.pyi index c9fb23f17..4ba75f81b 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/hdbcli/dbapi.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/hdbcli/hdbcli/dbapi.pyi @@ -38,6 +38,7 @@ class Connection: def rollback(self) -> None: ... def setautocommit(self, auto: bool = ...) -> None: ... def setclientinfo(self, key: str, value: str | None = ...) -> None: ... + def ontrace(self) -> None: ... connect = Connection diff --git a/packages/pyright-internal/typeshed-fallback/stubs/hvac/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/hvac/METADATA.toml index 911834e93..f16271580 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/hvac/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/hvac/METADATA.toml @@ -1,3 +1,3 @@ -version = "2.2.*" +version = "2.3.*" upstream_repository = "https://github.com/hvac/hvac" requires = ["types-requests"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/raft.pyi b/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/raft.pyi index 7a13149ed..ebd9051d1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/raft.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/raft.pyi @@ -1,6 +1,8 @@ from _typeshed import Incomplete +from typing import Any from hvac.api.system_backend.system_backend_mixin import SystemBackendMixin +from requests import Response class Raft(SystemBackendMixin): def join_raft_cluster( @@ -16,3 +18,10 @@ class Raft(SystemBackendMixin): def take_raft_snapshot(self): ... def restore_raft_snapshot(self, snapshot): ... def force_restore_raft_snapshot(self, snapshot): ... + def read_raft_auto_snapshot_status(self, name: str) -> Response: ... + def read_raft_auto_snapshot_config(self, name: str) -> Response: ... + def list_raft_auto_snapshot_configs(self) -> Response: ... + def create_or_update_raft_auto_snapshot_config( + self, name: str, interval: str, storage_type: str, retain: int = 1, **kwargs: Any + ) -> Response: ... + def delete_raft_auto_snapshot_config(self, name: str) -> Response: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/wrapping.pyi b/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/wrapping.pyi index 4ca4167cb..450f9c841 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/wrapping.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/hvac/hvac/api/system_backend/wrapping.pyi @@ -4,3 +4,4 @@ from hvac.api.system_backend.system_backend_mixin import SystemBackendMixin class Wrapping(SystemBackendMixin): def unwrap(self, token: Incomplete | None = None): ... + def wrap(self, payload: dict[Incomplete, Incomplete] | None = None, ttl: int = 60): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/METADATA.toml index e8b3b5471..74f497ce4 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/METADATA.toml @@ -1,4 +1,4 @@ -version = "1.43.*" +version = "1.44.*" upstream_repository = "https://github.com/influxdata/influxdb-client-python" # requires a version of urllib3 with a py.typed file requires = ["urllib3>=2"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/_pages.pyi b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/_pages.pyi new file mode 100644 index 000000000..1ecf38d5f --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/_pages.pyi @@ -0,0 +1,37 @@ +from collections.abc import Callable +from typing import Any, Generic, Protocol, TypeVar +from typing_extensions import Self + +class _HasId(Protocol): + @property + def id(self) -> str | None: ... + +_R = TypeVar("_R", default=Any) +_T = TypeVar("_T", bound=_HasId) + +class _Page(Generic[_T]): + has_next: bool + values: list[_T] + next_after: str | None + + def __init__(self, values: list[_T], has_next: bool, next_after: str | None) -> None: ... + @staticmethod + def empty() -> _Page[_T]: ... + @staticmethod + def initial(after: str | None) -> _Page[_T]: ... + +class _PageIterator(Generic[_T]): + page: _Page[_T] + get_next_page: Callable[[_Page[_T]], _Page[_T]] + + def __init__(self, page: _Page[_T], get_next_page: Callable[[_Page[_T]], _Page[_T]]) -> None: ... + def __iter__(self) -> Self: ... + def __next__(self) -> _T: ... + +class _Paginated(Generic[_T, _R]): + paginated_getter: Callable[..., _R] # Gets passed additional kwargs to find_iter(). + pluck_page_resources_from_response: Callable[[_R], list[_T]] + def __init__( + self, paginated_getter: Callable[..., _R], pluck_page_resources_from_response: Callable[[_R], list[_T]] + ) -> None: ... + def find_iter(self, *, after: str | None = None, **kwargs: Any) -> _PageIterator[_T]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/bucket_api.pyi b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/bucket_api.pyi index b50467a24..d1cd792d3 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/bucket_api.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/bucket_api.pyi @@ -1,6 +1,7 @@ from _typeshed import Incomplete -from influxdb_client import Bucket +from ..domain.bucket import Bucket +from ._pages import _PageIterator class BucketsApi: def __init__(self, influxdb_client) -> None: ... @@ -18,3 +19,6 @@ class BucketsApi: def find_bucket_by_id(self, id): ... def find_bucket_by_name(self, bucket_name): ... def find_buckets(self, **kwargs): ... + def find_buckets_iter( + self, *, name: str = ..., org: str = ..., org_id: str = ..., after: str | None = None, limit: int = ... + ) -> _PageIterator[Bucket]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/tasks_api.pyi b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/tasks_api.pyi index 36f2d63ea..15a5110df 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/tasks_api.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/client/tasks_api.pyi @@ -1,9 +1,10 @@ -from collections.abc import Iterator from datetime import datetime from influxdb_client import LabelResponse, LogEvent, Run, TaskCreateRequest, TaskUpdateRequest from influxdb_client.domain.task import Task +from ._pages import _PageIterator + class TasksApi: def __init__(self, influxdb_client) -> None: ... def find_task_by_id(self, task_id) -> Task: ... @@ -11,8 +12,8 @@ class TasksApi: self, *, name: str = ..., after: str = ..., user: str = ..., org: str = ..., org_id: str = ..., limit: int = ..., **kwargs ) -> list[Task]: ... def find_tasks_iter( - self, *, name: str = ..., after: str = ..., user: str = ..., org: str = ..., org_id: str = ..., limit: int = ..., **kwargs - ) -> Iterator[Task]: ... + self, *, name: str = ..., after: str | None = None, user: str = ..., org: str = ..., org_id: str = ..., limit: int = ... + ) -> _PageIterator[Task]: ... def create_task(self, task: Task | None = None, task_create_request: TaskCreateRequest | None = None) -> Task: ... def create_task_every(self, name, flux, every, organization) -> Task: ... def create_task_cron(self, name: str, flux: str, cron: str, org_id: str) -> Task: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/bucket.pyi b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/bucket.pyi index c0110c298..fe7a86461 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/bucket.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/bucket.pyi @@ -7,11 +7,11 @@ class Bucket: def __init__( self, links: Incomplete | None = None, - id: Incomplete | None = None, + id: str | None = None, type: str = "user", name: Incomplete | None = None, description: Incomplete | None = None, - org_id: Incomplete | None = None, + org_id: str | None = None, rp: Incomplete | None = None, schema_type: Incomplete | None = None, created_at: Incomplete | None = None, @@ -24,9 +24,9 @@ class Bucket: @links.setter def links(self, links) -> None: ... @property - def id(self): ... + def id(self) -> str | None: ... @id.setter - def id(self, id) -> None: ... + def id(self, id: str) -> None: ... @property def type(self): ... @type.setter @@ -40,9 +40,9 @@ class Bucket: @description.setter def description(self, description) -> None: ... @property - def org_id(self): ... + def org_id(self) -> str | None: ... @org_id.setter - def org_id(self, org_id) -> None: ... + def org_id(self, org_id: str) -> None: ... @property def rp(self): ... @rp.setter diff --git a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/task.pyi b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/task.pyi index 84140e219..1d0d63102 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/task.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/influxdb-client/influxdb_client/domain/task.pyi @@ -6,8 +6,8 @@ class Task: discriminator: Incomplete def __init__( self, - id: Incomplete | None = None, - org_id: Incomplete | None = None, + id: str | None = None, + org_id: str | None = None, org: Incomplete | None = None, name: Incomplete | None = None, owner_id: Incomplete | None = None, @@ -27,13 +27,13 @@ class Task: links: Incomplete | None = None, ) -> None: ... @property - def id(self): ... + def id(self) -> str | None: ... @id.setter - def id(self, id) -> None: ... + def id(self, id: str) -> None: ... @property - def org_id(self): ... + def org_id(self) -> str | None: ... @org_id.setter - def org_id(self, org_id) -> None: ... + def org_id(self, org_id: str) -> None: ... @property def org(self): ... @org.setter diff --git a/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml index d572cfc2e..d808108cf 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/networkx/METADATA.toml @@ -1,6 +1,8 @@ version = "3.2.1" upstream_repository = "https://github.com/networkx/networkx" -requires = ["numpy"] +# requires a version of numpy with a `py.typed` file +# TODO: Lots of stubtest errors when using numpy 2 +requires = ["numpy>=1.20,<2"] partial_stub = true [tool.stubtest] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/olefile/olefile/olefile.pyi b/packages/pyright-internal/typeshed-fallback/stubs/olefile/olefile/olefile.pyi index b1df2da29..7637bf9d3 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/olefile/olefile/olefile.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/olefile/olefile/olefile.pyi @@ -4,8 +4,8 @@ import io import logging import traceback from collections.abc import Sequence -from typing import IO -from typing_extensions import Self +from typing import IO, AnyStr, Generic +from typing_extensions import Self, TypeAlias __date__: str __version__: str @@ -137,7 +137,7 @@ class OleMetadata: DOCSUM_ATTRIBS: list[str] def __init__(self) -> None: ... - def parse_properties(self, ole_file: OleFileIO) -> None: ... + def parse_properties(self, ole_file: OleFileIO[AnyStr]) -> None: ... def dump(self) -> None: ... class OleFileIONotClosed(RuntimeWarning): @@ -153,29 +153,34 @@ class OleStream(io.BytesIO): sectorsize: int, fat: list[int], filesize: int, - olefileio: OleFileIO, + olefileio: OleFileIO[AnyStr], ) -> None: ... -class OleDirectoryEntry: +class OleDirectoryEntry(Generic[AnyStr]): STRUCT_DIRENTRY: str DIRENTRY_SIZE: int + clsid: str - def __init__(self, entry: bytes, sid: int, ole_file: OleFileIO) -> None: ... - def build_sect_chain(self, ole_file: OleFileIO) -> None: ... + def __init__(self, entry: bytes, sid: int, ole_file: OleFileIO[AnyStr]) -> None: ... + def build_sect_chain(self, ole_file: OleFileIO[AnyStr]) -> None: ... def build_storage_tree(self) -> None: ... def append_kids(self, child_sid: int) -> None: ... - def __eq__(self, other: OleDirectoryEntry) -> bool: ... # type: ignore[override] - def __lt__(self, other: OleDirectoryEntry) -> bool: ... # type: ignore[override] - def __ne__(self, other: OleDirectoryEntry) -> bool: ... # type: ignore[override] - def __le__(self, other: OleDirectoryEntry) -> bool: ... # type: ignore[override] + def __eq__(self, other: OleDirectoryEntry[AnyStr]) -> bool: ... # type: ignore[override] + def __lt__(self, other: OleDirectoryEntry[AnyStr]) -> bool: ... # type: ignore[override] + def __ne__(self, other: OleDirectoryEntry[AnyStr]) -> bool: ... # type: ignore[override] + def __le__(self, other: OleDirectoryEntry[AnyStr]) -> bool: ... # type: ignore[override] def dump(self, tab: int = 0) -> None: ... def getmtime(self) -> datetime.datetime | None: ... def getctime(self) -> datetime.datetime | None: ... -class OleFileIO: +_Property: TypeAlias = int | str | bytes | bool | None + +class OleFileIO(Generic[AnyStr]): + root: OleDirectoryEntry[AnyStr] | None + def __init__( self, - filename: IO[bytes] | bytes | str | None = None, + filename: IO[bytes] | AnyStr | None = None, raise_defects: int = 40, write_mode: bool = False, debug: bool = False, @@ -187,8 +192,8 @@ class OleFileIO: def _raise_defect( self, defect_level: int, message: str, exception_type: type[Exception] = OleFileError # noqa: Y011 ) -> None: ... - def _decode_utf16_str(self, utf16_str: bytes, errors: str = "replace") -> bytes: ... - def open(self, filename: IO[bytes] | bytes | str, write_mode: bool = False) -> None: ... + def _decode_utf16_str(self, utf16_str: bytes, errors: str = "replace") -> str | bytes: ... + def open(self, filename: IO[bytes] | AnyStr, write_mode: bool = False) -> None: ... def close(self) -> None: ... def _close(self, warn: bool = False) -> None: ... def _check_duplicate_stream(self, first_sect: int, minifat: bool = False) -> None: ... @@ -202,36 +207,41 @@ class OleFileIO: def write_sect(self, sect: int, data: bytes, padding: bytes = b"\x00") -> None: ... def _write_mini_sect(self, fp_pos: int, data: bytes, padding: bytes = b"\x00") -> None: ... def loaddirectory(self, sect: int) -> None: ... - def _load_direntry(self, sid: int) -> OleDirectoryEntry: ... + def _load_direntry(self, sid: int) -> OleDirectoryEntry[AnyStr]: ... def dumpdirectory(self) -> None: ... def _open(self, start: int, size: int = 0x7FFFFFFF, force_FAT: bool = False) -> OleStream: ... def _list( - self, files: list[list[bytes]], prefix: list[bytes], node: OleDirectoryEntry, streams: bool = True, storages: bool = False + self, + files: list[list[AnyStr]], + prefix: list[AnyStr], + node: OleDirectoryEntry[AnyStr], + streams: bool = True, + storages: bool = False, ) -> None: ... - def listdir(self, streams: bool = True, storages: bool = False) -> list[list[bytes]]: ... + def listdir(self, streams: bool = True, storages: bool = False) -> list[list[AnyStr]]: ... def _find(self, filename: str | Sequence[str]) -> int: ... - def openstream(self, filename: str | Sequence[str]) -> OleStream: ... - def _write_mini_stream(self, entry: OleDirectoryEntry, data_to_write: bytes) -> None: ... + def openstream(self, filename: AnyStr | Sequence[AnyStr]) -> OleStream: ... + def _write_mini_stream(self, entry: OleDirectoryEntry[AnyStr], data_to_write: bytes) -> None: ... def write_stream(self, stream_name: str | Sequence[str], data: bytes) -> None: ... - def get_type(self, filename: str | Sequence[str]) -> bool | int: ... - def getclsid(self, filename: str | Sequence[str]) -> str: ... - def getmtime(self, filename: str | Sequence[str]) -> datetime.datetime | None: ... - def getctime(self, filename: str | Sequence[str]) -> datetime.datetime | None: ... - def exists(self, filename: str | Sequence[str]) -> bool: ... - def get_size(self, filename: str | Sequence[str]) -> int: ... + def get_type(self, filename: AnyStr | Sequence[AnyStr]) -> bool | int: ... + def getclsid(self, filename: AnyStr | Sequence[AnyStr]) -> str: ... + def getmtime(self, filename: AnyStr | Sequence[AnyStr]) -> datetime.datetime | None: ... + def getctime(self, filename: AnyStr | Sequence[AnyStr]) -> datetime.datetime | None: ... + def exists(self, filename: AnyStr | Sequence[AnyStr]) -> bool: ... + def get_size(self, filename: AnyStr | Sequence[AnyStr]) -> int: ... def get_rootentry_name(self) -> bytes: ... def getproperties( - self, filename: str | Sequence[str], convert_time: bool = False, no_conversion: list[int] | None = None - ) -> dict[int, list[int | str | bytes | bool | None]]: ... + self, filename: AnyStr | Sequence[AnyStr], convert_time: bool = False, no_conversion: list[int] | None = None + ) -> dict[int, list[_Property] | _Property]: ... def _parse_property( self, s: bytes, offset: int, property_id: int, property_type: int, convert_time: bool, no_conversion: list[int] - ) -> list[int | str | bytes | bool | None] | None: ... + ) -> list[_Property] | _Property: ... def _parse_property_basic( self, s: bytes, offset: int, property_id: int, property_type: int, convert_time: bool, no_conversion: list[int] - ) -> tuple[int | str | bytes | bool | None, int]: ... + ) -> tuple[_Property, int]: ... def get_metadata(self) -> OleMetadata: ... def get_userdefined_properties( - self, filename: str | Sequence[str], convert_time: bool = False, no_conversion: list[int] | None = None + self, filename: AnyStr | Sequence[AnyStr], convert_time: bool = False, no_conversion: list[int] | None = None ) -> list[dict[str, bytes | int | None]]: ... def main() -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/METADATA.toml index f2743c5bf..eef134504 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/METADATA.toml @@ -1,2 +1,2 @@ -version = "3.1.2" +version = "3.1.4" upstream_repository = "https://foss.heptapod.net/openpyxl/openpyxl" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/rich_text.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/rich_text.pyi index a5168ddf6..7f098a1b8 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/rich_text.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/cell/rich_text.pyi @@ -5,6 +5,7 @@ from typing_extensions import Self from openpyxl.cell.text import InlineFont from openpyxl.descriptors import Strict, String, Typed from openpyxl.descriptors.serialisable import _ChildSerialisableTreeElement +from openpyxl.xml.functions import Element class TextBlock(Strict): font: Typed[InlineFont, Literal[False]] @@ -12,6 +13,7 @@ class TextBlock(Strict): def __init__(self, font: InlineFont, text: str) -> None: ... def __eq__(self, other: TextBlock) -> bool: ... # type: ignore[override] + def to_tree(self) -> Element: ... class CellRichText(list[str | TextBlock]): @overload @@ -24,3 +26,4 @@ class CellRichText(list[str | TextBlock]): def append(self, arg: str | TextBlock) -> None: ... def extend(self, arg: Iterable[str | TextBlock]) -> None: ... def as_list(self) -> list[str]: ... + def to_tree(self) -> Element: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/chart/trendline.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/chart/trendline.pyi index 88b6fd46d..e76da34ef 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/chart/trendline.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/chart/trendline.pyi @@ -10,8 +10,7 @@ from openpyxl.descriptors.base import Alias, String, Typed, _ConvertibleToBool from openpyxl.descriptors.excel import ExtensionList from openpyxl.descriptors.nested import NestedBool, NestedFloat, NestedInteger, NestedSet from openpyxl.descriptors.serialisable import Serialisable - -from ..xml._functions_overloads import _HasTagAndGet +from openpyxl.xml._functions_overloads import _HasTagAndGet _TrendlineTrendlineType: TypeAlias = Literal["exp", "linear", "log", "movingAvg", "poly", "power"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/base.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/base.pyi index 0bd080428..e7f9515bf 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/base.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/base.pyi @@ -12,7 +12,7 @@ from openpyxl.worksheet.cell_range import CellRange, MultiCellRange _T = TypeVar("_T") _P = TypeVar("_P", str, ReadableBuffer) -_N = TypeVar("_N", bound=bool) +_N = TypeVar("_N", bound=bool, default=Literal[False]) _L = TypeVar("_L", bound=Sized) _M = TypeVar("_M", int, float) diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/container.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/container.pyi new file mode 100644 index 000000000..52106f1e6 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/container.pyi @@ -0,0 +1,18 @@ +from typing import TypeVar +from typing_extensions import Self + +from openpyxl.descriptors.serialisable import Serialisable +from openpyxl.xml.functions import Element + +_T = TypeVar("_T", bound=Serialisable) + +# Abstract base class. +class ElementList(list[_T]): + @property + def tagname(self) -> str: ... # abstract + @property + def expected_type(self) -> type[_T]: ... # abstract + @classmethod + def from_tree(cls, tree: Element) -> Self: ... + def to_tree(self) -> Element: ... + def append(self, value: _T) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/sequence.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/sequence.pyi index 6a86831bf..246ab1164 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/sequence.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/descriptors/sequence.pyi @@ -11,6 +11,7 @@ from openpyxl.xml.functions import Element from .base import Alias, Descriptor _T = TypeVar("_T") +_ContainerT = TypeVar("_ContainerT") class _SupportsFromTree(Protocol): @classmethod @@ -19,22 +20,27 @@ class _SupportsFromTree(Protocol): class _SupportsToTree(Protocol): def to_tree(self) -> Element: ... -class Sequence(Descriptor[Incomplete]): - expected_type: type[Incomplete] - seq_types: tuple[type, ...] +# `_ContainerT` is the internal container type (which defaults to `list`), or +# `IndexedList` if unique is `True`. +class Sequence(Descriptor[_ContainerT]): + expected_type: type[Any] # expected type of the sequence elements + seq_types: tuple[type, ...] # allowed settable sequence types, defaults to `list`, `tuple` idx_base: int unique: bool - container: type - def __set__(self, instance: Serialisable | Strict, seq) -> None: ... + container: type # internal container type, defaults to `list` + # seq must be an instance of any of the declared `seq_types`. + def __set__(self, instance: Serialisable | Strict, seq: Any) -> None: ... def to_tree( self, tagname: str | None, obj: Iterable[object], namespace: str | None = None ) -> Generator[Element, None, None]: ... -class UniqueSequence(Sequence): - seq_types: tuple[type, ...] - container: type +# `_T` is the type of the elements in the sequence. +class UniqueSequence(Sequence[set[_T]]): + seq_types: tuple[type[list[_T]], type[tuple[_T, ...]], type[set[_T]]] + container: type[set[_T]] -class ValueSequence(Sequence): +# See `Sequence` for the meaning of `_ContainerT`. +class ValueSequence(Sequence[_ContainerT]): attribute: str def to_tree( self, tagname: str, obj: Iterable[object], namespace: str | None = None # type: ignore[override] @@ -43,7 +49,8 @@ class ValueSequence(Sequence): class _NestedSequenceToTreeObj(Sized, Iterable[_SupportsToTree], Protocol): ... -class NestedSequence(Sequence): +# See `Sequence` for the meaning of `_ContainerT`. +class NestedSequence(Sequence[_ContainerT]): count: bool expected_type: type[_SupportsFromTree] def to_tree( # type: ignore[override] @@ -53,8 +60,9 @@ class NestedSequence(Sequence): # Which can really be anything given the wildly different, and sometimes generic, from_tree return types def from_tree(self, node: Iterable[_SerialisableTreeElement]) -> list[Any]: ... -class MultiSequence(Sequence): - def __set__(self, instance: Serialisable | Strict, seq) -> None: ... +# `_T` is the type of the elements in the sequence. +class MultiSequence(Sequence[list[_T]]): + def __set__(self, instance: Serialisable | Strict, seq: tuple[_T, ...] | list[_T]) -> None: ... def to_tree( self, tagname: Unused, obj: Iterable[_SupportsToTree], namespace: str | None = None # type: ignore[override] ) -> Generator[Element, None, None]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/custom.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/custom.pyi index a01a5a098..ec95af53f 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/custom.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/custom.pyi @@ -52,7 +52,7 @@ CLASS_MAPPING: Final[dict[type[_MappingPropertyType], str]] XML_MAPPING: Final[dict[str, type[_MappingPropertyType]]] class CustomPropertyList(Strict, Generic[_T]): - props: Sequence + props: Sequence[list[_TypedProperty[_T]]] def __init__(self) -> None: ... @classmethod def from_tree(cls, tree: _ChildSerialisableTreeElement) -> Self: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi index 9eedb949f..3a729711c 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/extended.pyi @@ -76,8 +76,8 @@ class ExtendedProperties(Serialisable): HLinks: Unused = None, HyperlinksChanged: object = None, DigSig: Unused = None, - Application: object = "Microsoft Excel", - AppVersion: object = None, + Application: Unused = None, + AppVersion: str | None = None, DocSecurity: ConvertibleToInt | None = None, ) -> None: ... def to_tree(self) -> Element: ... # type: ignore[override] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/relationship.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/relationship.pyi index e0ddf4c8b..1a1ea10a1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/relationship.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/packaging/relationship.pyi @@ -4,11 +4,11 @@ from typing import ClassVar, Literal, TypeVar, overload from zipfile import ZipFile from openpyxl.descriptors.base import Alias, String +from openpyxl.descriptors.container import ElementList from openpyxl.descriptors.serialisable import Serialisable from openpyxl.pivot.cache import CacheDefinition from openpyxl.pivot.record import RecordList from openpyxl.pivot.table import TableDefinition -from openpyxl.xml.functions import Element _SerialisableT = TypeVar("_SerialisableT", bound=Serialisable) _SerialisableRelTypeT = TypeVar("_SerialisableRelTypeT", bound=CacheDefinition | RecordList | TableDefinition) @@ -32,16 +32,11 @@ class Relationship(Serialisable): self, Id: str, Type: str, type: None = None, Target: str | None = None, TargetMode: str | None = None ) -> None: ... -class RelationshipList(Serialisable): - tagname: ClassVar[str] - Relationship: Incomplete - def __init__(self, Relationship=()) -> None: ... - def append(self, value) -> None: ... - def __len__(self) -> int: ... - def __bool__(self) -> bool: ... - def find(self, content_type) -> Generator[Incomplete, None, None]: ... - def __getitem__(self, key): ... - def to_tree(self) -> Element: ... # type: ignore[override] +class RelationshipList(ElementList[Relationship]): + expected_type: type[Relationship] + def find(self, content_type: str) -> Generator[Relationship, None, None]: ... + def get(self, key: str) -> Relationship: ... + def to_dict(self) -> dict[Incomplete, Relationship]: ... def get_rels_path(path): ... def get_dependents(archive: ZipFile, filename: str) -> RelationshipList: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/cache.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/cache.pyi index 5cb3571cd..bd8c5f6ca 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/cache.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/cache.pyi @@ -3,9 +3,10 @@ from datetime import datetime from typing import ClassVar, Literal, overload from typing_extensions import TypeAlias -from openpyxl.descriptors.base import Bool, DateTime, Float, Integer, Set, String, Typed, _ConvertibleToBool +from openpyxl.descriptors.base import Bool, DateTime, Float, Integer, NoneSet, Set, String, Typed, _ConvertibleToBool from openpyxl.descriptors.excel import ExtensionList from openpyxl.descriptors.nested import NestedInteger +from openpyxl.descriptors.sequence import NestedSequence from openpyxl.descriptors.serialisable import Serialisable from openpyxl.pivot.fields import Error, Missing, Number, Text, TupleList from openpyxl.pivot.table import PivotArea @@ -43,10 +44,10 @@ class CalculatedMember(Serialisable): tagname: ClassVar[str] name: String[Literal[False]] mdx: String[Literal[False]] - memberName: String[Literal[False]] - hierarchy: String[Literal[False]] - parent: String[Literal[False]] - solveOrder: Integer[Literal[False]] + memberName: String[Literal[True]] + hierarchy: String[Literal[True]] + parent: String[Literal[True]] + solveOrder: Integer[Literal[True]] set: Bool[Literal[False]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] @@ -84,15 +85,6 @@ class ServerFormat(Serialisable): format: String[Literal[True]] def __init__(self, culture: str | None = None, format: str | None = None) -> None: ... -class ServerFormatList(Serialisable): - tagname: ClassVar[str] - serverFormat: Incomplete - __elements__: ClassVar[tuple[str, ...]] - __attrs__: ClassVar[tuple[str, ...]] - def __init__(self, count: Incomplete | None = None, serverFormat: Incomplete | None = None) -> None: ... - @property - def count(self) -> int: ... - class Query(Serialisable): tagname: ClassVar[str] mdx: String[Literal[False]] @@ -100,13 +92,6 @@ class Query(Serialisable): __elements__: ClassVar[tuple[str, ...]] def __init__(self, mdx: str, tpls: TupleList | None = None) -> None: ... -class QueryCache(Serialisable): - tagname: ClassVar[str] - count: Integer[Literal[False]] - query: Typed[Query, Literal[False]] - __elements__: ClassVar[tuple[str, ...]] - def __init__(self, count: ConvertibleToInt, query: Query) -> None: ... - class OLAPSet(Serialisable): tagname: ClassVar[str] count: Integer[Literal[False]] @@ -128,82 +113,59 @@ class OLAPSet(Serialisable): sortByTuple: TupleList | None = None, ) -> None: ... -class OLAPSets(Serialisable): - count: Integer[Literal[False]] - set: Typed[OLAPSet, Literal[False]] - __elements__: ClassVar[tuple[str, ...]] - def __init__(self, count: ConvertibleToInt, set: OLAPSet) -> None: ... - class PCDSDTCEntries(Serialisable): tagname: ClassVar[str] - count: Integer[Literal[False]] - m: Typed[Missing, Literal[False]] - n: Typed[Number, Literal[False]] - e: Typed[Error, Literal[False]] - s: Typed[Text, Literal[False]] + count: Integer[Literal[True]] + m: Typed[Missing, Literal[True]] + n: Typed[Number, Literal[True]] + e: Typed[Error, Literal[True]] + s: Typed[Text, Literal[True]] __elements__: ClassVar[tuple[str, ...]] def __init__(self, count: ConvertibleToInt, m: Missing, n: Number, e: Error, s: Text) -> None: ... class TupleCache(Serialisable): tagname: ClassVar[str] entries: Typed[PCDSDTCEntries, Literal[True]] - sets: Typed[OLAPSets, Literal[True]] - queryCache: Typed[QueryCache, Literal[True]] - serverFormats: Typed[ServerFormatList, Literal[True]] + sets: NestedSequence[list[OLAPSet]] + queryCache: NestedSequence[list[Query]] + serverFormats: NestedSequence[list[ServerFormat]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] def __init__( self, entries: PCDSDTCEntries | None = None, - sets: OLAPSets | None = None, - queryCache: QueryCache | None = None, - serverFormats: ServerFormatList | None = None, + sets: list[OLAPSet] | tuple[OLAPSet, ...] = (), + queryCache: list[Query] | tuple[Query, ...] = (), + serverFormats: list[ServerFormat] | tuple[ServerFormat, ...] = (), extLst: ExtensionList | None = None, ) -> None: ... -class PCDKPI(Serialisable): +class OLAPKPI(Serialisable): tagname: ClassVar[str] uniqueName: String[Literal[False]] caption: String[Literal[True]] - displayFolder: String[Literal[False]] - measureGroup: String[Literal[False]] - parent: String[Literal[False]] + displayFolder: String[Literal[True]] + measureGroup: String[Literal[True]] + parent: String[Literal[True]] value: String[Literal[False]] - goal: String[Literal[False]] - status: String[Literal[False]] - trend: String[Literal[False]] - weight: String[Literal[False]] - time: String[Literal[False]] - @overload + goal: String[Literal[True]] + status: String[Literal[True]] + trend: String[Literal[True]] + weight: String[Literal[True]] + time: String[Literal[True]] def __init__( self, - uniqueName: str, + uniqueName: str | None = None, caption: str | None = None, - *, - displayFolder: str, - measureGroup: str, - parent: str, - value: str, - goal: str, - status: str, - trend: str, - weight: str, - time: str, - ) -> None: ... - @overload - def __init__( - self, - uniqueName: str, - caption: str | None, - displayFolder: str, - measureGroup: str, - parent: str, - value: str, - goal: str, - status: str, - trend: str, - weight: str, - time: str, + displayFolder: str | None = None, + measureGroup: str | None = None, + parent: str | None = None, + value: str | None = None, + goal: str | None = None, + status: str | None = None, + trend: str | None = None, + weight: str | None = None, + time: str | None = None, ) -> None: ... class GroupMember(Serialisable): @@ -212,12 +174,6 @@ class GroupMember(Serialisable): group: Bool[Literal[False]] def __init__(self, uniqueName: str, group: _ConvertibleToBool = None) -> None: ... -class GroupMembers(Serialisable): - count: Integer[Literal[False]] - groupMember: Typed[GroupMember, Literal[False]] - __elements__: ClassVar[tuple[str, ...]] - def __init__(self, count: ConvertibleToInt, groupMember: GroupMember) -> None: ... - class LevelGroup(Serialisable): tagname: ClassVar[str] name: String[Literal[False]] @@ -225,26 +181,25 @@ class LevelGroup(Serialisable): caption: String[Literal[False]] uniqueParent: String[Literal[False]] id: Integer[Literal[False]] - groupMembers: Typed[GroupMembers, Literal[False]] + groupMembers: NestedSequence[list[GroupMember]] __elements__: ClassVar[tuple[str, ...]] def __init__( - self, name: str, uniqueName: str, caption: str, uniqueParent: str, id: ConvertibleToInt, groupMembers: GroupMembers + self, + name: str, + uniqueName: str, + caption: str, + uniqueParent: str, + id: ConvertibleToInt, + groupMembers: list[GroupMember] | tuple[GroupMember, ...] = (), ) -> None: ... -class Groups(Serialisable): - tagname: ClassVar[str] - count: Integer[Literal[False]] - group: Typed[LevelGroup, Literal[False]] - __elements__: ClassVar[tuple[str, ...]] - def __init__(self, count: ConvertibleToInt, group: LevelGroup) -> None: ... - class GroupLevel(Serialisable): tagname: ClassVar[str] uniqueName: String[Literal[False]] caption: String[Literal[False]] user: Bool[Literal[False]] customRollUp: Bool[Literal[False]] - groups: Typed[Groups, Literal[True]] + groups: NestedSequence[list[LevelGroup]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] def __init__( @@ -253,27 +208,15 @@ class GroupLevel(Serialisable): caption: str, user: _ConvertibleToBool = None, customRollUp: _ConvertibleToBool = None, - groups: Groups | None = None, + groups: list[LevelGroup] | tuple[LevelGroup, ...] = (), extLst: ExtensionList | None = None, ) -> None: ... -class GroupLevels(Serialisable): - count: Integer[Literal[False]] - groupLevel: Typed[GroupLevel, Literal[False]] - __elements__: ClassVar[tuple[str, ...]] - def __init__(self, count: ConvertibleToInt, groupLevel: GroupLevel) -> None: ... - class FieldUsage(Serialisable): tagname: ClassVar[str] x: Integer[Literal[False]] def __init__(self, x: ConvertibleToInt) -> None: ... -class FieldsUsage(Serialisable): - count: Integer[Literal[False]] - fieldUsage: Typed[FieldUsage, Literal[True]] - __elements__: ClassVar[tuple[str, ...]] - def __init__(self, count: ConvertibleToInt, fieldUsage: FieldUsage | None = None) -> None: ... - class CacheHierarchy(Serialisable): tagname: ClassVar[str] uniqueName: String[Literal[False]] @@ -298,8 +241,8 @@ class CacheHierarchy(Serialisable): unbalanced: Bool[Literal[True]] unbalancedGroup: Bool[Literal[True]] hidden: Bool[Literal[False]] - fieldsUsage: Typed[FieldsUsage, Literal[True]] - groupLevels: Typed[GroupLevels, Literal[True]] + fieldsUsage: NestedSequence[list[FieldUsage]] + groupLevels: NestedSequence[list[GroupLevel]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] @overload @@ -328,8 +271,8 @@ class CacheHierarchy(Serialisable): unbalanced: _ConvertibleToBool | None = None, unbalancedGroup: _ConvertibleToBool | None = None, hidden: _ConvertibleToBool = None, - fieldsUsage: FieldsUsage | None = None, - groupLevels: GroupLevels | None = None, + fieldsUsage: list[FieldUsage] | tuple[FieldUsage, ...] = (), + groupLevels: list[FieldUsage] | tuple[FieldUsage, ...] = (), extLst: ExtensionList | None = None, ) -> None: ... @overload @@ -357,8 +300,8 @@ class CacheHierarchy(Serialisable): unbalanced: _ConvertibleToBool | None = None, unbalancedGroup: _ConvertibleToBool | None = None, hidden: _ConvertibleToBool = None, - fieldsUsage: FieldsUsage | None = None, - groupLevels: GroupLevels | None = None, + fieldsUsage: list[FieldUsage] | tuple[FieldUsage, ...] = (), + groupLevels: list[FieldUsage] | tuple[FieldUsage, ...] = (), extLst: ExtensionList | None = None, ) -> None: ... @@ -376,20 +319,11 @@ class GroupItems(Serialisable): @property def count(self) -> int: ... -class DiscretePr(Serialisable): - tagname: ClassVar[str] - count: Integer[Literal[False]] - x: NestedInteger[Literal[True]] - __elements__: ClassVar[tuple[str, ...]] - def __init__( - self, count: ConvertibleToInt, x: _HasTagAndGet[ConvertibleToInt | None] | ConvertibleToInt | None = None - ) -> None: ... - class RangePr(Serialisable): tagname: ClassVar[str] autoStart: Bool[Literal[True]] autoEnd: Bool[Literal[True]] - groupBy: Set[_RangePrGroupBy] + groupBy: NoneSet[_RangePrGroupBy] startNum: Float[Literal[True]] endNum: Float[Literal[True]] startDate: DateTime[Literal[True]] @@ -412,7 +346,7 @@ class FieldGroup(Serialisable): par: Integer[Literal[True]] base: Integer[Literal[True]] rangePr: Typed[RangePr, Literal[True]] - discretePr: Typed[DiscretePr, Literal[True]] + discretePr: NestedSequence[list[NestedInteger[Literal[False]]]] groupItems: Typed[GroupItems, Literal[True]] __elements__: ClassVar[tuple[str, ...]] def __init__( @@ -420,7 +354,7 @@ class FieldGroup(Serialisable): par: ConvertibleToInt | None = None, base: ConvertibleToInt | None = None, rangePr: RangePr | None = None, - discretePr: DiscretePr | None = None, + discretePr: list[NestedInteger[Literal[False]]] | tuple[NestedInteger[Literal[False]], ...] = (), groupItems: GroupItems | None = None, ) -> None: ... @@ -569,21 +503,18 @@ class PageItem(Serialisable): name: String[Literal[False]] def __init__(self, name: str) -> None: ... -class Page(Serialisable): - tagname: ClassVar[str] - pageItem: Incomplete - __elements__: ClassVar[tuple[str, ...]] - def __init__(self, count: Incomplete | None = None, pageItem: Incomplete | None = None) -> None: ... - @property - def count(self) -> int: ... - class Consolidation(Serialisable): tagname: ClassVar[str] autoPage: Bool[Literal[True]] - pages: Incomplete - rangeSets: Incomplete + pages: NestedSequence[list[PageItem]] + rangeSets: NestedSequence[list[RangeSet]] __elements__: ClassVar[tuple[str, ...]] - def __init__(self, autoPage: _ConvertibleToBool | None = None, pages=(), rangeSets=()) -> None: ... + def __init__( + self, + autoPage: _ConvertibleToBool | None = None, + pages: list[PageItem] | tuple[PageItem, ...] = (), + rangeSets: list[RangeSet] | tuple[RangeSet, ...] = (), + ) -> None: ... class WorksheetSource(Serialisable): tagname: ClassVar[str] @@ -629,13 +560,13 @@ class CacheDefinition(Serialisable): minRefreshableVersion: Integer[Literal[True]] recordCount: Integer[Literal[True]] upgradeOnRefresh: Bool[Literal[True]] - tupleCache: Typed[TupleCache, Literal[True]] supportSubquery: Bool[Literal[True]] supportAdvancedDrill: Bool[Literal[True]] cacheSource: Typed[CacheSource, Literal[True]] cacheFields: Incomplete cacheHierarchies: Incomplete - kpis: Incomplete + kpis: NestedSequence[list[OLAPKPI]] + tupleCache: Typed[TupleCache, Literal[True]] calculatedItems: Incomplete calculatedMembers: Incomplete dimensions: Incomplete @@ -669,7 +600,7 @@ class CacheDefinition(Serialisable): cacheSource: CacheSource, cacheFields=(), cacheHierarchies=(), - kpis=(), + kpis: list[OLAPKPI] | tuple[OLAPKPI, ...] = (), calculatedItems=(), calculatedMembers=(), dimensions=(), diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/fields.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/fields.pyi index 3076fed4a..a35b43114 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/fields.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/pivot/fields.pyi @@ -11,8 +11,8 @@ class Index(Serialisable): def __init__(self, v: ConvertibleToInt | None = 0) -> None: ... class Tuple(Serialisable): - fld: Integer[Literal[False]] - hier: Integer[Literal[False]] + fld: Integer[Literal[True]] + hier: Integer[Literal[True]] item: Integer[Literal[False]] def __init__(self, fld: ConvertibleToInt, hier: ConvertibleToInt, item: ConvertibleToInt) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/alignment.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/alignment.pyi index d2b96de0a..6bad3b071 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/alignment.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/alignment.pyi @@ -16,7 +16,6 @@ vertical_aligments: Final[tuple[_VerticalAlignmentsType, ...]] class Alignment(Serialisable): tagname: ClassVar[str] - __fields__: ClassVar[tuple[str, ...]] horizontal: NoneSet[_HorizontalAlignmentsType] vertical: NoneSet[_VerticalAlignmentsType] textRotation: NoneSet[int] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/borders.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/borders.pyi index 5c05d5666..c54e2e55d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/borders.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/borders.pyi @@ -39,7 +39,6 @@ BORDER_THICK: Final = "thick" BORDER_THIN: Final = "thin" class Side(Serialisable): - __fields__: ClassVar[tuple[str, ...]] color: ColorDescriptor[Literal[True]] style: NoneSet[_SideStyle] border_style: Alias @@ -52,7 +51,6 @@ class Side(Serialisable): class Border(Serialisable): tagname: ClassVar[str] - __fields__: ClassVar[tuple[str, ...]] __elements__: ClassVar[tuple[str, ...]] start: Typed[Side, Literal[True]] end: Typed[Side, Literal[True]] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/fills.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/fills.pyi index 7e1a62a98..85be254a9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/fills.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/fills.pyi @@ -88,9 +88,9 @@ class Stop(Serialisable): color: Incomplete def __init__(self, color, position: ConvertibleToFloat) -> None: ... -class StopList(Sequence): - expected_type: type[Incomplete] - def __set__(self, obj: Serialisable | Strict, values) -> None: ... +class StopList(Sequence[list[Stop]]): + expected_type: type[Stop] + def __set__(self, obj: Serialisable | Strict, values: list[Stop] | tuple[Stop, ...]) -> None: ... class GradientFill(Fill): tagname: ClassVar[str] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi index 2cb2b2451..2e598cdb3 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/styles/named_styles.pyi @@ -4,6 +4,7 @@ from typing import ClassVar, Literal from openpyxl.descriptors.base import Bool, Integer, String, Typed, _ConvertibleToBool from openpyxl.descriptors.excel import ExtensionList +from openpyxl.descriptors.sequence import Sequence from openpyxl.descriptors.serialisable import Serialisable from openpyxl.styles.alignment import Alignment from openpyxl.styles.borders import Border @@ -22,8 +23,6 @@ class NamedStyle(Serialisable): protection: Typed[Protection, Literal[False]] builtinId: Integer[Literal[True]] hidden: Bool[Literal[True]] - # Overwritten by property below - # xfId: Integer name: String[Literal[False]] def __init__( self, @@ -36,12 +35,9 @@ class NamedStyle(Serialisable): protection: Protection | None = None, builtinId: ConvertibleToInt | None = None, hidden: _ConvertibleToBool | None = False, - xfId: Unused = None, ) -> None: ... def __setattr__(self, attr: str, value) -> None: ... def __iter__(self) -> Iterator[tuple[str, str]]: ... - @property - def xfId(self) -> int | None: ... def bind(self, wb: Workbook) -> None: ... def as_tuple(self) -> StyleArray: ... def as_xf(self) -> CellStyle: ... @@ -77,11 +73,10 @@ class _NamedCellStyle(Serialisable): class _NamedCellStyleList(Serialisable): tagname: ClassVar[str] # Overwritten by property below - # count: Integer - cellStyle: Incomplete + # count: Integer[Literal[True]] + cellStyle: Sequence[list[_NamedCellStyle]] __attrs__: ClassVar[tuple[str, ...]] - def __init__(self, count: Unused = None, cellStyle=()) -> None: ... + def __init__(self, count: Unused = None, cellStyle: list[_NamedCellStyle] | tuple[_NamedCellStyle, ...] = ()) -> None: ... @property def count(self) -> int: ... - @property - def names(self) -> NamedStyleList: ... + def remove_duplicates(self) -> list[_NamedCellStyle]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/cell.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/cell.pyi index 1d3b0b8e2..22a05774e 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/cell.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/cell.pyi @@ -17,8 +17,8 @@ SHEETRANGE_RE: Final[Pattern[str]] def get_column_interval(start: str | int, end: str | int) -> list[str]: ... def coordinate_from_string(coord_string: str) -> tuple[str, int]: ... def absolute_coordinate(coord_string: str) -> str: ... -def get_column_letter(idx: int) -> str: ... -def column_index_from_string(str_col: str) -> int: ... +def get_column_letter(col_idx: int) -> str: ... +def column_index_from_string(col: str) -> int: ... def range_boundaries(range_string: str) -> _RangeBoundariesTuple: ... def rows_from_range(range_string: str) -> Generator[tuple[str, ...], None, None]: ... def cols_from_range(range_string: str) -> Generator[tuple[str, ...], None, None]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/indexed_list.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/indexed_list.pyi index 417198076..9bf453a04 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/indexed_list.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/utils/indexed_list.pyi @@ -7,6 +7,6 @@ class IndexedList(list[_T]): clean: bool def __init__(self, iterable: Iterable[_T] | None = None) -> None: ... def __contains__(self, value: object) -> bool: ... - def index(self, value: _T): ... # type: ignore[override] + def index(self, value: _T) -> int: ... # type: ignore[override] def append(self, value: _T) -> None: ... - def add(self, value: _T): ... + def add(self, value: _T) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/defined_name.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/defined_name.pyi index 0e7393ccf..4c456d189 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/defined_name.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/workbook/defined_name.pyi @@ -65,7 +65,7 @@ class DefinedNameDict(dict[str, DefinedName]): class DefinedNameList(Serialisable): tagname: ClassVar[str] - definedName: Sequence - def __init__(self, definedName=()) -> None: ... + definedName: Sequence[list[DefinedName]] + def __init__(self, definedName: list[DefinedName] | tuple[DefinedName, ...] = ()) -> None: ... def by_sheet(self) -> defaultdict[int, DefinedNameDict]: ... def __len__(self) -> int: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi index 98d2c10cf..d5a32d36a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/_read_only.pyi @@ -1,5 +1,6 @@ from _typeshed import SupportsGetItem -from collections.abc import Generator +from collections.abc import Generator, Iterator +from typing import Any, overload from openpyxl import _VisibilityType from openpyxl.cell import _CellValue @@ -21,8 +22,15 @@ class ReadOnlyWorksheet: # https://github.com/python/mypy/issues/6700 @property def rows(self) -> Generator[tuple[Cell, ...], None, None]: ... - __getitem__ = Worksheet.__getitem__ - __iter__ = Worksheet.__iter__ + # From Worksheet.__getitem__ + @overload + def __getitem__(self, key: int) -> tuple[Cell, ...]: ... + @overload + def __getitem__(self, key: slice) -> tuple[Any, ...]: ... # tuple[AnyOf[Cell, tuple[Cell, ...]]] + @overload + def __getitem__(self, key: str) -> Any: ... # AnyOf[Cell, tuple[Cell, ...], tuple[tuple[Cell, ...], ...]] + # From Worksheet.__iter__ + def __iter__(self) -> Iterator[tuple[Cell, ...]]: ... parent: Workbook title: str sheet_state: _VisibilityType diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi index cd44c40a1..85f40baea 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/datavalidation.pyi @@ -72,7 +72,7 @@ class DataValidation(Serialisable): showErrorMessage: _ConvertibleToBool | None = False, showInputMessage: _ConvertibleToBool | None = False, showDropDown: _ConvertibleToBool | None = False, - allowBlank: _ConvertibleToBool | None = False, + allowBlank: _ConvertibleToBool = False, sqref: _ConvertibleToMultiCellRange = (), promptTitle: str | None = None, errorStyle: _DataValidationErrorStyle | Literal["none"] | None = None, @@ -81,7 +81,7 @@ class DataValidation(Serialisable): errorTitle: str | None = None, imeMode: _DataValidationImeMode | Literal["none"] | None = None, operator: _DataValidationOperator | Literal["none"] | None = None, - allow_blank: Incomplete | None = False, + allow_blank: _ConvertibleToBool | None = None, ) -> None: ... def add(self, cell) -> None: ... def __contains__(self, cell: _HasCoordinate | str | CellRange) -> bool: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi index 644e5684a..03a849348 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/dimensions.pyi @@ -1,6 +1,6 @@ from _typeshed import ConvertibleToFloat, ConvertibleToInt, Incomplete, Unused from collections.abc import Callable, Iterator -from typing import ClassVar, Generic, Literal, TypeVar +from typing import ClassVar, Literal, TypeVar from typing_extensions import Self from openpyxl.descriptors import Strict @@ -12,6 +12,7 @@ from openpyxl.utils.cell import _RangeBoundariesTuple from openpyxl.worksheet.worksheet import Worksheet from openpyxl.xml.functions import Element +_DimKeyT = TypeVar("_DimKeyT", bound=str | int) _DimT = TypeVar("_DimT", bound=Dimension) class Dimension(Strict, StyleableObject): @@ -101,9 +102,11 @@ class ColumnDimension(Dimension): @property def customWidth(self) -> bool: ... def reindex(self) -> None: ... + @property + def range(self) -> str: ... def to_tree(self) -> Element | None: ... -class DimensionHolder(BoundDictionary[str, _DimT], Generic[_DimT]): +class DimensionHolder(BoundDictionary[_DimKeyT, _DimT]): worksheet: Worksheet max_outline: int | None default_factory: Callable[[], _DimT] | None @@ -111,7 +114,7 @@ class DimensionHolder(BoundDictionary[str, _DimT], Generic[_DimT]): def __init__( self, worksheet: Worksheet, reference: str = "index", default_factory: Callable[[], _DimT] | None = None ) -> None: ... - def group(self, start: str, end: str | None = None, outline_level: int = 1, hidden: bool = False) -> None: ... + def group(self, start: _DimKeyT, end: _DimKeyT | None = None, outline_level: int = 1, hidden: bool = False) -> None: ... def to_tree(self) -> Element | None: ... class SheetFormatProperties(Serialisable): diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/filters.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/filters.pyi index 30d12af81..4a641e818 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/filters.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/filters.pyi @@ -1,14 +1,11 @@ from _typeshed import ConvertibleToFloat, ConvertibleToInt, Incomplete, Unused from datetime import datetime -from re import Pattern -from typing import ClassVar, Literal, overload +from typing import ClassVar, Final, Literal, overload from typing_extensions import TypeAlias -from openpyxl.descriptors import Strict from openpyxl.descriptors.base import ( Alias, Bool, - Convertible, DateTime, Float, Integer, @@ -22,8 +19,6 @@ from openpyxl.descriptors.base import ( from openpyxl.descriptors.excel import ExtensionList from openpyxl.descriptors.serialisable import Serialisable -from ..descriptors.base import _N - _SortConditionSortBy: TypeAlias = Literal["value", "cellColor", "fontColor", "icon"] _IconSet: TypeAlias = Literal[ "3Arrows", @@ -48,6 +43,7 @@ _SortStateSortMethod: TypeAlias = Literal["stroke", "pinYin"] _CustomFilterOperator: TypeAlias = Literal[ "equal", "lessThan", "lessThanOrEqual", "notEqual", "greaterThanOrEqual", "greaterThan" ] +_StringFilterOperator: TypeAlias = Literal["contains", "startswith", "endswith", "wildcard"] _FiltersCalendarType: TypeAlias = Literal[ "gregorian", "gregorianUs", @@ -170,24 +166,32 @@ class DynamicFilter(Serialisable): maxValIso: datetime | str | None = None, ) -> None: ... -class CustomFilterValueDescriptor(Convertible[float | str, _N]): - pattern: Pattern[str] - expected_type: type[float | str] - @overload # type: ignore[override] # Different restrictions - def __set__( - self: CustomFilterValueDescriptor[Literal[True]], instance: Serialisable | Strict, value: str | ConvertibleToFloat | None - ) -> None: ... - @overload - def __set__( - self: CustomFilterValueDescriptor[Literal[False]], instance: Serialisable | Strict, value: str | ConvertibleToFloat - ) -> None: ... - class CustomFilter(Serialisable): tagname: ClassVar[str] - operator: NoneSet[_CustomFilterOperator] - val: Incomplete + val: String[Literal[False]] + operator: Set[_CustomFilterOperator] + def __init__(self, operator: _CustomFilterOperator = "equal", val: str | None = None) -> None: ... + def convert(self) -> BlankFilter | NumberFilter | StringFilter: ... + +class BlankFilter(CustomFilter): + def __init__(self, **kw: Unused) -> None: ... + @property + def operator(self) -> Literal["notEqual"]: ... # type: ignore[override] + @property + def val(self) -> Literal[" "]: ... # type: ignore[override] + +class NumberFilter(CustomFilter): + val: Float[Literal[False]] # type: ignore[assignment] + def __init__(self, operator: _CustomFilterOperator = "equal", val: ConvertibleToFloat | None = None) -> None: ... + +string_format_mapping: Final[dict[_StringFilterOperator, str]] + +class StringFilter(CustomFilter): + operator: Set[_StringFilterOperator] # type: ignore[assignment] + val: String[Literal[False]] + exclude: Bool[Literal[False]] def __init__( - self, operator: _CustomFilterOperator | Literal["none"] | None = None, val: Incomplete | None = None + self, operator: _StringFilterOperator = "contains", val: str | None = None, exclude: _ConvertibleToBool = False ) -> None: ... class CustomFilters(Serialisable): @@ -195,7 +199,7 @@ class CustomFilters(Serialisable): _and: Bool[Literal[True]] # Not private. Avoids name clash customFilter: Incomplete __elements__: ClassVar[tuple[str, ...]] - def __init__(self, _and: _ConvertibleToBool | None = False, customFilter=()) -> None: ... + def __init__(self, _and: _ConvertibleToBool | None = None, customFilter=()) -> None: ... class Top10(Serialisable): tagname: ClassVar[str] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi index 03fa57ea7..1e8c5e166 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/hyperlink.pyi @@ -2,6 +2,7 @@ from _typeshed import Incomplete from typing import ClassVar, Literal from openpyxl.descriptors.base import String +from openpyxl.descriptors.sequence import Sequence from openpyxl.descriptors.serialisable import Serialisable class Hyperlink(Serialisable): @@ -25,8 +26,5 @@ class Hyperlink(Serialisable): class HyperlinkList(Serialisable): tagname: ClassVar[str] - hyperlink: Incomplete - def __init__(self, hyperlink=()) -> None: ... - def __bool__(self) -> bool: ... - def __len__(self) -> int: ... - def append(self, value) -> None: ... + hyperlink: Sequence[list[Hyperlink]] + def __init__(self, hyperlink: list[Hyperlink] | tuple[Hyperlink, ...] = ()) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/views.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/views.pyi index 0663b9ea4..6ea3c2acf 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/views.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/views.pyi @@ -4,6 +4,7 @@ from typing_extensions import TypeAlias from openpyxl.descriptors.base import Bool, Float, Integer, NoneSet, Set, String, Typed, _ConvertibleToBool from openpyxl.descriptors.excel import ExtensionList +from openpyxl.descriptors.sequence import Sequence from openpyxl.descriptors.serialisable import Serialisable _Pane: TypeAlias = Literal["bottomRight", "topRight", "bottomLeft", "topLeft"] @@ -90,7 +91,9 @@ class SheetView(Serialisable): class SheetViewList(Serialisable): tagname: ClassVar[str] - sheetView: Incomplete + sheetView: Sequence[list[SheetView]] extLst: Typed[ExtensionList, Literal[True]] __elements__: ClassVar[tuple[str, ...]] - def __init__(self, sheetView: Incomplete | None = None, extLst: Unused = None) -> None: ... + def __init__(self, sheetView: SheetView | None = None, extLst: Unused = None) -> None: ... + @property + def active(self) -> SheetView: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi index 4adb8a835..436b4a114 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/openpyxl/openpyxl/worksheet/worksheet.pyi @@ -51,8 +51,8 @@ class Worksheet(_WorkbookChild): ORIENTATION_PORTRAIT: Final = "portrait" ORIENTATION_LANDSCAPE: Final = "landscape" - row_dimensions: DimensionHolder[RowDimension] - column_dimensions: DimensionHolder[ColumnDimension] + row_dimensions: DimensionHolder[int, RowDimension] + column_dimensions: DimensionHolder[str, ColumnDimension] row_breaks: RowBreak col_breaks: ColBreak merged_cells: MultiCellRange @@ -190,6 +190,8 @@ class Worksheet(_WorkbookChild): ) -> Generator[tuple[Cell, ...], None, None] | Generator[tuple[str | float | datetime | None, ...], None, None]: ... @property def columns(self) -> Generator[tuple[Cell, ...], None, None]: ... + @property + def column_groups(self) -> list[str]: ... def set_printer_settings( self, paper_size: int | None, orientation: Literal["default", "portrait", "landscape"] | None ) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml index aa10ee81b..f4f90b5e4 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/peewee/METADATA.toml @@ -1,4 +1,4 @@ -version = "3.17.3" +version = "3.17.5" upstream_repository = "https://github.com/coleifer/peewee" # We're not providing stubs for all playhouse modules right now # https://github.com/python/typeshed/pull/11731#issuecomment-2065729058 diff --git a/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi b/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi index 1df82987e..a03db334f 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/peewee/peewee.pyi @@ -459,7 +459,12 @@ class ForUpdate(Node): def __init__(self, expr, of: Incomplete | None = ..., nowait: Incomplete | None = ...) -> None: ... def __sql__(self, ctx): ... -def Case(predicate, expression_tuples, default: Incomplete | None = ...): ... +class Case(ColumnBase): + predicate: Incomplete + expression_tuples: Incomplete + default: Incomplete | None + def __init__(self, predicate, expression_tuples, default: Incomplete | None = None) -> None: ... + def __sql__(self, ctx): ... class NodeList(ColumnBase): nodes: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml index ad7078f37..9e402da86 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/protobuf/METADATA.toml @@ -1,8 +1,8 @@ # Whenever you update version here, PROTOBUF_VERSION should be updated # in scripts/generate_proto_stubs.sh and vice-versa. -version = "5.26.*" +version = "5.27.*" upstream_repository = "https://github.com/protocolbuffers/protobuf" -extra_description = "Generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 25.1 on [protobuf v26.1](https://github.com/protocolbuffers/protobuf/releases/tag/v26.1) (python protobuf==5.26.1)" +extra_description = "Partially generated using [mypy-protobuf==3.6.0](https://github.com/nipunn1313/mypy-protobuf/tree/v3.6.0) and libprotoc 26.1 on [protobuf v27.1](https://github.com/protocolbuffers/protobuf/releases/tag/v27.1) (python protobuf==5.27.1)." partial_stub = true [tool.stubtest] 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 b7a063ec6..020c3fccc 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 @@ -35,6 +35,10 @@ class _EditionEnumTypeWrapper(google.protobuf.internal.enum_type_wrapper._EnumTy DESCRIPTOR: google.protobuf.descriptor.EnumDescriptor EDITION_UNKNOWN: _Edition.ValueType # 0 """A placeholder for an unknown edition value.""" + EDITION_LEGACY: _Edition.ValueType # 900 + """A placeholder edition for specifying default behaviors *before* a feature + was first introduced. This is effectively an "infinite past". + """ EDITION_PROTO2: _Edition.ValueType # 998 """Legacy syntax "editions". These pre-date editions, but behave much like distinct editions. These can't be used to specify the edition of proto @@ -67,6 +71,10 @@ class Edition(_Edition, metaclass=_EditionEnumTypeWrapper): EDITION_UNKNOWN: Edition.ValueType # 0 """A placeholder for an unknown edition value.""" +EDITION_LEGACY: Edition.ValueType # 900 +"""A placeholder edition for specifying default behaviors *before* a feature +was first introduced. This is effectively an "infinite past". +""" EDITION_PROTO2: Edition.ValueType # 998 """Legacy syntax "editions". These pre-date editions, but behave much like distinct editions. These can't be used to specify the edition of proto @@ -898,12 +906,16 @@ class FileOptions(google.protobuf.message.Message): java_generate_equals_and_hash: builtins.bool """This option does nothing.""" java_string_check_utf8: builtins.bool - """If set true, then the Java2 code generator will generate code that - throws an exception whenever an attempt is made to assign a non-UTF-8 - byte sequence to a string field. - Message reflection will do the same. - However, an extension field still accepts non-UTF-8 byte sequences. - This option has no effect on when used with the lite runtime. + """A proto2 file can set this to true to opt in to UTF-8 checking for Java, + which will throw an exception if invalid UTF-8 is parsed from the wire or + assigned to a string field. + + TODO: clarify exactly what kinds of field types this option + applies to, and update these docs accordingly. + + Proto3 files already perform these checks. Setting the option explicitly to + false has no effect: it cannot be used to opt proto3 files out of UTF-8 + checks. """ optimize_for: global___FileOptions.OptimizeMode.ValueType go_package: builtins.str @@ -1238,6 +1250,45 @@ class FieldOptions(google.protobuf.message.Message): def HasField(self, field_name: typing.Literal["edition", b"edition", "value", b"value"]) -> builtins.bool: ... def ClearField(self, field_name: typing.Literal["edition", b"edition", "value", b"value"]) -> None: ... + @typing.final + class FeatureSupport(google.protobuf.message.Message): + """Information about the support window of a feature.""" + + DESCRIPTOR: google.protobuf.descriptor.Descriptor + + EDITION_INTRODUCED_FIELD_NUMBER: builtins.int + EDITION_DEPRECATED_FIELD_NUMBER: builtins.int + DEPRECATION_WARNING_FIELD_NUMBER: builtins.int + EDITION_REMOVED_FIELD_NUMBER: builtins.int + edition_introduced: global___Edition.ValueType + """The edition that this feature was first available in. In editions + earlier than this one, the default assigned to EDITION_LEGACY will be + used, and proto files will not be able to override it. + """ + edition_deprecated: global___Edition.ValueType + """The edition this feature becomes deprecated in. Using this after this + edition may trigger warnings. + """ + deprecation_warning: builtins.str + """The deprecation warning text if this feature is used after the edition it + was marked deprecated in. + """ + edition_removed: global___Edition.ValueType + """The edition this feature is no longer available in. In editions after + this one, the last default assigned will be used, and proto files will + not be able to override it. + """ + def __init__( + self, + *, + edition_introduced: global___Edition.ValueType | None = ..., + edition_deprecated: global___Edition.ValueType | None = ..., + deprecation_warning: builtins.str | None = ..., + edition_removed: global___Edition.ValueType | None = ..., + ) -> None: ... + def HasField(self, field_name: typing.Literal["deprecation_warning", b"deprecation_warning", "edition_deprecated", b"edition_deprecated", "edition_introduced", b"edition_introduced", "edition_removed", b"edition_removed"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["deprecation_warning", b"deprecation_warning", "edition_deprecated", b"edition_deprecated", "edition_introduced", b"edition_introduced", "edition_removed", b"edition_removed"]) -> None: ... + CTYPE_FIELD_NUMBER: builtins.int PACKED_FIELD_NUMBER: builtins.int JSTYPE_FIELD_NUMBER: builtins.int @@ -1250,6 +1301,7 @@ class FieldOptions(google.protobuf.message.Message): TARGETS_FIELD_NUMBER: builtins.int EDITION_DEFAULTS_FIELD_NUMBER: builtins.int FEATURES_FIELD_NUMBER: builtins.int + FEATURE_SUPPORT_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int ctype: global___FieldOptions.CType.ValueType """The ctype option instructs the C++ code generator to use a different @@ -1331,6 +1383,8 @@ class FieldOptions(google.protobuf.message.Message): def features(self) -> global___FeatureSet: """Any features defined in the specific edition.""" + @property + def feature_support(self) -> global___FieldOptions.FeatureSupport: ... @property def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: """The parser stores options it doesn't recognize here. See above.""" @@ -1350,10 +1404,11 @@ class FieldOptions(google.protobuf.message.Message): targets: collections.abc.Iterable[global___FieldOptions.OptionTargetType.ValueType] | None = ..., edition_defaults: collections.abc.Iterable[global___FieldOptions.EditionDefault] | None = ..., features: global___FeatureSet | None = ..., + feature_support: global___FieldOptions.FeatureSupport | None = ..., uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., ) -> None: ... - def HasField(self, field_name: typing.Literal["ctype", b"ctype", "debug_redact", b"debug_redact", "deprecated", b"deprecated", "features", b"features", "jstype", b"jstype", "lazy", b"lazy", "packed", b"packed", "retention", b"retention", "unverified_lazy", b"unverified_lazy", "weak", b"weak"]) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal["ctype", b"ctype", "debug_redact", b"debug_redact", "deprecated", b"deprecated", "edition_defaults", b"edition_defaults", "features", b"features", "jstype", b"jstype", "lazy", b"lazy", "packed", b"packed", "retention", b"retention", "targets", b"targets", "uninterpreted_option", b"uninterpreted_option", "unverified_lazy", b"unverified_lazy", "weak", b"weak"]) -> None: ... + def HasField(self, field_name: typing.Literal["ctype", b"ctype", "debug_redact", b"debug_redact", "deprecated", b"deprecated", "feature_support", b"feature_support", "features", b"features", "jstype", b"jstype", "lazy", b"lazy", "packed", b"packed", "retention", b"retention", "unverified_lazy", b"unverified_lazy", "weak", b"weak"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["ctype", b"ctype", "debug_redact", b"debug_redact", "deprecated", b"deprecated", "edition_defaults", b"edition_defaults", "feature_support", b"feature_support", "features", b"features", "jstype", b"jstype", "lazy", b"lazy", "packed", b"packed", "retention", b"retention", "targets", b"targets", "uninterpreted_option", b"uninterpreted_option", "unverified_lazy", b"unverified_lazy", "weak", b"weak"]) -> None: ... global___FieldOptions = FieldOptions @@ -1438,6 +1493,7 @@ class EnumValueOptions(google.protobuf.message.Message): DEPRECATED_FIELD_NUMBER: builtins.int FEATURES_FIELD_NUMBER: builtins.int DEBUG_REDACT_FIELD_NUMBER: builtins.int + FEATURE_SUPPORT_FIELD_NUMBER: builtins.int UNINTERPRETED_OPTION_FIELD_NUMBER: builtins.int deprecated: builtins.bool """Is this enum value deprecated? @@ -1454,6 +1510,10 @@ class EnumValueOptions(google.protobuf.message.Message): def features(self) -> global___FeatureSet: """Any features defined in the specific edition.""" + @property + def feature_support(self) -> global___FieldOptions.FeatureSupport: + """Information about the support window of a feature value.""" + @property def uninterpreted_option(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___UninterpretedOption]: """The parser stores options it doesn't recognize here. See above.""" @@ -1464,10 +1524,11 @@ class EnumValueOptions(google.protobuf.message.Message): deprecated: builtins.bool | None = ..., features: global___FeatureSet | None = ..., debug_redact: builtins.bool | None = ..., + feature_support: global___FieldOptions.FeatureSupport | None = ..., uninterpreted_option: collections.abc.Iterable[global___UninterpretedOption] | None = ..., ) -> None: ... - def HasField(self, field_name: typing.Literal["debug_redact", b"debug_redact", "deprecated", b"deprecated", "features", b"features"]) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal["debug_redact", b"debug_redact", "deprecated", b"deprecated", "features", b"features", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... + def HasField(self, field_name: typing.Literal["debug_redact", b"debug_redact", "deprecated", b"deprecated", "feature_support", b"feature_support", "features", b"features"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["debug_redact", b"debug_redact", "deprecated", b"deprecated", "feature_support", b"feature_support", "features", b"features", "uninterpreted_option", b"uninterpreted_option"]) -> None: ... global___EnumValueOptions = EnumValueOptions @@ -1799,18 +1860,26 @@ class FeatureSetDefaults(google.protobuf.message.Message): DESCRIPTOR: google.protobuf.descriptor.Descriptor EDITION_FIELD_NUMBER: builtins.int - FEATURES_FIELD_NUMBER: builtins.int + OVERRIDABLE_FEATURES_FIELD_NUMBER: builtins.int + FIXED_FEATURES_FIELD_NUMBER: builtins.int edition: global___Edition.ValueType @property - def features(self) -> global___FeatureSet: ... + def overridable_features(self) -> global___FeatureSet: + """Defaults of features that can be overridden in this edition.""" + + @property + def fixed_features(self) -> global___FeatureSet: + """Defaults of features that can't be overridden in this edition.""" + def __init__( self, *, edition: global___Edition.ValueType | None = ..., - features: global___FeatureSet | None = ..., + overridable_features: global___FeatureSet | None = ..., + fixed_features: global___FeatureSet | None = ..., ) -> None: ... - def HasField(self, field_name: typing.Literal["edition", b"edition", "features", b"features"]) -> builtins.bool: ... - def ClearField(self, field_name: typing.Literal["edition", b"edition", "features", b"features"]) -> None: ... + def HasField(self, field_name: typing.Literal["edition", b"edition", "fixed_features", b"fixed_features", "overridable_features", b"overridable_features"]) -> builtins.bool: ... + def ClearField(self, field_name: typing.Literal["edition", b"edition", "fixed_features", b"fixed_features", "overridable_features", b"overridable_features"]) -> None: ... DEFAULTS_FIELD_NUMBER: builtins.int MINIMUM_EDITION_FIELD_NUMBER: builtins.int diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/psutil/METADATA.toml index 9cd22571b..aeea3dbe0 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/METADATA.toml @@ -1,4 +1,4 @@ -version = "5.9.*" +version = "6.0.*" upstream_repository = "https://github.com/giampaolo/psutil" [tool.stubtest] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/__init__.pyi index c68c1d214..b01ee3549 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/__init__.pyi @@ -3,7 +3,7 @@ from _typeshed import Incomplete from collections.abc import Callable, Iterable, Iterator from contextlib import AbstractContextManager from typing import Any, Literal, overload -from typing_extensions import Self, TypeAlias +from typing_extensions import Self, TypeAlias, deprecated from psutil._common import ( AIX as AIX, @@ -216,6 +216,7 @@ class Process: def memory_full_info(self) -> pfullmem: ... def memory_percent(self, memtype: str = "rss") -> float: ... def open_files(self) -> list[popenfile]: ... + @deprecated('use "net_connections" method instead') def connections(self, kind: str = "inet") -> list[pconn]: ... def send_signal(self, sig: int) -> None: ... def suspend(self) -> None: ... @@ -223,6 +224,7 @@ class Process: def terminate(self) -> None: ... def kill(self) -> None: ... def wait(self, timeout: float | None = None) -> int: ... + def net_connections(self, kind: str = "inet") -> list[pconn]: ... class Popen(Process): def __init__(self, *args, **kwargs) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_common.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_common.pyi index d755aa61d..7ea0bbb81 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_common.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_common.pyi @@ -89,8 +89,6 @@ class sdiskpart(NamedTuple): mountpoint: str fstype: str opts: str - maxfile: int - maxpath: int class snetio(NamedTuple): bytes_sent: int diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_compat.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_compat.pyi index 49fd95621..9bdcbe7d1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_compat.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_compat.pyi @@ -20,7 +20,6 @@ xrange = range unicode = str basestring = str -def u(s): ... def b(s): ... SubprocessTimeoutExpired = TimeoutExpired diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psaix.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psaix.pyi index 4b0dabdbe..c74f03021 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psaix.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psaix.pyi @@ -85,7 +85,7 @@ class Process: def create_time(self): ... def num_threads(self): ... def threads(self): ... - def connections(self, kind: str = ...): ... + def net_connections(self, kind: str = ...): ... def nice_get(self): ... def nice_set(self, value): ... def ppid(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psbsd.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psbsd.pyi index 16895183f..9e85dd9de 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psbsd.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psbsd.pyi @@ -136,7 +136,7 @@ class Process: def num_threads(self): ... def num_ctx_switches(self): ... def threads(self): ... - def connections(self, kind: str = ...): ... + def net_connections(self, kind: str = ...): ... def wait(self, timeout: Incomplete | None = ...): ... def nice_get(self): ... def nice_set(self, value): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pslinux.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pslinux.pyi index 3e390fda7..70b78688a 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pslinux.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pslinux.pyi @@ -148,7 +148,7 @@ net_if_addrs: Any class _Ipv6UnsupportedError(Exception): ... -class Connections: +class NetConnections: tmap: Any def __init__(self) -> None: ... def get_proc_inodes(self, pid): ... @@ -220,7 +220,7 @@ class Process: def rlimit(self, resource_, limits: Incomplete | None = ...): ... def status(self): ... def open_files(self): ... - def connections(self, kind: str = ...): ... + def net_connections(self, kind: str = ...): ... def num_fds(self): ... def ppid(self): ... def uids(self, _uids_re=...): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psosx.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psosx.pyi index 895d66f79..85bb909e5 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psosx.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psosx.pyi @@ -99,7 +99,7 @@ class Process: def num_ctx_switches(self): ... def num_threads(self): ... def open_files(self): ... - def connections(self, kind: str = ...): ... + def net_connections(self, kind: str = ...): ... def num_fds(self): ... def wait(self, timeout: Incomplete | None = ...): ... def nice_get(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pssunos.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pssunos.pyi index f5782aa0b..480dedfe7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pssunos.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pssunos.pyi @@ -114,7 +114,7 @@ class Process: def status(self): ... def threads(self): ... def open_files(self): ... - def connections(self, kind: str = ...): ... + def net_connections(self, kind: str = ...): ... class nt_mmap_grouped(NamedTuple): path: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psutil_osx.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psutil_osx.pyi index 79f291bf9..3a6ea7372 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psutil_osx.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_psutil_osx.pyi @@ -33,7 +33,7 @@ def net_io_counters(*args, **kwargs) -> Any: ... def per_cpu_times(*args, **kwargs) -> Any: ... def pids(*args, **kwargs) -> Any: ... def proc_cmdline(*args, **kwargs) -> Any: ... -def proc_connections(*args, **kwargs) -> Any: ... +def proc_net_connections(*args, **kwargs) -> Any: ... def proc_cwd(*args, **kwargs) -> Any: ... def proc_environ(*args, **kwargs) -> Any: ... def proc_exe(*args, **kwargs) -> Any: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pswindows.pyi b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pswindows.pyi index eb3bd612c..606383aef 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pswindows.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/psutil/psutil/_pswindows.pyi @@ -190,7 +190,7 @@ class Process: def resume(self) -> None: ... def cwd(self): ... def open_files(self): ... - def connections(self, kind: str = "inet"): ... + def net_connections(self, kind: str = "inet"): ... def nice_get(self): ... def nice_set(self, value): ... def ionice_get(self): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/METADATA.toml index f39bc8b31..e024779a5 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/METADATA.toml @@ -1,4 +1,4 @@ -version = "6.6.*" +version = "6.8.*" upstream_repository = "https://github.com/pyinstaller/pyinstaller" requires = ["types-setuptools"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/__main__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/__main__.pyi index 87e980344..8b295520d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/__main__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/__main__.pyi @@ -9,3 +9,4 @@ _PyIConfig: TypeAlias = ( # https://pyinstaller.org/en/stable/usage.html#running-pyinstaller-from-python-code def run(pyi_args: Iterable[str] | None = None, pyi_config: _PyIConfig | None = None) -> None: ... +def check_unsafe_privileges() -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/building/splash.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/building/splash.pyi index a6dd06f71..da76b1162 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/building/splash.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/building/splash.pyi @@ -12,7 +12,6 @@ class Splash(Target): name: Incomplete script_name: Incomplete minify_script: Incomplete - rundir: Incomplete max_img_size: Incomplete text_pos: Incomplete text_size: Incomplete @@ -37,7 +36,6 @@ class Splash(Target): text_default: str = "Initializing", full_tk: bool = False, minify_script: bool = True, - rundir: str = "__splash", name: str = ..., script_name: str = ..., max_img_size: tuple[int, int] | None = (760, 480), diff --git a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/compat.pyi b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/compat.pyi index 8b5fae0da..72e3d48b0 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/compat.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/pyinstaller/PyInstaller/compat.pyi @@ -1,8 +1,8 @@ # https://pyinstaller.org/en/stable/hooks.html#module-PyInstaller.compat -from _typeshed import FileDescriptorOrPath, GenericPath +from _typeshed import FileDescriptorOrPath from collections.abc import Iterable from types import ModuleType -from typing import AnyStr, Final, Literal, overload +from typing import Final, Literal, overload strict_collect_mode: bool is_64bits: Final[bool] @@ -65,7 +65,6 @@ def exec_command_all( ) -> tuple[int, str, str]: ... def exec_python(*args: str, **kwargs: str | None) -> str: ... def exec_python_rc(*args: str, **kwargs: str | None) -> int: ... -def expand_path(path: GenericPath[AnyStr]) -> AnyStr: ... def getsitepackages(prefixes: Iterable[str] | None = None) -> list[str]: ... def importlib_load_source(name: str, pathname: str) -> ModuleType: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/reportlab/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/reportlab/METADATA.toml index 0b276f0d6..fa3e5c756 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/reportlab/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/reportlab/METADATA.toml @@ -1,5 +1,6 @@ -version = "4.2.*" -# NOTE: There is no public upstream repository +version = "4.2.0" +# GitHub mirror of https://hg.reportlab.com/hg-public/reportlab/file +upstream_repository = "https://github.com/MrBitBucket/reportlab-mirror" [tool.stubtest] apt_dependencies = ["libcairo2-dev"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/requests/requests/models.pyi b/packages/pyright-internal/typeshed-fallback/stubs/requests/requests/models.pyi index 7e1a2e2de..e63d44f73 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/requests/requests/models.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/requests/requests/models.pyi @@ -1,5 +1,5 @@ import datetime -from _typeshed import Incomplete, Unused +from _typeshed import Incomplete, MaybeNone, Unused from collections.abc import Callable, Iterator from json import JSONDecoder from typing import Any @@ -144,7 +144,7 @@ class Response: self, chunk_size: int | None = 512, decode_unicode: bool = False, delimiter: str | bytes | None = None ) -> Iterator[Incomplete]: ... @property - def content(self) -> bytes: ... + def content(self) -> bytes | MaybeNone: ... @property def text(self) -> str: ... def json( diff --git a/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml index 4c5367456..d853169a8 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/seaborn/METADATA.toml @@ -1,6 +1,7 @@ version = "0.13.2" # Requires a version of numpy and matplotlib with a `py.typed` file -requires = ["matplotlib>=3.8", "numpy>=1.20", "pandas-stubs"] +# TODO: stubtest errors when using numpy 2 +requires = ["matplotlib>=3.8", "numpy>=1.20,<2", "pandas-stubs"] # matplotlib>=3.8 requires Python >=3.9 requires_python = ">=3.9" upstream_repository = "https://github.com/mwaskom/seaborn" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/METADATA.toml index 6d7b157b2..ba9bae6d6 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 = "70.0.*" +version = "70.1.*" upstream_repository = "https://github.com/pypa/setuptools" [tool.stubtest] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi index f31960dcf..6cfc305c1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/pkg_resources/__init__.pyi @@ -1,4 +1,3 @@ -import sys import types import zipimport from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused @@ -7,30 +6,32 @@ from io import BytesIO from itertools import chain from pkgutil import get_importer as get_importer from re import Pattern -from typing import IO, Any, ClassVar, Final, Literal, NoReturn, Protocol, TypeVar, overload, type_check_only +from typing import IO, Any, ClassVar, Final, Literal, NamedTuple, NoReturn, Protocol, TypeVar, overload from typing_extensions import Self, TypeAlias from zipfile import ZipInfo from ._vendored_packaging import requirements as packaging_requirements, version as packaging_version -# TODO: Use _typeshed.importlib.LoaderProtocol once mypy has included it in its vendored typeshed -class _LoaderProtocol(Protocol): - def load_module(self, fullname: str, /) -> types.ModuleType: ... - +# defined in setuptools _T = TypeVar("_T") -_D = TypeVar("_D", bound=Distribution) +_DistributionT = TypeVar("_DistributionT", bound=Distribution) _NestedStr: TypeAlias = str | Iterable[_NestedStr] -_StrictInstallerType: TypeAlias = Callable[[Requirement], _D] -_InstallerType: TypeAlias = Callable[[Requirement], Distribution | None] | None +_InstallerTypeT: TypeAlias = Callable[[Requirement], _DistributionT] # noqa: Y043 +_InstallerType: TypeAlias = Callable[[Requirement], Distribution | None] _PkgReqType: TypeAlias = str | Requirement _EPDistType: TypeAlias = Distribution | _PkgReqType _MetadataType: TypeAlias = IResourceProvider | None _ResolvedEntryPoint: TypeAlias = Any # Can be any attribute in the module +_ResourceStream: TypeAlias = Incomplete # A readable file-like object _ModuleLike: TypeAlias = object | types.ModuleType # Any object that optionally has __loader__ or __file__, usually a module -_ProviderFactoryType: TypeAlias = Callable[[_ModuleLike], IResourceProvider] +# Any: Should be _ModuleLike but we end up with issues where _ModuleLike doesn't have _ZipLoaderModule's __loader__ +_ProviderFactoryType: TypeAlias = Callable[[Any], IResourceProvider] _DistFinderType: TypeAlias = Callable[[_T, str, bool], Iterable[Distribution]] _NSHandlerType: TypeAlias = Callable[[_T, str, str, types.ModuleType], str | None] -_ResourceStream: TypeAlias = Incomplete # A readable file-like object + +# TODO: Use _typeshed.importlib.LoaderProtocol after mypy 1.11 is released +class _LoaderProtocol(Protocol): + def load_module(self, fullname: str, /) -> types.ModuleType: ... __all__ = [ "require", @@ -106,7 +107,6 @@ __all__ = [ "AvailableDistributions", ] -@type_check_only class _ZipLoaderModule(Protocol): __loader__: zipimport.zipimporter @@ -128,48 +128,52 @@ class WorkingSet: self, requirements: Iterable[Requirement], env: Environment | None, - installer: _StrictInstallerType[_D], + installer: _InstallerTypeT[_DistributionT], replace_conflicting: bool = False, extras: tuple[str, ...] | None = None, - ) -> list[_D]: ... + ) -> list[_DistributionT]: ... @overload def resolve( # type: ignore[overload-overlap] self, requirements: Iterable[Requirement], env: Environment | None = None, *, - installer: _StrictInstallerType[_D], + installer: _InstallerTypeT[_DistributionT], replace_conflicting: bool = False, extras: tuple[str, ...] | None = None, - ) -> list[_D]: ... + ) -> list[_DistributionT]: ... @overload - def resolve( + def resolve( # type: ignore[overload-overlap] self, requirements: Iterable[Requirement], env: Environment | None = None, - installer: _InstallerType = None, + installer: _InstallerType | None = None, replace_conflicting: bool = False, extras: tuple[str, ...] | None = None, ) -> list[Distribution]: ... @overload def find_plugins( # type: ignore[overload-overlap] - self, plugin_env: Environment, full_env: Environment | None, installer: _StrictInstallerType[_D], fallback: bool = True - ) -> tuple[list[_D], dict[Distribution, Exception]]: ... + self, + plugin_env: Environment, + full_env: Environment | None, + installer: _InstallerTypeT[_DistributionT], + fallback: bool = True, + ) -> tuple[list[_DistributionT], dict[Distribution, Exception]]: ... @overload def find_plugins( # type: ignore[overload-overlap] self, plugin_env: Environment, full_env: Environment | None = None, *, - installer: _StrictInstallerType[_D], + installer: _InstallerTypeT[_DistributionT], fallback: bool = True, - ) -> tuple[list[_D], dict[Distribution, Exception]]: ... + ) -> tuple[list[_DistributionT], dict[Distribution, Exception]]: ... @overload def find_plugins( self, plugin_env: Environment, full_env: Environment | None = None, - installer: _InstallerType = None, + installer: _InstallerType | None = None, fallback: bool = True, ) -> tuple[list[Distribution], dict[Distribution, Exception]]: ... def require(self, *requirements: _NestedStr) -> Sequence[Distribution]: ... @@ -186,18 +190,26 @@ class Environment: def add(self, dist: Distribution) -> None: ... @overload def best_match( - self, req: Requirement, working_set: WorkingSet, installer: _StrictInstallerType[_D], replace_conflicting: bool = False - ) -> _D: ... + self, + req: Requirement, + working_set: WorkingSet, + installer: _InstallerTypeT[_DistributionT], + replace_conflicting: bool = False, + ) -> _DistributionT: ... @overload def best_match( - self, req: Requirement, working_set: WorkingSet, installer: _InstallerType = None, replace_conflicting: bool = False + self, + req: Requirement, + working_set: WorkingSet, + installer: _InstallerType | None = None, + replace_conflicting: bool = False, ) -> Distribution | None: ... @overload - def obtain(self, requirement: Requirement, installer: _StrictInstallerType[_D]) -> _D: ... # type: ignore[overload-overlap] + def obtain(self, requirement: Requirement, installer: _InstallerTypeT[_DistributionT]) -> _DistributionT: ... # type: ignore[overload-overlap] @overload def obtain(self, requirement: Requirement, installer: Callable[[Requirement], None] | None = None) -> None: ... @overload - def obtain(self, requirement: Requirement, installer: _InstallerType = None) -> Distribution | None: ... + def obtain(self, requirement: Requirement, installer: _InstallerType | None = None) -> Distribution | None: ... def __iter__(self) -> Iterator[str]: ... def __iadd__(self, other: Distribution | Environment) -> Self: ... def __add__(self, other: Distribution | Environment) -> Self: ... @@ -239,12 +251,12 @@ class EntryPoint: ) -> None: ... @overload def load( - self, require: Literal[True] = True, env: Environment | None = None, installer: _InstallerType = None + self, require: Literal[True] = True, env: Environment | None = None, installer: _InstallerType | None = None ) -> _ResolvedEntryPoint: ... @overload - def load(self, require: Literal[False], *args: Unused, **kwargs: Unused) -> _ResolvedEntryPoint: ... + def load(self, require: Literal[False], *args: Any, **kwargs: Any) -> _ResolvedEntryPoint: ... def resolve(self) -> _ResolvedEntryPoint: ... - def require(self, env: Environment | None = None, installer: _InstallerType = None) -> None: ... + def require(self, env: Environment | None = None, installer: _InstallerType | None = None) -> None: ... pattern: ClassVar[Pattern[str]] @classmethod def parse(cls, src: str, dist: Distribution | None = None) -> Self: ... @@ -256,8 +268,17 @@ class EntryPoint: ) -> dict[str, dict[str, Self]]: ... def find_distributions(path_item: str, only: bool = False) -> Generator[Distribution, None, None]: ... +def find_eggs_in_zip(importer: zipimport.zipimporter, path_item: str, only: bool = False) -> Iterator[Distribution]: ... +def find_nothing(importer: object | None, path_item: str | None, only: bool | None = False) -> tuple[Distribution, ...]: ... +def find_on_path(importer: object | None, path_item: str, only: bool = False) -> Generator[Distribution, None, None]: ... +def dist_factory(path_item: StrPath, entry: str, only: bool) -> Callable[[str], Iterable[Distribution]]: ... + +class NoDists: + def __bool__(self) -> Literal[False]: ... + def __call__(self, fullpath: Unused) -> Iterator[Distribution]: ... + @overload -def get_distribution(dist: _D) -> _D: ... +def get_distribution(dist: _DistributionT) -> _DistributionT: ... @overload def get_distribution(dist: _PkgReqType) -> Distribution: ... @@ -279,7 +300,7 @@ class ResourceManager: def resource_listdir(self, package_or_requirement: _PkgReqType, resource_name: str) -> list[str]: ... def extraction_error(self) -> NoReturn: ... def get_cache_path(self, archive_name: str, names: Iterable[StrPath] = ()) -> str: ... - def postprocess(self, tempname: StrOrBytesPath, filename: str) -> None: ... + def postprocess(self, tempname: StrOrBytesPath, filename: StrOrBytesPath) -> None: ... def set_extraction_path(self, path: str) -> None: ... def cleanup_resources(self, force: bool = False) -> list[str]: ... @@ -298,16 +319,6 @@ class IMetadataProvider(Protocol): class ResolutionError(Exception): ... -class DistributionNotFound(ResolutionError): - def __init__(self, req: Requirement, requirers: set[str] | None, /, *args: object) -> None: ... - @property - def req(self) -> Requirement: ... - @property - def requirers(self) -> set[str] | None: ... - @property - def requirers_str(self) -> str: ... - def report(self) -> str: ... - class VersionConflict(ResolutionError): def __init__(self, dist: Distribution, req: Requirement, /, *args: object) -> None: ... @property @@ -322,6 +333,16 @@ class ContextualVersionConflict(VersionConflict): @property def required_by(self) -> set[str]: ... +class DistributionNotFound(ResolutionError): + def __init__(self, req: Requirement, requirers: set[str] | None, /, *args: object) -> None: ... + @property + def req(self) -> Requirement: ... + @property + def requirers(self) -> set[str] | None: ... + @property + def requirers_str(self) -> str: ... + def report(self) -> str: ... + class UnknownExtra(ResolutionError): ... class ExtractionError(Exception): @@ -331,6 +352,7 @@ class ExtractionError(Exception): def register_finder(importer_type: type[_T], distribution_finder: _DistFinderType[_T]) -> None: ... def register_loader_type(loader_type: type[_ModuleLike], provider_factory: _ProviderFactoryType) -> None: ... +def resolve_egg_link(path: str) -> Iterable[Distribution]: ... def register_namespace_handler(importer_type: type[_T], namespace_handler: _NSHandlerType[_T]) -> None: ... class IResourceProvider(IMetadataProvider, Protocol): @@ -348,7 +370,7 @@ class NullProvider: egg_name: str | None egg_info: str | None loader: _LoaderProtocol | None - module_path: str | None + module_path: str def __init__(self, module: _ModuleLike) -> None: ... def get_resource_filename(self, manager: ResourceManager, resource_name: str) -> str: ... @@ -449,11 +471,24 @@ class EggMetadata(ZipProvider): def __init__(self, importer: zipimport.zipimporter) -> None: ... class EmptyProvider(NullProvider): - module_path: None + # A special case, we don't want all Providers inheriting from NullProvider to have a potentially None module_path + module_path: str | None # type:ignore[assignment] def __init__(self) -> None: ... empty_provider: EmptyProvider +class ZipManifests(dict[str, MemoizedZipManifests.manifest_mod]): + @classmethod + def build(cls, path: str) -> dict[str, ZipInfo]: ... + load = build + +class MemoizedZipManifests(ZipManifests): + class manifest_mod(NamedTuple): + manifest: dict[str, ZipInfo] + mtime: float + + def load(self, path: str) -> dict[str, ZipInfo]: ... # type: ignore[override] + class FileMetadata(EmptyProvider): path: StrPath def __init__(self, path: StrPath) -> None: ... @@ -499,8 +534,3 @@ iter_entry_points = working_set.iter_entry_points add_activation_listener = working_set.subscribe run_script = working_set.run_script run_main = run_script - -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/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi index 75dbef9ba..e16ea2449 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/__init__.pyi @@ -1,7 +1,7 @@ from _typeshed import StrPath from abc import abstractmethod from collections.abc import Iterable, Mapping, Sequence -from typing import Any, Literal +from typing import Any from ._distutils.cmd import Command as _Command from .depends import Require as Require @@ -76,9 +76,7 @@ class Command(_Command): distribution: Distribution def __init__(self, dist: Distribution, **kw: Any) -> None: ... def ensure_string_list(self, option: str | list[str]) -> None: ... - def reinitialize_command( - self, command: _Command | str, reinit_subcommands: bool | Literal[0, 1] = 0, **kw: Any - ) -> _Command: ... + def reinitialize_command(self, command: _Command | str, reinit_subcommands: bool = False, **kw: Any) -> _Command: ... # type: ignore[override] @abstractmethod def initialize_options(self) -> None: ... @abstractmethod diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi index 3097252d1..cf04af017 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/build_meta.pyi @@ -1,6 +1,7 @@ from _typeshed import StrPath from collections.abc import Mapping from typing import Any +from typing_extensions import TypeAlias from . import dist @@ -17,6 +18,8 @@ __all__ = [ "SetupRequirementsError", ] +_ConfigSettings: TypeAlias = dict[str, str | list[str] | None] | None + class SetupRequirementsError(BaseException): specifiers: Any def __init__(self, specifiers) -> None: ... @@ -34,11 +37,11 @@ class _BuildMetaBackend: self, metadata_directory: str, config_settings: Mapping[str, Any] | None = None ) -> str: ... def build_wheel( - self, wheel_directory: StrPath, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None + self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: StrPath | None = None ) -> str: ... - def build_sdist(self, sdist_directory: StrPath, config_settings: Mapping[str, Any] | None = None) -> str: ... + def build_sdist(self, sdist_directory: StrPath, config_settings: _ConfigSettings | None = None) -> str: ... def build_editable( - self, wheel_directory: StrPath, config_settings: Mapping[str, Any] | None = None, metadata_directory: str | None = None + self, wheel_directory: StrPath, config_settings: _ConfigSettings | None = None, metadata_directory: str | None = None ) -> str: ... def get_requires_for_build_editable(self, config_settings: Mapping[str, Any] | None = None) -> list[str]: ... def prepare_metadata_for_build_editable( diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi index aec617755..356df96c7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_egg.pyi @@ -1,6 +1,5 @@ from _typeshed import Incomplete from collections.abc import Generator -from typing import Literal from .. import Command @@ -14,9 +13,9 @@ class bdist_egg(Command): boolean_options: Incomplete bdist_dir: Incomplete plat_name: Incomplete - keep_temp: int + keep_temp: bool dist_dir: Incomplete - skip_build: int + skip_build: bool egg_output: Incomplete exclude_source_files: Incomplete def initialize_options(self) -> None: ... @@ -48,10 +47,5 @@ def can_scan(): ... INSTALL_DIRECTORY_ATTRS: Incomplete def make_zipfile( - zip_filename, - base_dir, - verbose: bool | Literal[0, 1] = 0, - dry_run: bool | Literal[0, 1] = 0, - compress: bool = True, - mode: str = "w", + zip_filename, base_dir, verbose: bool = False, dry_run: bool = False, compress: bool = True, mode: str = "w" ): ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi new file mode 100644 index 000000000..9f416a7c4 --- /dev/null +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/bdist_wheel.pyi @@ -0,0 +1,61 @@ +from _typeshed import Incomplete +from collections.abc import Callable, Iterable +from types import TracebackType +from typing import Any, ClassVar, Final, Literal + +from setuptools import Command + +def safe_name(name: str) -> str: ... +def safe_version(version: str) -> str: ... + +setuptools_major_version: Final[int] + +PY_LIMITED_API_PATTERN: Final[str] + +def python_tag() -> str: ... +def get_platform(archive_root: str | None) -> str: ... +def get_flag(var: str, fallback: bool, expected: bool = True, warn: bool = True) -> bool: ... +def get_abi_tag() -> str | None: ... +def safer_name(name: str) -> str: ... +def safer_version(version: str) -> str: ... +def remove_readonly( + func: Callable[..., object], path: str, excinfo: tuple[type[Exception], Exception, TracebackType] +) -> None: ... +def remove_readonly_exc(func: Callable[..., object], path: str, exc: Exception) -> None: ... + +class bdist_wheel(Command): + description: ClassVar[str] + supported_compressions: ClassVar[dict[str, int]] + user_options: ClassVar[list[tuple[Any, ...]]] + boolean_options: ClassVar[list[str]] + + bdist_dir: str | None + data_dir: Incomplete | None + plat_name: str | None + plat_tag: Incomplete | None + format: str + keep_temp: bool + dist_dir: str | None + egginfo_dir: Incomplete | None + root_is_pure: bool | None + skip_build: Incomplete | None + relative: bool + owner: Incomplete | None + group: Incomplete | None + universal: bool + compression: str | int + python_tag: str + build_number: str | None + py_limited_api: str | Literal[False] + plat_name_supplied: bool + + def initialize_options(self) -> None: ... + def finalize_options(self) -> None: ... + @property + def wheel_dist_name(self) -> str: ... + def get_tag(self) -> tuple[str, str, str]: ... + def run(self) -> None: ... + def write_wheelfile(self, wheelfile_base: str, generator: str = ...) -> None: ... + @property + def license_paths(self) -> Iterable[str]: ... + def egg2dist(self, egginfo_path: str, distinfo_path: str) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi index 70f9c6c8f..584bfbbc2 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_ext.pyi @@ -1,5 +1,5 @@ from _typeshed import Incomplete -from typing import Any, ClassVar, Literal +from typing import Any, ClassVar from .._distutils.command.build_ext import build_ext as _build_ext @@ -40,7 +40,7 @@ def link_shared_object( library_dirs: Incomplete | None = None, runtime_library_dirs: Incomplete | None = None, export_symbols: Incomplete | None = None, - debug: bool | Literal[0, 1] = 0, + debug: bool = False, extra_preargs: Incomplete | None = None, extra_postargs: Incomplete | None = None, build_temp: Incomplete | None = None, diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi index 3bdce5ca6..ea6e94ea1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/build_py.pyi @@ -1,6 +1,7 @@ -from _typeshed import Incomplete +from _typeshed import Incomplete, StrPath from typing import Any, ClassVar +from .._distutils.cmd import _StrPathT from .._distutils.command import build_py as orig def make_writable(target) -> None: ... @@ -10,12 +11,22 @@ class build_py(orig.build_py): package_data: Any exclude_package_data: Any def finalize_options(self) -> None: ... + def copy_file( # type: ignore[override] + self, + infile: StrPath, + outfile: _StrPathT, + preserve_mode: bool = True, + preserve_times: bool = True, + link: str | None = None, + level=1, + ) -> tuple[_StrPathT | str, bool]: ... def run(self) -> None: ... data_files: Any def __getattr__(self, attr: str): ... def build_module(self, module, module_file, package): ... def get_data_files_without_manifest(self) -> list[tuple[Incomplete, Incomplete, Incomplete, list[Incomplete]]]: ... def find_data_files(self, package, src_dir): ... + def get_outputs(self, include_bytecode: bool = True) -> list[str]: ... # type: ignore[override] def build_package_data(self) -> None: ... manifest_files: Any def get_output_mapping(self) -> dict[str, str]: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi index cc3b8121a..9700eabb1 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/easy_install.pyi @@ -16,7 +16,7 @@ class easy_install(Command): boolean_options: Incomplete negative_opt: Incomplete create_index: Incomplete - user: int + user: bool zip_ok: Incomplete install_dir: Incomplete index_url: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi index 594159d8d..b5fba6b76 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/egg_info.pyi @@ -59,10 +59,10 @@ class FileList(_FileList): class manifest_maker(sdist): template: str - use_defaults: int - prune: int - manifest_only: int - force_manifest: int + use_defaults: bool + prune: bool + manifest_only: bool + force_manifest: bool def initialize_options(self) -> None: ... def finalize_options(self) -> None: ... filelist: Incomplete diff --git a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_lib.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_lib.pyi index b9c3e4fdb..79e3e59e0 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_lib.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/command/install_lib.pyi @@ -1,5 +1,4 @@ from _typeshed import StrPath, Unused -from typing import Literal from .._distutils.command import install_lib as orig @@ -10,9 +9,9 @@ class install_lib(orig.install_lib): self, infile: StrPath, outfile: str, - preserve_mode: bool | Literal[0, 1] = 1, - preserve_times: bool | Literal[0, 1] = 1, - preserve_symlinks: bool | Literal[0, 1] = 0, + preserve_mode: bool = True, # type: ignore[override] + preserve_times: bool = True, # type: ignore[override] + preserve_symlinks: bool = False, # type: ignore[override] level: Unused = 1, ): ... def get_outputs(self): ... 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 index aef113fc9..a71f08223 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py311.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/compat/py311.pyi @@ -1,4 +1,4 @@ from _typeshed import StrOrBytesPath from shutil import _OnExcCallback -def shutil_rmtree(path: StrOrBytesPath, ignore_errors: bool = False, onexc: _OnExcCallback | None = None): ... +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/config/expand.pyi b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi index 0b0ccf550..8695c8605 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/setuptools/setuptools/config/expand.pyi @@ -7,7 +7,6 @@ from typing_extensions import Self from ..dist import Distribution -chain_iter: Incomplete _K = TypeVar("_K") _VCo = TypeVar("_VCo", covariant=True) diff --git a/packages/pyright-internal/typeshed-fallback/stubs/shapely/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/shapely/METADATA.toml index e12eb3f77..32d94d6e9 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/shapely/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/shapely/METADATA.toml @@ -1,4 +1,5 @@ version = "2.0.*" # Requires a version of numpy with a `py.typed` file -requires = ["numpy>=1.20"] +# TODO: stubtest errors when using numpy 2 +requires = ["numpy>=1.20,<2"] upstream_repository = "https://github.com/shapely/shapely" diff --git a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_geometry.pyi b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_geometry.pyi index 5f1833533..874dc42ab 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_geometry.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/_geometry.pyi @@ -162,9 +162,9 @@ def get_precision(geometry: Geometry | None, **kwargs) -> float: ... def get_precision(geometry: OptGeoArrayLikeSeq, **kwargs) -> NDArray[np.float64]: ... class SetPrecisionMode(ParamEnum): - valid_output = 0 # noqa: Y052 - pointwise = 1 # noqa: Y052 - keep_collapsed = 2 # noqa: Y052 + valid_output = 0 + pointwise = 1 + keep_collapsed = 2 @overload def set_precision(geometry: OptGeoT, grid_size: float, mode: _PrecisionMode = "valid_output", **kwargs) -> OptGeoT: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/constructive.pyi b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/constructive.pyi index 55ceab3c7..f022b0cd7 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/constructive.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/constructive.pyi @@ -39,14 +39,14 @@ __all__ = [ ] class BufferCapStyle(ParamEnum): - round = 1 # noqa: Y052 - flat = 2 # noqa: Y052 - square = 3 # noqa: Y052 + round = 1 + flat = 2 + square = 3 class BufferJoinStyle(ParamEnum): - round = 1 # noqa: Y052 - mitre = 2 # noqa: Y052 - bevel = 3 # noqa: Y052 + round = 1 + mitre = 2 + bevel = 3 @overload def boundary(geometry: Point | MultiPoint, **kwargs) -> GeometryCollection: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/geometry/base.pyi b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/geometry/base.pyi index fe0da8aa5..ac8b1ca31 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/geometry/base.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/geometry/base.pyi @@ -1,7 +1,7 @@ from array import array from collections.abc import Iterator from typing import Any, Generic, Literal, NoReturn, overload -from typing_extensions import Self, TypeVar, deprecated # noqa: Y023 +from typing_extensions import Self, TypeVar, deprecated import numpy as np from numpy.typing import NDArray @@ -33,7 +33,7 @@ class JOIN_STYLE: class BaseGeometry(Geometry): @deprecated( "Directly calling 'BaseGeometry()' is deprecated. To create an empty geometry, " - "use one of the subclasses instead, for example 'GeometryCollection()'." # pyright: ignore[reportImplicitStringConcatenation] + "use one of the subclasses instead, for example 'GeometryCollection()'." ) def __new__(self) -> GeometryCollection: ... def __bool__(self) -> bool: ... @@ -280,6 +280,6 @@ class GeometrySequence(Generic[_P_co]): class EmptyGeometry(BaseGeometry): @deprecated( "The 'EmptyGeometry()' constructor is deprecated. Use one of the " - "geometry subclasses instead, for example 'GeometryCollection()'." # pyright: ignore[reportImplicitStringConcatenation] + "geometry subclasses instead, for example 'GeometryCollection()'." ) def __new__(self) -> GeometryCollection: ... # type: ignore[misc] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/io.pyi b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/io.pyi index f7e1d2e85..27b667e53 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/io.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/io.pyi @@ -18,8 +18,8 @@ __all__ = ["from_geojson", "from_ragged_array", "from_wkb", "from_wkt", "to_geoj DecodingErrorOptions: Incomplete class WKBFlavorOptions(ParamEnum): - extended = 1 # noqa: Y052 - iso = 2 # noqa: Y052 + extended = 1 + iso = 2 @overload def to_wkt( diff --git a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/strtree.pyi b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/strtree.pyi index d43291c78..d85da2e73 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/strtree.pyi +++ b/packages/pyright-internal/typeshed-fallback/stubs/shapely/shapely/strtree.pyi @@ -15,15 +15,15 @@ _BinaryPredicate: TypeAlias = Literal[ ] class BinaryPredicate(ParamEnum): - intersects = 1 # noqa: Y052 - within = 2 # noqa: Y052 - contains = 3 # noqa: Y052 - overlaps = 4 # noqa: Y052 - crosses = 5 # noqa: Y052 - touches = 6 # noqa: Y052 - covers = 7 # noqa: Y052 - covered_by = 8 # noqa: Y052 - contains_properly = 9 # noqa: Y052 + intersects = 1 + within = 2 + contains = 3 + overlaps = 4 + crosses = 5 + touches = 6 + covers = 7 + covered_by = 8 + contains_properly = 9 class STRtree: def __init__(self, geoms: GeoArrayLikeSeq, node_capacity: SupportsIndex = 10) -> None: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter-languages/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter-languages/METADATA.toml index 3922f7af9..055b8d94d 100644 --- a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter-languages/METADATA.toml +++ b/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter-languages/METADATA.toml @@ -1,3 +1,3 @@ version = "1.10.*" upstream_repository = "https://github.com/grantjenks/py-tree-sitter-languages" -requires = ["types-tree-sitter"] +requires = ["tree-sitter>=0.20.3"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/METADATA.toml b/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/METADATA.toml deleted file mode 100644 index bfcd1317b..000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/METADATA.toml +++ /dev/null @@ -1,7 +0,0 @@ -version = "0.20.1" -upstream_repository = "https://github.com/tree-sitter/py-tree-sitter" -obsolete_since = "0.20.3" # Released on 2023-11-13 - -[tool.stubtest] -# The runtime has an undeclared dependency on setuptools -stubtest_requirements = ["setuptools"] diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/tree_sitter/__init__.pyi b/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/tree_sitter/__init__.pyi deleted file mode 100644 index d26b17620..000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/tree_sitter/__init__.pyi +++ /dev/null @@ -1,17 +0,0 @@ -import ctypes -from _typeshed import StrPath -from collections.abc import Sequence - -# At runtime, Query and Range are available only in tree_sitter.binding -from tree_sitter.binding import Node as Node, Parser as Parser, Query, Tree as Tree, TreeCursor as TreeCursor - -class Language: - @staticmethod - def build_library(output_path: str, repo_paths: Sequence[StrPath]) -> bool: ... - name: str - lib: ctypes.CDLL - language_id: int - # library_path is passed into ctypes LoadLibrary - def __init__(self, library_path: str, name: str) -> None: ... - def field_id_for_name(self, name: str) -> int | None: ... - def query(self, source: str) -> Query: ... diff --git a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/tree_sitter/binding.pyi b/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/tree_sitter/binding.pyi deleted file mode 100644 index 5b07bfd55..000000000 --- a/packages/pyright-internal/typeshed-fallback/stubs/tree-sitter/tree_sitter/binding.pyi +++ /dev/null @@ -1,115 +0,0 @@ -from typing import Any, ClassVar, final - -from tree_sitter import Language - -@final -class Node: - @property - def start_byte(self) -> int: ... - @property - def start_point(self) -> tuple[int, int]: ... - @property - def end_byte(self) -> int: ... - @property - def end_point(self) -> tuple[int, int]: ... - @property - def has_changes(self) -> bool: ... - @property - def has_error(self) -> bool: ... - @property - def id(self) -> int: ... - @property - def is_missing(self) -> bool: ... - @property - def is_named(self) -> bool: ... - @property - def child_count(self) -> int: ... - @property - def named_child_count(self) -> bool: ... - @property - def children(self) -> list[Node]: ... - @property - def named_children(self) -> list[Node]: ... - @property - def next_named_sibling(self) -> Node | None: ... - @property - def next_sibling(self) -> Node | None: ... - @property - def parent(self) -> Node | None: ... - @property - def prev_named_sibling(self) -> Node | None: ... - @property - def prev_sibling(self) -> Node | None: ... - @property - def text(self) -> bytes | Any: ... # can be None, but annoying to check - @property - def type(self) -> str: ... - def children_by_field_name(self, name: str) -> list[Node]: ... - def children_by_field_id(self, id: int, /) -> list[Node]: ... - def field_name_for_child(self, child_index: int, /) -> str: ... - def child_by_field_id(self, id: int, /) -> Node | None: ... - def child_by_field_name(self, name: str, /) -> Node | None: ... - __hash__: ClassVar[None] # type: ignore[assignment] - def sexp(self) -> str: ... - def walk(self) -> TreeCursor: ... - def __eq__(self, other: object) -> bool: ... - def __ne__(self, other: object) -> bool: ... - # There are __ge__, __gt__, __le__, __lt__ methods but they always return False - # - # >>> n - # - # >>> n >= "", n <= "", n >= 0, n <= 0, n >= (0,0), n <= (0,0) - # (False, False, False, False, False, False) - -@final -class Parser: - # At runtime, Parser(1, 2, 3) ignores the arguments, but that's most likely buggy code - def __init__(self) -> None: ... - def parse(self, source: bytes, old_tree: Tree | None = None, keep_text: bool = True) -> Tree: ... - def set_language(self, language: Language, /) -> None: ... - -@final -class Query: - # start_point and end_point arguments don't seem to do anything - # TODO: sync with - # https://github.com/tree-sitter/py-tree-sitter/blob/d3016edac2c33ce647653d896fbfb435ac2a6245/tree_sitter/binding.c#L1304 - def captures(self, node: Node) -> list[tuple[Node, str]]: ... - -@final -class Range: - @property - def start_byte(self) -> int: ... - @property - def end_byte(self) -> int: ... - @property - def start_point(self) -> tuple[int, int]: ... - @property - def end_point(self) -> tuple[int, int]: ... - -@final -class Tree: - @property - def root_node(self) -> Node: ... - @property - def text(self) -> bytes | Any: ... # technically ReadableBuffer | Any - def edit( - self, - start_byte: int, - old_end_byte: int, - new_end_byte: int, - start_point: tuple[int, int], - old_end_point: tuple[int, int], - new_end_point: tuple[int, int], - ) -> None: ... - def get_changed_ranges(self, new_tree: Tree) -> list[Range]: ... - def walk(self) -> TreeCursor: ... - -@final -class TreeCursor: - @property - def node(self) -> Node: ... - def copy(self) -> TreeCursor: ... - def current_field_name(self) -> str | None: ... - def goto_first_child(self) -> bool: ... - def goto_next_sibling(self) -> bool: ... - def goto_parent(self) -> bool: ...