Sync vendored typeshed stubs (#15864)

Close and reopen this PR to trigger CI

Co-authored-by: typeshedbot <>
This commit is contained in:
github-actions[bot] 2025-02-01 01:01:58 +00:00 committed by GitHub
parent b58f2c399e
commit 942d7f395a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 75 additions and 69 deletions

View File

@ -1 +1 @@
101287091cbd71a3305a4fc4a1a8eb5df0e3f6f7 c193cd2a36839c8e6336f350397f51ce52fedd5e

View File

@ -27,14 +27,14 @@ _TrapType: TypeAlias = type[DecimalException]
__version__: Final[str] __version__: Final[str]
__libmpdec_version__: Final[str] __libmpdec_version__: Final[str]
ROUND_DOWN: Final[str] ROUND_DOWN: Final = "ROUND_DOWN"
ROUND_HALF_UP: Final[str] ROUND_HALF_UP: Final = "ROUND_HALF_UP"
ROUND_HALF_EVEN: Final[str] ROUND_HALF_EVEN: Final = "ROUND_HALF_EVEN"
ROUND_CEILING: Final[str] ROUND_CEILING: Final = "ROUND_CEILING"
ROUND_FLOOR: Final[str] ROUND_FLOOR: Final = "ROUND_FLOOR"
ROUND_UP: Final[str] ROUND_UP: Final = "ROUND_UP"
ROUND_HALF_DOWN: Final[str] ROUND_HALF_DOWN: Final = "ROUND_HALF_DOWN"
ROUND_05UP: Final[str] ROUND_05UP: Final = "ROUND_05UP"
HAVE_CONTEXTVAR: Final[bool] HAVE_CONTEXTVAR: Final[bool]
HAVE_THREADS: Final[bool] HAVE_THREADS: Final[bool]
MAX_EMAX: Final[int] MAX_EMAX: Final[int]

View File

@ -1,13 +1,13 @@
from typing import SupportsComplex, SupportsFloat, SupportsIndex from typing import Final, SupportsComplex, SupportsFloat, SupportsIndex
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
e: float e: Final[float]
pi: float pi: Final[float]
inf: float inf: Final[float]
infj: complex infj: Final[complex]
nan: float nan: Final[float]
nanj: complex nanj: Final[complex]
tau: float tau: Final[float]
_C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex _C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex

View File

@ -32,9 +32,9 @@ _T = TypeVar("_T")
_T_co = TypeVar("_T_co", covariant=True) _T_co = TypeVar("_T_co", covariant=True)
_T_io = TypeVar("_T_io", bound=IO[str] | None) _T_io = TypeVar("_T_io", bound=IO[str] | None)
_ExitT_co = TypeVar("_ExitT_co", covariant=True, bound=bool | None, default=bool | None) _ExitT_co = TypeVar("_ExitT_co", covariant=True, bound=bool | None, default=bool | None)
_F = TypeVar("_F", bound=Callable[..., Any])
_G = TypeVar("_G", bound=Generator[Any, Any, Any] | AsyncGenerator[Any, Any], covariant=True) _G = TypeVar("_G", bound=Generator[Any, Any, Any] | AsyncGenerator[Any, Any], covariant=True)
_P = ParamSpec("_P") _P = ParamSpec("_P")
_R = TypeVar("_R")
_SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=None) _SendT_contra = TypeVar("_SendT_contra", contravariant=True, default=None)
_ReturnT_co = TypeVar("_ReturnT_co", covariant=True, default=None) _ReturnT_co = TypeVar("_ReturnT_co", covariant=True, default=None)
@ -64,9 +64,13 @@ class AbstractAsyncContextManager(ABC, Protocol[_T_co, _ExitT_co]): # type: ign
self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, / self, exc_type: type[BaseException] | None, exc_value: BaseException | None, traceback: TracebackType | None, /
) -> _ExitT_co: ... ) -> _ExitT_co: ...
class _WrappedCallable(Generic[_P, _R]):
__wrapped__: Callable[_P, _R]
def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
class ContextDecorator: class ContextDecorator:
def _recreate_cm(self) -> Self: ... def _recreate_cm(self) -> Self: ...
def __call__(self, func: _F) -> _F: ... def __call__(self, func: Callable[_P, _R]) -> _WrappedCallable[_P, _R]: ...
class _GeneratorContextManagerBase(Generic[_G]): class _GeneratorContextManagerBase(Generic[_G]):
# Ideally this would use ParamSpec, but that requires (*args, **kwargs), which this isn't. see #6676 # Ideally this would use ParamSpec, but that requires (*args, **kwargs), which this isn't. see #6676
@ -93,11 +97,11 @@ class _GeneratorContextManager(
def contextmanager(func: Callable[_P, Iterator[_T_co]]) -> Callable[_P, _GeneratorContextManager[_T_co]]: ... def contextmanager(func: Callable[_P, Iterator[_T_co]]) -> Callable[_P, _GeneratorContextManager[_T_co]]: ...
if sys.version_info >= (3, 10): if sys.version_info >= (3, 10):
_AF = TypeVar("_AF", bound=Callable[..., Awaitable[Any]]) _AR = TypeVar("_AR", bound=Awaitable[Any])
class AsyncContextDecorator: class AsyncContextDecorator:
def _recreate_cm(self) -> Self: ... def _recreate_cm(self) -> Self: ...
def __call__(self, func: _AF) -> _AF: ... def __call__(self, func: Callable[_P, _AR]) -> _WrappedCallable[_P, _AR]: ...
class _AsyncGeneratorContextManager( class _AsyncGeneratorContextManager(
_GeneratorContextManagerBase[AsyncGenerator[_T_co, _SendT_contra]], _GeneratorContextManagerBase[AsyncGenerator[_T_co, _SendT_contra]],

View File

@ -65,7 +65,7 @@ class Underflow(Inexact, Rounded, Subnormal): ...
class FloatOperation(DecimalException, TypeError): ... class FloatOperation(DecimalException, TypeError): ...
class Decimal: class Decimal:
def __new__(cls, value: _DecimalNew = ..., context: Context | None = ...) -> Self: ... def __new__(cls, value: _DecimalNew = "0", context: Context | None = None) -> Self: ...
@classmethod @classmethod
def from_float(cls, f: float, /) -> Self: ... def from_float(cls, f: float, /) -> Self: ...
def __bool__(self) -> bool: ... def __bool__(self) -> bool: ...
@ -163,12 +163,12 @@ class Decimal:
def __reduce__(self) -> tuple[type[Self], tuple[str]]: ... def __reduce__(self) -> tuple[type[Self], tuple[str]]: ...
def __copy__(self) -> Self: ... def __copy__(self) -> Self: ...
def __deepcopy__(self, memo: Any, /) -> Self: ... def __deepcopy__(self, memo: Any, /) -> Self: ...
def __format__(self, specifier: str, context: Context | None = ..., /) -> str: ... def __format__(self, specifier: str, context: Context | None = None, /) -> str: ...
class Context: class Context:
# TODO: Context doesn't allow you to delete *any* attributes from instances of the class at runtime, # TODO: Context doesn't allow you to delete *any* attributes from instances of the class at runtime,
# even settable attributes like `prec` and `rounding`, # even settable attributes like `prec` and `rounding`,
# but that's inexpressable in the stub. # but that's inexpressible in the stub.
# Type checkers either ignore it or misinterpret it # Type checkers either ignore it or misinterpret it
# if you add a `def __delattr__(self, name: str, /) -> NoReturn` method to the stub # if you add a `def __delattr__(self, name: str, /) -> NoReturn` method to the stub
prec: int prec: int
@ -181,14 +181,14 @@ class Context:
flags: dict[_TrapType, bool] flags: dict[_TrapType, bool]
def __init__( def __init__(
self, self,
prec: int | None = ..., prec: int | None = None,
rounding: str | None = ..., rounding: str | None = None,
Emin: int | None = ..., Emin: int | None = None,
Emax: int | None = ..., Emax: int | None = None,
capitals: int | None = ..., capitals: int | None = None,
clamp: int | None = ..., clamp: int | None = None,
flags: None | dict[_TrapType, bool] | Container[_TrapType] = ..., flags: dict[_TrapType, bool] | Container[_TrapType] | None = None,
traps: None | dict[_TrapType, bool] | Container[_TrapType] = ..., traps: dict[_TrapType, bool] | Container[_TrapType] | None = None,
) -> None: ... ) -> None: ...
def __reduce__(self) -> tuple[type[Self], tuple[Any, ...]]: ... def __reduce__(self) -> tuple[type[Self], tuple[Any, ...]]: ...
def clear_flags(self) -> None: ... def clear_flags(self) -> None: ...

View File

@ -16,7 +16,7 @@ if sys.version_info >= (3, 11):
Anchor: TypeAlias = Package Anchor: TypeAlias = Package
def package_to_anchor( def package_to_anchor(
func: Callable[[Anchor | None], Traversable] func: Callable[[Anchor | None], Traversable],
) -> Callable[[Anchor | None, Anchor | None], Traversable]: ... ) -> Callable[[Anchor | None, Anchor | None], Traversable]: ...
@overload @overload
def files(anchor: Anchor | None = None) -> Traversable: ... def files(anchor: Anchor | None = None) -> Traversable: ...

View File

@ -370,7 +370,7 @@ if sys.version_info >= (3, 12):
AGEN_CLOSED: Final = "AGEN_CLOSED" AGEN_CLOSED: Final = "AGEN_CLOSED"
def getasyncgenstate( def getasyncgenstate(
agen: AsyncGenerator[Any, Any] agen: AsyncGenerator[Any, Any],
) -> Literal["AGEN_CREATED", "AGEN_RUNNING", "AGEN_SUSPENDED", "AGEN_CLOSED"]: ... ) -> Literal["AGEN_CREATED", "AGEN_RUNNING", "AGEN_SUSPENDED", "AGEN_CLOSED"]: ...
def getasyncgenlocals(agen: AsyncGeneratorType[Any, Any]) -> dict[str, Any]: ... def getasyncgenlocals(agen: AsyncGeneratorType[Any, Any]) -> dict[str, Any]: ...
@ -590,7 +590,7 @@ GEN_SUSPENDED: Final = "GEN_SUSPENDED"
GEN_CLOSED: Final = "GEN_CLOSED" GEN_CLOSED: Final = "GEN_CLOSED"
def getgeneratorstate( def getgeneratorstate(
generator: Generator[Any, Any, Any] generator: Generator[Any, Any, Any],
) -> Literal["GEN_CREATED", "GEN_RUNNING", "GEN_SUSPENDED", "GEN_CLOSED"]: ... ) -> Literal["GEN_CREATED", "GEN_RUNNING", "GEN_SUSPENDED", "GEN_CLOSED"]: ...
CORO_CREATED: Final = "CORO_CREATED" CORO_CREATED: Final = "CORO_CREATED"
@ -599,7 +599,7 @@ CORO_SUSPENDED: Final = "CORO_SUSPENDED"
CORO_CLOSED: Final = "CORO_CLOSED" CORO_CLOSED: Final = "CORO_CLOSED"
def getcoroutinestate( def getcoroutinestate(
coroutine: Coroutine[Any, Any, Any] coroutine: Coroutine[Any, Any, Any],
) -> Literal["CORO_CREATED", "CORO_RUNNING", "CORO_SUSPENDED", "CORO_CLOSED"]: ... ) -> Literal["CORO_CREATED", "CORO_RUNNING", "CORO_SUSPENDED", "CORO_CLOSED"]: ...
def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> dict[str, Any]: ... def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> dict[str, Any]: ...
def getcoroutinelocals(coroutine: Coroutine[Any, Any, Any]) -> dict[str, Any]: ... def getcoroutinelocals(coroutine: Coroutine[Any, Any, Any]) -> dict[str, Any]: ...

View File

@ -18,7 +18,7 @@ def ip_network(
address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int], strict: bool = True address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int], strict: bool = True
) -> IPv4Network | IPv6Network: ... ) -> IPv4Network | IPv6Network: ...
def ip_interface( def ip_interface(
address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int] address: _RawIPAddress | _RawNetworkPart | tuple[_RawIPAddress] | tuple[_RawIPAddress, int],
) -> IPv4Interface | IPv6Interface: ... ) -> IPv4Interface | IPv6Interface: ...
class _IPAddressBase: class _IPAddressBase:

View File

@ -2,11 +2,11 @@ from collections.abc import Callable, Iterator
from re import Pattern from re import Pattern
from typing import Any, Final from typing import Any, Final
ESCAPE: Final[Pattern[str]] ESCAPE: Final[Pattern[str]] # undocumented
ESCAPE_ASCII: Final[Pattern[str]] ESCAPE_ASCII: Final[Pattern[str]] # undocumented
HAS_UTF8: Final[Pattern[bytes]] HAS_UTF8: Final[Pattern[bytes]] # undocumented
ESCAPE_DCT: Final[dict[str, str]] ESCAPE_DCT: Final[dict[str, str]] # undocumented
INFINITY: Final[float] INFINITY: Final[float] # undocumented
def py_encode_basestring(s: str) -> str: ... # undocumented def py_encode_basestring(s: str) -> str: ... # undocumented
def py_encode_basestring_ascii(s: str) -> str: ... # undocumented def py_encode_basestring_ascii(s: str) -> str: ... # undocumented

View File

@ -1,3 +1,7 @@
from _json import make_scanner as make_scanner from _json import make_scanner as make_scanner
from re import Pattern
from typing import Final
__all__ = ["make_scanner"] __all__ = ["make_scanner"]
NUMBER_RE: Final[Pattern[str]] # undocumented

