mirror of https://github.com/astral-sh/ruff
[ty] Sync vendored typeshed stubs (#21715)
Co-authored-by: typeshedbot <> Co-authored-by: David Peter <mail@david-peter.de>
This commit is contained in:
parent
d6e472f297
commit
b08f0b2caa
|
|
@ -145,14 +145,14 @@ mod tests {
|
||||||
|
|
||||||
assert_snapshot!(test.goto_type_definition(), @r"
|
assert_snapshot!(test.goto_type_definition(), @r"
|
||||||
info[goto-type-definition]: Type definition
|
info[goto-type-definition]: Type definition
|
||||||
--> stdlib/typing.pyi:770:1
|
--> stdlib/typing.pyi:781:1
|
||||||
|
|
|
|
||||||
768 | def __class_getitem__(cls, args: TypeVar | tuple[TypeVar, ...]) -> _Final: ...
|
779 | def __class_getitem__(cls, args: TypeVar | tuple[TypeVar, ...]) -> _Final: ...
|
||||||
769 |
|
780 |
|
||||||
770 | Generic: type[_Generic]
|
781 | Generic: type[_Generic]
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
771 |
|
782 |
|
||||||
772 | class _ProtocolMeta(ABCMeta):
|
783 | class _ProtocolMeta(ABCMeta):
|
||||||
|
|
|
|
||||||
info: Source
|
info: Source
|
||||||
--> main.py:4:1
|
--> main.py:4:1
|
||||||
|
|
|
||||||
|
|
@ -91,14 +91,14 @@ error[missing-argument]: No argument provided for required parameter `arg` of bo
|
||||||
7 | from typing_extensions import deprecated
|
7 | from typing_extensions import deprecated
|
||||||
|
|
|
|
||||||
info: Parameter declared here
|
info: Parameter declared here
|
||||||
--> stdlib/typing_extensions.pyi:1000:28
|
--> stdlib/typing_extensions.pyi:1001:28
|
||||||
|
|
|
|
||||||
998 | stacklevel: int
|
999 | stacklevel: int
|
||||||
999 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
|
1000 | def __init__(self, message: LiteralString, /, *, category: type[Warning] | None = ..., stacklevel: int = 1) -> None: ...
|
||||||
1000 | def __call__(self, arg: _T, /) -> _T: ...
|
1001 | def __call__(self, arg: _T, /) -> _T: ...
|
||||||
| ^^^^^^^
|
| ^^^^^^^
|
||||||
1001 |
|
1002 |
|
||||||
1002 | @final
|
1003 | @final
|
||||||
|
|
|
|
||||||
info: rule `missing-argument` is enabled by default
|
info: rule `missing-argument` is enabled by default
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
f8cdc0bd526301e873cd952eb0d457bdf2554e57
|
ef2b90c67e5c668b91b3ae121baf00ee5165c30b
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import Unused
|
from _typeshed import Unused
|
||||||
from collections.abc import Callable, Coroutine
|
from collections.abc import Awaitable, Callable, Coroutine
|
||||||
from contextvars import Context
|
from contextvars import Context
|
||||||
from typing import Any, TypeVar, final
|
from typing import Any, TypeVar, final
|
||||||
from typing_extensions import Self
|
from typing_extensions import Self
|
||||||
|
|
@ -50,9 +50,12 @@ if sys.version_info >= (3, 11):
|
||||||
|
|
||||||
def get_loop(self) -> AbstractEventLoop:
|
def get_loop(self) -> AbstractEventLoop:
|
||||||
"""Return embedded event loop."""
|
"""Return embedded event loop."""
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T:
|
def run(self, coro: Awaitable[_T], *, context: Context | None = None) -> _T:
|
||||||
"""Run code in the embedded event loop."""
|
"""Run code in the embedded event loop."""
|
||||||
|
else:
|
||||||
|
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T:
|
||||||
|
"""Run a coroutine inside the embedded event loop."""
|
||||||
|
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
def run(
|
def run(
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ class TransportSocket:
|
||||||
def listen(self, backlog: int = ..., /) -> None: ...
|
def listen(self, backlog: int = ..., /) -> None: ...
|
||||||
@deprecated("Removed in Python 3.11")
|
@deprecated("Removed in Python 3.11")
|
||||||
def makefile(self) -> BinaryIO: ...
|
def makefile(self) -> BinaryIO: ...
|
||||||
@deprecated("Rmoved in Python 3.11")
|
@deprecated("Removed in Python 3.11")
|
||||||
def sendfile(self, file: BinaryIO, offset: int = 0, count: int | None = None) -> int: ...
|
def sendfile(self, file: BinaryIO, offset: int = 0, count: int | None = None) -> int: ...
|
||||||
@deprecated("Removed in Python 3.11")
|
@deprecated("Removed in Python 3.11")
|
||||||
def close(self) -> None: ...
|
def close(self) -> None: ...
|
||||||
|
|
|
||||||
|
|
@ -64,10 +64,12 @@ if sys.version_info >= (3, 12):
|
||||||
|
|
||||||
_LocaleType: TypeAlias = tuple[str | None, str | None]
|
_LocaleType: TypeAlias = tuple[str | None, str | None]
|
||||||
|
|
||||||
class IllegalMonthError(ValueError):
|
class IllegalMonthError(ValueError, IndexError):
|
||||||
|
month: int
|
||||||
def __init__(self, month: int) -> None: ...
|
def __init__(self, month: int) -> None: ...
|
||||||
|
|
||||||
class IllegalWeekdayError(ValueError):
|
class IllegalWeekdayError(ValueError):
|
||||||
|
weekday: int
|
||||||
def __init__(self, weekday: int) -> None: ...
|
def __init__(self, weekday: int) -> None: ...
|
||||||
|
|
||||||
def isleap(year: int) -> bool:
|
def isleap(year: int) -> bool:
|
||||||
|
|
|
||||||
|
|
@ -257,7 +257,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def hosts(self) -> Iterator[_A] | list[_A]:
|
def hosts(self) -> Iterator[_A]:
|
||||||
"""Generate Iterator over usable hosts in a network.
|
"""Generate Iterator over usable hosts in a network.
|
||||||
|
|
||||||
This is like __iter__ except it doesn't return the network
|
This is like __iter__ except it doesn't return the network
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ read_mime_types(file) -- parse one file, return a dictionary or None
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
from _typeshed import StrPath
|
from _typeshed import StrPath
|
||||||
from collections.abc import Sequence
|
from collections.abc import Iterable
|
||||||
from typing import IO
|
from typing import IO
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
|
|
@ -93,8 +93,8 @@ def guess_extension(type: str, strict: bool = True) -> str | None:
|
||||||
but non-standard types.
|
but non-standard types.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def init(files: Sequence[str] | None = None) -> None: ...
|
def init(files: Iterable[StrPath] | None = None) -> None: ...
|
||||||
def read_mime_types(file: str) -> dict[str, str] | None: ...
|
def read_mime_types(file: StrPath) -> dict[str, str] | None: ...
|
||||||
def add_type(type: str, ext: str, strict: bool = True) -> None:
|
def add_type(type: str, ext: str, strict: bool = True) -> None:
|
||||||
"""Add a mapping between a type and an extension.
|
"""Add a mapping between a type and an extension.
|
||||||
|
|
||||||
|
|
@ -116,7 +116,7 @@ if sys.version_info >= (3, 13):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
inited: bool
|
inited: bool
|
||||||
knownfiles: list[str]
|
knownfiles: list[StrPath]
|
||||||
suffix_map: dict[str, str]
|
suffix_map: dict[str, str]
|
||||||
encodings_map: dict[str, str]
|
encodings_map: dict[str, str]
|
||||||
types_map: dict[str, str]
|
types_map: dict[str, str]
|
||||||
|
|
@ -134,7 +134,7 @@ class MimeTypes:
|
||||||
encodings_map: dict[str, str]
|
encodings_map: dict[str, str]
|
||||||
types_map: tuple[dict[str, str], dict[str, str]]
|
types_map: tuple[dict[str, str], dict[str, str]]
|
||||||
types_map_inv: tuple[dict[str, str], dict[str, str]]
|
types_map_inv: tuple[dict[str, str], dict[str, str]]
|
||||||
def __init__(self, filenames: tuple[str, ...] = (), strict: bool = True) -> None: ...
|
def __init__(self, filenames: Iterable[StrPath] = (), strict: bool = True) -> None: ...
|
||||||
def add_type(self, type: str, ext: str, strict: bool = True) -> None:
|
def add_type(self, type: str, ext: str, strict: bool = True) -> None:
|
||||||
"""Add a mapping between a type and an extension.
|
"""Add a mapping between a type and an extension.
|
||||||
|
|
||||||
|
|
@ -196,7 +196,7 @@ class MimeTypes:
|
||||||
but non-standard types.
|
but non-standard types.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def read(self, filename: str, strict: bool = True) -> None:
|
def read(self, filename: StrPath, strict: bool = True) -> None:
|
||||||
"""
|
"""
|
||||||
Read a single mime.types-format file, specified by pathname.
|
Read a single mime.types-format file, specified by pathname.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -216,6 +216,8 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
|
||||||
def count(self, value: _T, /) -> int: ...
|
def count(self, value: _T, /) -> int: ...
|
||||||
def insert(self, index: SupportsIndex, object: _T, /) -> None: ...
|
def insert(self, index: SupportsIndex, object: _T, /) -> None: ...
|
||||||
def remove(self, value: _T, /) -> None: ...
|
def remove(self, value: _T, /) -> None: ...
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
def copy(self) -> list[_T]: ...
|
||||||
# Use BaseListProxy[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison]
|
# Use BaseListProxy[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison]
|
||||||
# to work around invariance
|
# to work around invariance
|
||||||
@overload
|
@overload
|
||||||
|
|
@ -429,8 +431,9 @@ class SyncManager(BaseManager):
|
||||||
def dict(self, iterable: Iterable[list[str]], /) -> DictProxy[str, str]: ...
|
def dict(self, iterable: Iterable[list[str]], /) -> DictProxy[str, str]: ...
|
||||||
@overload
|
@overload
|
||||||
def dict(self, iterable: Iterable[list[bytes]], /) -> DictProxy[bytes, bytes]: ...
|
def dict(self, iterable: Iterable[list[bytes]], /) -> DictProxy[bytes, bytes]: ...
|
||||||
|
# Overloads are copied from builtins.list.__init__
|
||||||
@overload
|
@overload
|
||||||
def list(self, sequence: Sequence[_T], /) -> ListProxy[_T]: ...
|
def list(self, iterable: Iterable[_T], /) -> ListProxy[_T]: ...
|
||||||
@overload
|
@overload
|
||||||
def list(self) -> ListProxy[Any]: ...
|
def list(self) -> ListProxy[Any]: ...
|
||||||
if sys.version_info >= (3, 14):
|
if sys.version_info >= (3, 14):
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import sys
|
||||||
from collections.abc import Callable, Iterable, Mapping
|
from collections.abc import Callable, Iterable, Mapping
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
|
|
@ -33,6 +34,11 @@ class BaseProcess:
|
||||||
"""
|
"""
|
||||||
Start child process
|
Start child process
|
||||||
"""
|
"""
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
def interrupt(self) -> None:
|
||||||
|
"""
|
||||||
|
Terminate process; sends SIGINT signal
|
||||||
|
"""
|
||||||
|
|
||||||
def terminate(self) -> None:
|
def terminate(self) -> None:
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import sys
|
||||||
import threading
|
import threading
|
||||||
from collections.abc import Callable
|
from collections.abc import Callable
|
||||||
from multiprocessing.context import BaseContext
|
from multiprocessing.context import BaseContext
|
||||||
|
|
@ -45,6 +46,8 @@ class SemLock:
|
||||||
# These methods are copied from the wrapped _multiprocessing.SemLock object
|
# These methods are copied from the wrapped _multiprocessing.SemLock object
|
||||||
def acquire(self, block: bool = True, timeout: float | None = None) -> bool: ...
|
def acquire(self, block: bool = True, timeout: float | None = None) -> bool: ...
|
||||||
def release(self) -> None: ...
|
def release(self) -> None: ...
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
def locked(self) -> bool: ...
|
||||||
|
|
||||||
class Lock(SemLock):
|
class Lock(SemLock):
|
||||||
def __init__(self, *, ctx: BaseContext) -> None: ...
|
def __init__(self, *, ctx: BaseContext) -> None: ...
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,7 @@ _AdaptedInputData: TypeAlias = _SqliteData | Any
|
||||||
_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData]
|
_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData]
|
||||||
# Controls the legacy transaction handling mode of sqlite3.
|
# Controls the legacy transaction handling mode of sqlite3.
|
||||||
_IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None
|
_IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None
|
||||||
|
_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, Row], object] | None
|
||||||
|
|
||||||
@type_check_only
|
@type_check_only
|
||||||
class _AnyParamWindowAggregateClass(Protocol):
|
class _AnyParamWindowAggregateClass(Protocol):
|
||||||
|
|
@ -336,7 +337,7 @@ class Connection:
|
||||||
def autocommit(self) -> int: ...
|
def autocommit(self) -> int: ...
|
||||||
@autocommit.setter
|
@autocommit.setter
|
||||||
def autocommit(self, val: int) -> None: ...
|
def autocommit(self, val: int) -> None: ...
|
||||||
row_factory: Any
|
row_factory: _RowFactoryOptions
|
||||||
text_factory: Any
|
text_factory: Any
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -623,7 +624,7 @@ class Cursor:
|
||||||
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | MaybeNone: ...
|
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | MaybeNone: ...
|
||||||
@property
|
@property
|
||||||
def lastrowid(self) -> int | None: ...
|
def lastrowid(self) -> int | None: ...
|
||||||
row_factory: Callable[[Cursor, Row], object] | None
|
row_factory: _RowFactoryOptions
|
||||||
@property
|
@property
|
||||||
def rowcount(self) -> int: ...
|
def rowcount(self) -> int: ...
|
||||||
def __init__(self, cursor: Connection, /) -> None: ...
|
def __init__(self, cursor: Connection, /) -> None: ...
|
||||||
|
|
|
||||||
|
|
@ -606,7 +606,6 @@ elif sys.version_info >= (3, 10):
|
||||||
) -> CompletedProcess[Any]: ...
|
) -> CompletedProcess[Any]: ...
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# 3.9 adds arguments "user", "group", "extra_groups" and "umask"
|
|
||||||
@overload
|
@overload
|
||||||
def run(
|
def run(
|
||||||
args: _CMD,
|
args: _CMD,
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ from builtins import object as _object
|
||||||
from collections.abc import AsyncGenerator, Callable, Sequence
|
from collections.abc import AsyncGenerator, Callable, Sequence
|
||||||
from io import TextIOWrapper
|
from io import TextIOWrapper
|
||||||
from types import FrameType, ModuleType, TracebackType
|
from types import FrameType, ModuleType, TracebackType
|
||||||
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, type_check_only
|
from typing import Any, Final, Literal, NoReturn, Protocol, TextIO, TypeVar, final, overload, type_check_only
|
||||||
from typing_extensions import LiteralString, TypeAlias, deprecated
|
from typing_extensions import LiteralString, TypeAlias, deprecated
|
||||||
|
|
||||||
_T = TypeVar("_T")
|
_T = TypeVar("_T")
|
||||||
|
|
@ -648,7 +648,7 @@ if sys.platform == "android": # noqa: Y008
|
||||||
def getallocatedblocks() -> int:
|
def getallocatedblocks() -> int:
|
||||||
"""Return the number of memory blocks currently allocated."""
|
"""Return the number of memory blocks currently allocated."""
|
||||||
|
|
||||||
def getdefaultencoding() -> str:
|
def getdefaultencoding() -> Literal["utf-8"]:
|
||||||
"""Return the current default encoding used by the Unicode implementation."""
|
"""Return the current default encoding used by the Unicode implementation."""
|
||||||
|
|
||||||
if sys.platform != "win32":
|
if sys.platform != "win32":
|
||||||
|
|
@ -658,10 +658,10 @@ if sys.platform != "win32":
|
||||||
The flag constants are defined in the os module.
|
The flag constants are defined in the os module.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def getfilesystemencoding() -> str:
|
def getfilesystemencoding() -> LiteralString:
|
||||||
"""Return the encoding used to convert Unicode filenames to OS filenames."""
|
"""Return the encoding used to convert Unicode filenames to OS filenames."""
|
||||||
|
|
||||||
def getfilesystemencodeerrors() -> str:
|
def getfilesystemencodeerrors() -> LiteralString:
|
||||||
"""Return the error mode used Unicode to OS filename conversion."""
|
"""Return the error mode used Unicode to OS filename conversion."""
|
||||||
|
|
||||||
def getrefcount(object: Any, /) -> int:
|
def getrefcount(object: Any, /) -> int:
|
||||||
|
|
@ -755,7 +755,8 @@ if sys.platform == "win32":
|
||||||
intended for identifying the OS rather than feature detection.
|
intended for identifying the OS rather than feature detection.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def intern(string: str, /) -> str:
|
@overload
|
||||||
|
def intern(string: LiteralString, /) -> LiteralString:
|
||||||
"""``Intern'' the given string.
|
"""``Intern'' the given string.
|
||||||
|
|
||||||
This enters the string in the (global) table of interned strings whose
|
This enters the string in the (global) table of interned strings whose
|
||||||
|
|
@ -763,6 +764,9 @@ def intern(string: str, /) -> str:
|
||||||
the previously interned string object with the same value.
|
the previously interned string object with the same value.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@overload
|
||||||
|
def intern(string: str, /) -> str: ... # type: ignore[misc]
|
||||||
|
|
||||||
__interactivehook__: Callable[[], object]
|
__interactivehook__: Callable[[], object]
|
||||||
|
|
||||||
if sys.version_info >= (3, 13):
|
if sys.version_info >= (3, 13):
|
||||||
|
|
|
||||||
|
|
@ -447,6 +447,9 @@ class Condition:
|
||||||
) -> None: ...
|
) -> None: ...
|
||||||
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
|
||||||
def release(self) -> None: ...
|
def release(self) -> None: ...
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
def locked(self) -> bool: ...
|
||||||
|
|
||||||
def wait(self, timeout: float | None = None) -> bool:
|
def wait(self, timeout: float | None = None) -> bool:
|
||||||
"""Wait until notified or until a timeout occurs.
|
"""Wait until notified or until a timeout occurs.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,12 @@
|
||||||
from typing import Final
|
from typing import Final
|
||||||
|
|
||||||
# These are not actually bools. See #4669
|
# These are not actually bools. See #4669
|
||||||
NO: Final[bool]
|
YES: Final = True
|
||||||
YES: Final[bool]
|
NO: Final = False
|
||||||
TRUE: Final[bool]
|
TRUE: Final = True
|
||||||
FALSE: Final[bool]
|
FALSE: Final = False
|
||||||
ON: Final[bool]
|
ON: Final = True
|
||||||
OFF: Final[bool]
|
OFF: Final = False
|
||||||
N: Final = "n"
|
N: Final = "n"
|
||||||
S: Final = "s"
|
S: Final = "s"
|
||||||
W: Final = "w"
|
W: Final = "w"
|
||||||
|
|
|
||||||
|
|
@ -644,6 +644,7 @@ if sys.version_info >= (3, 10):
|
||||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||||
__supertype__: type | NewType
|
__supertype__: type | NewType
|
||||||
|
__name__: str
|
||||||
|
|
||||||
else:
|
else:
|
||||||
def NewType(name: str, tp: Any) -> Any:
|
def NewType(name: str, tp: Any) -> Any:
|
||||||
|
|
@ -722,6 +723,16 @@ def no_type_check(arg: _F) -> _F:
|
||||||
This mutates the function(s) or class(es) in place.
|
This mutates the function(s) or class(es) in place.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
if sys.version_info >= (3, 13):
|
||||||
|
@deprecated("Deprecated since Python 3.13; removed in Python 3.15.")
|
||||||
|
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]:
|
||||||
|
"""Decorator to give another decorator the @no_type_check effect.
|
||||||
|
|
||||||
|
This wraps the decorator with something that wraps the decorated
|
||||||
|
function in @no_type_check.
|
||||||
|
"""
|
||||||
|
|
||||||
|
else:
|
||||||
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]:
|
def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]:
|
||||||
"""Decorator to give another decorator the @no_type_check effect.
|
"""Decorator to give another decorator the @no_type_check effect.
|
||||||
|
|
||||||
|
|
@ -1784,9 +1795,7 @@ class NamedTuple(tuple[Any, ...]):
|
||||||
@overload
|
@overload
|
||||||
def __init__(self, typename: str, fields: Iterable[tuple[str, Any]], /) -> None: ...
|
def __init__(self, typename: str, fields: Iterable[tuple[str, Any]], /) -> None: ...
|
||||||
@overload
|
@overload
|
||||||
@typing_extensions.deprecated(
|
@deprecated("Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15")
|
||||||
"Creating a typing.NamedTuple using keyword arguments is deprecated and support will be removed in Python 3.15"
|
|
||||||
)
|
|
||||||
def __init__(self, typename: str, fields: None = None, /, **kwargs: Any) -> None: ...
|
def __init__(self, typename: str, fields: None = None, /, **kwargs: Any) -> None: ...
|
||||||
@classmethod
|
@classmethod
|
||||||
def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...
|
def _make(cls, iterable: Iterable[Any]) -> typing_extensions.Self: ...
|
||||||
|
|
|
||||||
|
|
@ -702,6 +702,7 @@ else:
|
||||||
def __init__(self, name: str, tp: AnnotationForm) -> None: ...
|
def __init__(self, name: str, tp: AnnotationForm) -> None: ...
|
||||||
def __call__(self, obj: _T, /) -> _T: ...
|
def __call__(self, obj: _T, /) -> _T: ...
|
||||||
__supertype__: type | NewType
|
__supertype__: type | NewType
|
||||||
|
__name__: str
|
||||||
if sys.version_info >= (3, 10):
|
if sys.version_info >= (3, 10):
|
||||||
def __or__(self, other: Any) -> _SpecialForm: ...
|
def __or__(self, other: Any) -> _SpecialForm: ...
|
||||||
def __ror__(self, other: Any) -> _SpecialForm: ...
|
def __ror__(self, other: Any) -> _SpecialForm: ...
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,7 @@ class NonCallableMock(Base, Any):
|
||||||
call_count: int
|
call_count: int
|
||||||
call_args: _Call | MaybeNone
|
call_args: _Call | MaybeNone
|
||||||
call_args_list: _CallList
|
call_args_list: _CallList
|
||||||
|
method_calls: _CallList
|
||||||
mock_calls: _CallList
|
mock_calls: _CallList
|
||||||
def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ...
|
def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ...
|
||||||
def _call_matcher(self, _call: tuple[_Call, ...]) -> _Call:
|
def _call_matcher(self, _call: tuple[_Call, ...]) -> _Call:
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,14 @@ if sys.version_info < (3, 14):
|
||||||
__all__ += ["URLopener", "FancyURLopener"]
|
__all__ += ["URLopener", "FancyURLopener"]
|
||||||
|
|
||||||
_T = TypeVar("_T")
|
_T = TypeVar("_T")
|
||||||
|
|
||||||
|
# The actual type is `addinfourl | HTTPResponse`, but users would need to use `typing.cast` or `isinstance` to narrow the type,
|
||||||
|
# so we use `Any` instead.
|
||||||
|
# See
|
||||||
|
# - https://github.com/python/typeshed/pull/15042
|
||||||
|
# - https://github.com/python/typing/issues/566
|
||||||
_UrlopenRet: TypeAlias = Any
|
_UrlopenRet: TypeAlias = Any
|
||||||
|
|
||||||
_DataType: TypeAlias = ReadableBuffer | SupportsRead[bytes] | Iterable[bytes] | None
|
_DataType: TypeAlias = ReadableBuffer | SupportsRead[bytes] | Iterable[bytes] | None
|
||||||
|
|
||||||
if sys.version_info >= (3, 13):
|
if sys.version_info >= (3, 13):
|
||||||
|
|
|
||||||
|
|
@ -260,6 +260,14 @@ class ElementTree(Generic[_Root]):
|
||||||
def getroot(self) -> _Root:
|
def getroot(self) -> _Root:
|
||||||
"""Return root element of this tree."""
|
"""Return root element of this tree."""
|
||||||
|
|
||||||
|
def _setroot(self, element: Element[Any]) -> None:
|
||||||
|
"""Replace root element of this tree.
|
||||||
|
|
||||||
|
This will discard the current contents of the tree and replace it
|
||||||
|
with the given element. Use with care!
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
def parse(self, source: _FileRead, parser: XMLParser | None = None) -> Element:
|
def parse(self, source: _FileRead, parser: XMLParser | None = None) -> Element:
|
||||||
"""Load external XML document into element tree.
|
"""Load external XML document into element tree.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -483,6 +483,15 @@ class ZipInfo:
|
||||||
decide based upon the file_size and compress_size, if known,
|
decide based upon the file_size and compress_size, if known,
|
||||||
False otherwise.
|
False otherwise.
|
||||||
"""
|
"""
|
||||||
|
if sys.version_info >= (3, 14):
|
||||||
|
def _for_archive(self, archive: ZipFile) -> Self:
|
||||||
|
"""Resolve suitable defaults from the archive.
|
||||||
|
|
||||||
|
Resolve the date_time, compression attributes, and external attributes
|
||||||
|
to suitable defaults as used by :method:`ZipFile.writestr`.
|
||||||
|
|
||||||
|
Return self.
|
||||||
|
"""
|
||||||
|
|
||||||
if sys.version_info >= (3, 12):
|
if sys.version_info >= (3, 12):
|
||||||
from zipfile._path import CompleteDirs as CompleteDirs, Path as Path
|
from zipfile._path import CompleteDirs as CompleteDirs, Path as Path
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue