Sync vendored typeshed stubs (#11885)

This commit is contained in:
github-actions[bot] 2024-06-15 02:15:19 +01:00 committed by GitHub
parent 19cd9d7d8a
commit e7c4d28c5e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
16 changed files with 243 additions and 75 deletions

View file

@ -1 +1 @@
4b6558c12ac43cd40716cd6452fe98a632ae65d7
114409d49b43ba62a179ebb856fa70a5161f751e

View file

@ -65,9 +65,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 +270,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-

View file

@ -7,8 +7,11 @@ PyCF_ONLY_AST: Literal[1024]
PyCF_TYPE_COMMENTS: Literal[4096]
PyCF_ALLOW_TOP_LEVEL_AWAIT: Literal[8192]
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

View file

@ -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

View file

@ -45,5 +45,5 @@ class make_scanner:
def __init__(self, context: make_scanner) -> None: ...
def __call__(self, string: str, index: int) -> tuple[Any, int]: ...
def encode_basestring_ascii(s: str) -> str: ...
def encode_basestring_ascii(s: str, /) -> str: ...
def scanstring(string: str, end: int, strict: bool = ...) -> tuple[str, int]: ...

View file

@ -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]

View file

@ -365,3 +365,6 @@ def walk(node: AST) -> Iterator[AST]: ...
if sys.version_info >= (3, 9):
def main() -> None: ...
if sys.version_info >= (3, 14):
def compare(left: AST, right: AST, /, *, compare_attributes: bool = False) -> bool: ...

View file