View File

@ -1,6 +1,6 @@
import sys import sys
from collections.abc import Iterable from collections.abc import Iterable
from typing import Protocol, SupportsFloat, SupportsIndex, TypeVar, overload from typing import Final, Protocol, SupportsFloat, SupportsIndex, TypeVar, overload
from typing_extensions import TypeAlias from typing_extensions import TypeAlias
_T = TypeVar("_T") _T = TypeVar("_T")
@ -8,11 +8,11 @@ _T_co = TypeVar("_T_co", covariant=True)
_SupportsFloatOrIndex: TypeAlias = SupportsFloat | SupportsIndex _SupportsFloatOrIndex: TypeAlias = SupportsFloat | SupportsIndex
e: float e: Final[float]
pi: float pi: Final[float]
inf: float inf: Final[float]
nan: float nan: Final[float]
tau: float tau: Final[float]
def acos(x: _SupportsFloatOrIndex, /) -> float: ... def acos(x: _SupportsFloatOrIndex, /) -> float: ...
def acosh(x: _SupportsFloatOrIndex, /) -> float: ... def acosh(x: _SupportsFloatOrIndex, /) -> float: ...

View File

@ -1,8 +1,8 @@
import builtins import builtins
from _typeshed import Incomplete, MaybeNone from _typeshed import MaybeNone, SupportsWrite
from abc import abstractmethod from abc import abstractmethod
from collections.abc import Callable, Iterable, Mapping, Sequence from collections.abc import Callable, Iterable, Mapping, Sequence
from typing import IO, Any, AnyStr, ClassVar, Literal, NoReturn, overload from typing import Any, ClassVar, Literal, NoReturn, overload
from typing_extensions import Self from typing_extensions import Self
__all__ = [ __all__ = [
@ -274,13 +274,13 @@ class OptionParser(OptionContainer):
def _add_version_option(self) -> None: ... def _add_version_option(self) -> None: ...
def _create_option_list(self) -> None: ... def _create_option_list(self) -> None: ...
def _get_all_options(self) -> list[Option]: ... def _get_all_options(self) -> list[Option]: ...
def _get_args(self, args: Iterable[Incomplete]) -> list[Incomplete]: ... def _get_args(self, args: list[str] | None) -> list[str]: ...
def _init_parsing_state(self) -> None: ... def _init_parsing_state(self) -> None: ...
def _match_long_opt(self, opt: str) -> str: ... def _match_long_opt(self, opt: str) -> str: ...
def _populate_option_list(self, option_list: Iterable[Option], add_help: bool = True) -> None: ... def _populate_option_list(self, option_list: Iterable[Option] | None, add_help: bool = True) -> None: ...
def _process_args(self, largs: list[Incomplete], rargs: list[Incomplete], values: Values) -> None: ... def _process_args(self, largs: list[str], rargs: list[str], values: Values) -> None: ...
def _process_long_opt(self, rargs: list[Incomplete], values) -> None: ... def _process_long_opt(self, rargs: list[str], values: Values) -> None: ...
def _process_short_opts(self, rargs: list[Incomplete], values) -> None: ... def _process_short_opts(self, rargs: list[str], values: Values) -> None: ...
@overload @overload
def add_option_group(self, opt_group: OptionGroup, /) -> OptionGroup: ... def add_option_group(self, opt_group: OptionGroup, /) -> OptionGroup: ...
@overload @overload
@ -299,14 +299,11 @@ class OptionParser(OptionContainer):
def get_prog_name(self) -> str: ... def get_prog_name(self) -> str: ...
def get_usage(self) -> str: ... def get_usage(self) -> str: ...
def get_version(self) -> str: ... def get_version(self) -> str: ...
@overload def parse_args(self, args: list[str] | None = None, values: Values | None = None) -> tuple[Values, list[str]]: ...
def parse_args(self, args: None = None, values: Values | None = None) -> tuple[Values, list[str]]: ... def print_usage(self, file: SupportsWrite[str] | None = None) -> None: ...
@overload def print_help(self, file: SupportsWrite[str] | None = None) -> None: ...
def parse_args(self, args: Sequence[AnyStr], values: Values | None = None) -> tuple[Values, list[AnyStr]]: ... def print_version(self, file: SupportsWrite[str] | None = None) -> None: ...
def print_usage(self, file: IO[str] | None = None) -> None: ... def set_default(self, dest: str, value: Any) -> None: ... # default value can be "any" type
def print_help(self, file: IO[str] | None = None) -> None: ... def set_defaults(self, **kwargs: Any) -> None: ... # default values can be "any" type
def print_version(self, file: IO[str] | None = None) -> None: ... def set_process_default_values(self, process: bool) -> None: ...
def set_default(self, dest, value) -> None: ... def set_usage(self, usage: str | None) -> None: ...
def set_defaults(self, **kwargs) -> None: ...
def set_process_default_values(self, process) -> None: ...
def set_usage(self, usage: str) -> None: ...

View File

@ -396,6 +396,7 @@ def intern(string: str, /) -> str: ...
if sys.version_info >= (3, 13): if sys.version_info >= (3, 13):
def _is_gil_enabled() -> bool: ... def _is_gil_enabled() -> bool: ...
def _clear_internal_caches() -> None: ...
def is_finalizing() -> bool: ... def is_finalizing() -> bool: ...
def breakpointhook(*args: Any, **kwargs: Any) -> Any: ... def breakpointhook(*args: Any, **kwargs: Any) -> Any: ...

View File

@ -130,9 +130,8 @@ class Untokenizer:
if sys.version_info >= (3, 12): if sys.version_info >= (3, 12):
def escape_brackets(self, token: str) -> str: ... def escape_brackets(self, token: str) -> str: ...
# the docstring says "returns bytes" but is incorrect -- # Returns str, unless the ENCODING token is present, in which case it returns bytes.
# if the ENCODING token is missing, it skips the encode def untokenize(iterable: Iterable[_Token]) -> str | Any: ...
def untokenize(iterable: Iterable[_Token]) -> Any: ...
def detect_encoding(readline: Callable[[], bytes | bytearray]) -> tuple[str, Sequence[bytes]]: ... def detect_encoding(readline: Callable[[], bytes | bytearray]) -> tuple[str, Sequence[bytes]]: ...
def tokenize(readline: Callable[[], bytes | bytearray]) -> Generator[TokenInfo, None, None]: ... def tokenize(readline: Callable[[], bytes | bytearray]) -> Generator[TokenInfo, None, None]: ...
def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, None]: ... def generate_tokens(readline: Callable[[], str]) -> Generator[TokenInfo, None, None]: ...

View File

@ -640,6 +640,7 @@ if sys.version_info >= (3, 9):
def __getitem__(self, typeargs: Any, /) -> GenericAlias: ... def __getitem__(self, typeargs: Any, /) -> GenericAlias: ...
def __eq__(self, value: object, /) -> bool: ... def __eq__(self, value: object, /) -> bool: ...
def __hash__(self) -> int: ... def __hash__(self) -> int: ...
def __mro_entries__(self, bases: Iterable[object], /) -> tuple[type, ...]: ...
if sys.version_info >= (3, 11): if sys.version_info >= (3, 11):
@property @property
def __unpacked__(self) -> bool: ... def __unpacked__(self) -> bool: ...