@ -5,7 +5,31 @@ from re import Pattern
from typing import Any, ClassVar, Literal, TypeVar, overload
from typing_extensions import TypeAlias
if sys.version_info >= (3, 12):
if sys.version_info >= (3, 13):
__all__ = (
"NoSectionError",
"DuplicateOptionError",
"DuplicateSectionError",
"NoOptionError",
"InterpolationError",
"InterpolationDepthError",
"InterpolationMissingOptionError",
"InterpolationSyntaxError",
"ParsingError",
"MissingSectionHeaderError",
"ConfigParser",
"RawConfigParser",
"Interpolation",
"BasicInterpolation",
"ExtendedInterpolation",
"SectionProxy",
"ConverterMapping",
"DEFAULTSECT",
"MAX_INTERPOLATION_DEPTH",
"UNNAMED_SECTION",
"MultilineContinuationError",
)
elif sys.version_info >= (3, 12):
__all__ = (
"NoSectionError",
"DuplicateOptionError",
@ -71,8 +95,9 @@ class Interpolation:
class BasicInterpolation(Interpolation): ...
class ExtendedInterpolation(Interpolation): ...
class LegacyInterpolation(Interpolation):
def before_get(self, parser: _Parser, section: str, option: str, value: str, vars: _Section) -> str: ...
if sys.version_info < (3, 13):
class LegacyInterpolation(Interpolation):
def before_get(self, parser: _Parser, section: str, option: str, value: str, vars: _Section) -> str: ...
class RawConfigParser(_Parser):
_SECT_TMPL: ClassVar[str] # undocumented
@ -86,54 +111,108 @@ class RawConfigParser(_Parser):
BOOLEAN_STATES: ClassVar[Mapping[str, bool]] # undocumented
default_section: str
@overload
def __init__(
self,
defaults: Mapping[str, str | None] | None = None,
dict_type: type[Mapping[str, str]] = ...,
*,
allow_no_value: Literal[True],
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
@overload
def __init__(
self,
defaults: Mapping[str, str | None] | None,
dict_type: type[Mapping[str, str]],
allow_no_value: Literal[True],
*,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
@overload
def __init__(
self,
defaults: _Section | None = None,
dict_type: type[Mapping[str, str]] = ...,
allow_no_value: bool = False,
*,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
if sys.version_info >= (3, 13):
@overload
def __init__(
self,
defaults: Mapping[str, str | None] | None = None,
dict_type: type[Mapping[str, str]] = ...,
*,
allow_no_value: Literal[True],
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
allow_unnamed_section: bool = False,
) -> None: ...
@overload
def __init__(
self,
defaults: Mapping[str, str | None] | None,
dict_type: type[Mapping[str, str]],
allow_no_value: Literal[True],
*,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
allow_unnamed_section: bool = False,
) -> None: ...
@overload
def __init__(
self,
defaults: _Section | None = None,
dict_type: type[Mapping[str, str]] = ...,
allow_no_value: bool = False,
*,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
allow_unnamed_section: bool = False,
) -> None: ...
else:
@overload
def __init__(
self,
defaults: Mapping[str, str | None] | None = None,
dict_type: type[Mapping[str, str]] = ...,
*,
allow_no_value: Literal[True],
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
@overload
def __init__(
self,
defaults: Mapping[str, str | None] | None,
dict_type: type[Mapping[str, str]],
allow_no_value: Literal[True],
*,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
@overload
def __init__(
self,
defaults: _Section | None = None,
dict_type: type[Mapping[str, str]] = ...,
allow_no_value: bool = False,
*,
delimiters: Sequence[str] = ("=", ":"),
comment_prefixes: Sequence[str] = ("#", ";"),
inline_comment_prefixes: Sequence[str] | None = None,
strict: bool = True,
empty_lines_in_values: bool = True,
default_section: str = "DEFAULT",
interpolation: Interpolation | None = ...,
converters: _ConvertersMap = ...,
) -> None: ...
def __len__(self) -> int: ...
def __getitem__(self, key: str) -> SectionProxy: ...
def __setitem__(self, key: str, value: _Section) -> None: ...
@ -300,7 +379,10 @@ class InterpolationSyntaxError(InterpolationError): ...
class ParsingError(Error):
source: str
errors: list[tuple[int, str]]
if sys.version_info >= (3, 12):
if sys.version_info >= (3, 13):
def __init__(self, source: str, *args: object) -> None: ...
def combine(self, others: Iterable[ParsingError]) -> ParsingError: ...
elif sys.version_info >= (3, 12):
def __init__(self, source: str) -> None: ...
else:
def __init__(self, source: str | None = None, filename: str | None = None) -> None: ...
@ -311,3 +393,12 @@ class MissingSectionHeaderError(ParsingError):
lineno: int
line: str
def __init__(self, filename: str, lineno: int, line: str) -> None: ...
if sys.version_info >= (3, 13):
class _UNNAMED_SECTION: ...
UNNAMED_SECTION: _UNNAMED_SECTION
class MultilineContinuationError(ParsingError):
lineno: int
line: str
def __init__(self, filename: str, lineno: int, line: str) -> None: ...

View file

@ -31,10 +31,12 @@ if sys.version_info >= (3, 11):
"nonmember",
"property",
"verify",
"pickle_by_enum_name",
"pickle_by_global_name",
]
if sys.version_info >= (3, 11):
__all__ += ["pickle_by_enum_name", "pickle_by_global_name"]
if sys.version_info >= (3, 13):
__all__ += ["EnumDict"]
_EnumMemberT = TypeVar("_EnumMemberT")
_EnumerationT = TypeVar("_EnumerationT", bound=type[Enum])
@ -74,6 +76,12 @@ class _EnumDict(dict[str, Any]):
def update(self, members: SupportsKeysAndGetItem[str, Any], **more_members: Any) -> None: ...
@overload
def update(self, members: Iterable[tuple[str, Any]], **more_members: Any) -> None: ...
if sys.version_info >= (3, 13):
@property
def member_names(self) -> list[str]: ...
if sys.version_info >= (3, 13):
EnumDict = _EnumDict
# Structurally: Iterable[T], Reversible[T], Container[T] where T is the enum itself
class EnumMeta(type):
@ -259,9 +267,9 @@ if sys.version_info >= (3, 11):
def _generate_next_value_(name: str, start: int, count: int, last_values: list[str]) -> str: ...
class EnumCheck(StrEnum):
CONTINUOUS: str
NAMED_FLAGS: str
UNIQUE: str
CONTINUOUS = "no skipped integer values"
NAMED_FLAGS = "multi-flag aliases may not contain unnamed flags"
UNIQUE = "one name per value"
CONTINUOUS = EnumCheck.CONTINUOUS
NAMED_FLAGS = EnumCheck.NAMED_FLAGS
@ -272,10 +280,10 @@ if sys.version_info >= (3, 11):
def __call__(self, enumeration: _EnumerationT) -> _EnumerationT: ...
class FlagBoundary(StrEnum):
STRICT: str
CONFORM: str
EJECT: str
KEEP: str
STRICT = "strict"
CONFORM = "conform"
EJECT = "eject"
KEEP = "keep"
STRICT = FlagBoundary.STRICT
CONFORM = FlagBoundary.CONFORM

View file

@ -1,10 +1,13 @@
import sys
from _typeshed import StrOrBytesPath
from collections.abc import Iterator
from collections.abc import Iterator, Sequence
from typing import AnyStr
__all__ = ["escape", "glob", "iglob"]
if sys.version_info >= (3, 13):
__all__ += ["translate"]
def glob0(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
def glob1(dirname: AnyStr, pattern: AnyStr) -> list[AnyStr]: ...
@ -40,3 +43,8 @@ else:
def escape(pathname: AnyStr) -> AnyStr: ...
def has_magic(s: str | bytes) -> bool: ... # undocumented
if sys.version_info >= (3, 13):
def translate(
pat: str, *, recursive: bool = False, include_hidden: bool = False, seps: Sequence[str] | None = None
) -> str: ...

View file

@ -572,7 +572,14 @@ fatal = critical
def disable(level: int = 50) -> None: ...
def addLevelName(level: int, levelName: str) -> None: ...
def getLevelName(level: _Level) -> Any: ...
@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
def getLevelName(level: str) -> Any: ...
if sys.version_info >= (3, 11):
def getLevelNamesMapping() -> dict[str, int]: ...

View file

@ -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

View file

@ -78,13 +78,25 @@ class _RmtreeType(Protocol):
avoids_symlink_attacks: bool
if sys.version_info >= (3, 12):
@overload
@deprecated("The `onerror` parameter is deprecated and will be removed in Python 3.14. Use `onexc` instead.")
@deprecated("The `onerror` parameter is deprecated. Use `onexc` instead.")
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool,
onerror: _OnErrorCallback,
*,
onexc: None = None,
dir_fd: int | None = None,
) -> None: ...
@overload
@deprecated("The `onerror` parameter is deprecated. Use `onexc` instead.")
def __call__(
self,
path: StrOrBytesPath,
ignore_errors: bool = False,
onerror: _OnErrorCallback | None = None,
*,
onerror: _OnErrorCallback,
onexc: None = None,
dir_fd: int | None = None,
) -> None: ...
@overload

View file

@ -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: ...

View file

@ -81,7 +81,7 @@ class FunctionType:
__name__: str
__qualname__: str
__annotations__: dict[str, Any]
__kwdefaults__: dict[str, Any]
__kwdefaults__: dict[str, Any] | None
if sys.version_info >= (3, 10):
@property
def __builtins__(self) -> dict[str, Any]: ...
@ -591,6 +591,9 @@ if sys.version_info >= (3, 9):
def __unpacked__(self) -> bool: ...
@property
def __typing_unpacked_tuple_args__(self) -> tuple[Any, ...] | None: ...
if sys.version_info >= (3, 10):
def __or__(self, value: Any, /) -> UnionType: ...
def __ror__(self, value: Any, /) -> UnionType: ...
# GenericAlias delegates attr access to `__origin__`
def __getattr__(self, name: str) -> Any: ...

View file

@ -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: ...