mirror of https://github.com/astral-sh/ruff
Reduce repro
This commit is contained in:
parent
a9d3e2e253
commit
90d16987b7
|
|
@ -3237,7 +3237,6 @@ checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f"
|
|||
[[package]]
|
||||
name = "salsa"
|
||||
version = "0.21.1"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=2c869364a9592d06fdf45c422e1e4a7265a8fe8a#2c869364a9592d06fdf45c422e1e4a7265a8fe8a"
|
||||
dependencies = [
|
||||
"boxcar",
|
||||
"compact_str",
|
||||
|
|
@ -3260,12 +3259,10 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "salsa-macro-rules"
|
||||
version = "0.21.1"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=2c869364a9592d06fdf45c422e1e4a7265a8fe8a#2c869364a9592d06fdf45c422e1e4a7265a8fe8a"
|
||||
|
||||
[[package]]
|
||||
name = "salsa-macros"
|
||||
version = "0.21.1"
|
||||
source = "git+https://github.com/salsa-rs/salsa.git?rev=2c869364a9592d06fdf45c422e1e4a7265a8fe8a#2c869364a9592d06fdf45c422e1e4a7265a8fe8a"
|
||||
dependencies = [
|
||||
"heck",
|
||||
"proc-macro2",
|
||||
|
|
|
|||
|
|
@ -185,6 +185,9 @@ zip = { version = "0.6.6", default-features = false }
|
|||
ignored = ["getrandom"]
|
||||
|
||||
|
||||
[patch."https://github.com/salsa-rs/salsa.git"]
|
||||
salsa = { path = "../salsa" }
|
||||
|
||||
[workspace.lints.rust]
|
||||
unsafe_code = "warn"
|
||||
unreachable_pub = "warn"
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ impl VisibilityConstraints {
|
|||
if all_names.contains(symbol_name) {
|
||||
Some(RequiresExplicitReExport::No)
|
||||
} else {
|
||||
tracing::debug!(
|
||||
tracing::trace!(
|
||||
"Symbol `{}` (via star import) not found in `__all__` of `{}`",
|
||||
symbol_name,
|
||||
referenced_file.path(db)
|
||||
|
|
|
|||
|
|
@ -1,34 +0,0 @@
|
|||
# Utility types for typeshed
|
||||
|
||||
This package and its submodules contains various common types used by
|
||||
typeshed. It can also be used by packages outside typeshed, but beware
|
||||
the API stability guarantees below.
|
||||
|
||||
## Usage
|
||||
|
||||
The `_typeshed` package and its types do not exist at runtime, but can be
|
||||
used freely in stubs (`.pyi`) files. To import the types from this package in
|
||||
implementation (`.py`) files, use the following construct:
|
||||
|
||||
```python
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from _typeshed import ...
|
||||
```
|
||||
|
||||
Types can then be used in annotations by either quoting them or
|
||||
using:
|
||||
|
||||
```python
|
||||
from __future__ import annotations
|
||||
```
|
||||
|
||||
## API Stability
|
||||
|
||||
You can use this package and its submodules outside of typeshed, but we
|
||||
guarantee only limited API stability. Items marked as "stable" will not be
|
||||
removed or changed in an incompatible way for at least one year.
|
||||
Before making such a change, the "stable" moniker will be removed
|
||||
and we will mark the type in question as deprecated. No guarantees
|
||||
are made about unmarked types.
|
||||
|
|
@ -1,366 +0,0 @@
|
|||
# Utility types for typeshed
|
||||
#
|
||||
# See the README.md file in this directory for more information.
|
||||
|
||||
import sys
|
||||
from collections.abc import Awaitable, Callable, Iterable, Sequence, Set as AbstractSet, Sized
|
||||
from dataclasses import Field
|
||||
from os import PathLike
|
||||
from types import FrameType, TracebackType
|
||||
from typing import (
|
||||
Any,
|
||||
AnyStr,
|
||||
ClassVar,
|
||||
Final,
|
||||
Generic,
|
||||
Literal,
|
||||
Protocol,
|
||||
SupportsFloat,
|
||||
SupportsIndex,
|
||||
SupportsInt,
|
||||
TypeVar,
|
||||
final,
|
||||
overload,
|
||||
)
|
||||
from typing_extensions import Buffer, LiteralString, Self as _Self, TypeAlias
|
||||
|
||||
_KT = TypeVar("_KT")
|
||||
_KT_co = TypeVar("_KT_co", covariant=True)
|
||||
_KT_contra = TypeVar("_KT_contra", contravariant=True)
|
||||
_VT = TypeVar("_VT")
|
||||
_VT_co = TypeVar("_VT_co", covariant=True)
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_T_contra = TypeVar("_T_contra", contravariant=True)
|
||||
|
||||
# Alternative to `typing_extensions.Self`, exclusively for use with `__new__`
|
||||
# in metaclasses:
|
||||
# def __new__(cls: type[Self], ...) -> Self: ...
|
||||
# In other cases, use `typing_extensions.Self`.
|
||||
Self = TypeVar("Self") # noqa: Y001
|
||||
|
||||
# covariant version of typing.AnyStr, useful for protocols
|
||||
AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True) # noqa: Y001
|
||||
|
||||
# For partially known annotations. Usually, fields where type annotations
|
||||
# haven't been added are left unannotated, but in some situations this
|
||||
# isn't possible or a type is already partially known. In cases like these,
|
||||
# use Incomplete instead of Any as a marker. For example, use
|
||||
# "Incomplete | None" instead of "Any | None".
|
||||
Incomplete: TypeAlias = Any # stable
|
||||
|
||||
# To describe a function parameter that is unused and will work with anything.
|
||||
Unused: TypeAlias = object # stable
|
||||
|
||||
# Marker for return types that include None, but where forcing the user to
|
||||
# check for None can be detrimental. Sometimes called "the Any trick". See
|
||||
# CONTRIBUTING.md for more information.
|
||||
MaybeNone: TypeAlias = Any # stable
|
||||
|
||||
# Used to mark arguments that default to a sentinel value. This prevents
|
||||
# stubtest from complaining about the default value not matching.
|
||||
#
|
||||
# def foo(x: int | None = sentinel) -> None: ...
|
||||
#
|
||||
# In cases where the sentinel object is exported and can be used by user code,
|
||||
# a construct like this is better:
|
||||
#
|
||||
# _SentinelType = NewType("_SentinelType", object)
|
||||
# sentinel: _SentinelType
|
||||
# def foo(x: int | None | _SentinelType = ...) -> None: ...
|
||||
sentinel: Any
|
||||
|
||||
# stable
|
||||
class IdentityFunction(Protocol):
|
||||
def __call__(self, x: _T, /) -> _T: ...
|
||||
|
||||
# stable
|
||||
class SupportsNext(Protocol[_T_co]):
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
# stable
|
||||
class SupportsAnext(Protocol[_T_co]):
|
||||
def __anext__(self) -> Awaitable[_T_co]: ...
|
||||
|
||||
# Comparison protocols
|
||||
|
||||
class SupportsDunderLT(Protocol[_T_contra]):
|
||||
def __lt__(self, other: _T_contra, /) -> bool: ...
|
||||
|
||||
class SupportsDunderGT(Protocol[_T_contra]):
|
||||
def __gt__(self, other: _T_contra, /) -> bool: ...
|
||||
|
||||
class SupportsDunderLE(Protocol[_T_contra]):
|
||||
def __le__(self, other: _T_contra, /) -> bool: ...
|
||||
|
||||
class SupportsDunderGE(Protocol[_T_contra]):
|
||||
def __ge__(self, other: _T_contra, /) -> bool: ...
|
||||
|
||||
class SupportsAllComparisons(
|
||||
SupportsDunderLT[Any], SupportsDunderGT[Any], SupportsDunderLE[Any], SupportsDunderGE[Any], Protocol
|
||||
): ...
|
||||
|
||||
SupportsRichComparison: TypeAlias = SupportsDunderLT[Any] | SupportsDunderGT[Any]
|
||||
SupportsRichComparisonT = TypeVar("SupportsRichComparisonT", bound=SupportsRichComparison) # noqa: Y001
|
||||
|
||||
# Dunder protocols
|
||||
|
||||
class SupportsAdd(Protocol[_T_contra, _T_co]):
|
||||
def __add__(self, x: _T_contra, /) -> _T_co: ...
|
||||
|
||||
class SupportsRAdd(Protocol[_T_contra, _T_co]):
|
||||
def __radd__(self, x: _T_contra, /) -> _T_co: ...
|
||||
|
||||
class SupportsSub(Protocol[_T_contra, _T_co]):
|
||||
def __sub__(self, x: _T_contra, /) -> _T_co: ...
|
||||
|
||||
class SupportsRSub(Protocol[_T_contra, _T_co]):
|
||||
def __rsub__(self, x: _T_contra, /) -> _T_co: ...
|
||||
|
||||
class SupportsMul(Protocol[_T_contra, _T_co]):
|
||||
def __mul__(self, x: _T_contra, /) -> _T_co: ...
|
||||
|
||||
class SupportsRMul(Protocol[_T_contra, _T_co]):
|
||||
def __rmul__(self, x: _T_contra, /) -> _T_co: ...
|
||||
|
||||
class SupportsDivMod(Protocol[_T_contra, _T_co]):
|
||||
def __divmod__(self, other: _T_contra, /) -> _T_co: ...
|
||||
|
||||
class SupportsRDivMod(Protocol[_T_contra, _T_co]):
|
||||
def __rdivmod__(self, other: _T_contra, /) -> _T_co: ...
|
||||
|
||||
# This protocol is generic over the iterator type, while Iterable is
|
||||
# generic over the type that is iterated over.
|
||||
class SupportsIter(Protocol[_T_co]):
|
||||
def __iter__(self) -> _T_co: ...
|
||||
|
||||
# This protocol is generic over the iterator type, while AsyncIterable is
|
||||
# generic over the type that is iterated over.
|
||||
class SupportsAiter(Protocol[_T_co]):
|
||||
def __aiter__(self) -> _T_co: ...
|
||||
|
||||
class SupportsLenAndGetItem(Protocol[_T_co]):
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, k: int, /) -> _T_co: ...
|
||||
|
||||
class SupportsTrunc(Protocol):
|
||||
def __trunc__(self) -> int: ...
|
||||
|
||||
# Mapping-like protocols
|
||||
|
||||
# stable
|
||||
class SupportsItems(Protocol[_KT_co, _VT_co]):
|
||||
def items(self) -> AbstractSet[tuple[_KT_co, _VT_co]]: ...
|
||||
|
||||
# stable
|
||||
class SupportsKeysAndGetItem(Protocol[_KT, _VT_co]):
|
||||
def keys(self) -> Iterable[_KT]: ...
|
||||
def __getitem__(self, key: _KT, /) -> _VT_co: ...
|
||||
|
||||
# stable
|
||||
class SupportsGetItem(Protocol[_KT_contra, _VT_co]):
|
||||
def __getitem__(self, key: _KT_contra, /) -> _VT_co: ...
|
||||
|
||||
# stable
|
||||
class SupportsContainsAndGetItem(Protocol[_KT_contra, _VT_co]):
|
||||
def __contains__(self, x: Any, /) -> bool: ...
|
||||
def __getitem__(self, key: _KT_contra, /) -> _VT_co: ...
|
||||
|
||||
# stable
|
||||
class SupportsItemAccess(Protocol[_KT_contra, _VT]):
|
||||
def __contains__(self, x: Any, /) -> bool: ...
|
||||
def __getitem__(self, key: _KT_contra, /) -> _VT: ...
|
||||
def __setitem__(self, key: _KT_contra, value: _VT, /) -> None: ...
|
||||
def __delitem__(self, key: _KT_contra, /) -> None: ...
|
||||
|
||||
StrPath: TypeAlias = str | PathLike[str] # stable
|
||||
BytesPath: TypeAlias = bytes | PathLike[bytes] # stable
|
||||
GenericPath: TypeAlias = AnyStr | PathLike[AnyStr]
|
||||
StrOrBytesPath: TypeAlias = str | bytes | PathLike[str] | PathLike[bytes] # stable
|
||||
|
||||
OpenTextModeUpdating: TypeAlias = Literal[
|
||||
"r+",
|
||||
"+r",
|
||||
"rt+",
|
||||
"r+t",
|
||||
"+rt",
|
||||
"tr+",
|
||||
"t+r",
|
||||
"+tr",
|
||||
"w+",
|
||||
"+w",
|
||||
"wt+",
|
||||
"w+t",
|
||||
"+wt",
|
||||
"tw+",
|
||||
"t+w",
|
||||
"+tw",
|
||||
"a+",
|
||||
"+a",
|
||||
"at+",
|
||||
"a+t",
|
||||
"+at",
|
||||
"ta+",
|
||||
"t+a",
|
||||
"+ta",
|
||||
"x+",
|
||||
"+x",
|
||||
"xt+",
|
||||
"x+t",
|
||||
"+xt",
|
||||
"tx+",
|
||||
"t+x",
|
||||
"+tx",
|
||||
]
|
||||
OpenTextModeWriting: TypeAlias = Literal["w", "wt", "tw", "a", "at", "ta", "x", "xt", "tx"]
|
||||
OpenTextModeReading: TypeAlias = Literal["r", "rt", "tr", "U", "rU", "Ur", "rtU", "rUt", "Urt", "trU", "tUr", "Utr"]
|
||||
OpenTextMode: TypeAlias = OpenTextModeUpdating | OpenTextModeWriting | OpenTextModeReading
|
||||
OpenBinaryModeUpdating: TypeAlias = Literal[
|
||||
"rb+",
|
||||
"r+b",
|
||||
"+rb",
|
||||
"br+",
|
||||
"b+r",
|
||||
"+br",
|
||||
"wb+",
|
||||
"w+b",
|
||||
"+wb",
|
||||
"bw+",
|
||||
"b+w",
|
||||
"+bw",
|
||||
"ab+",
|
||||
"a+b",
|
||||
"+ab",
|
||||
"ba+",
|
||||
"b+a",
|
||||
"+ba",
|
||||
"xb+",
|
||||
"x+b",
|
||||
"+xb",
|
||||
"bx+",
|
||||
"b+x",
|
||||
"+bx",
|
||||
]
|
||||
OpenBinaryModeWriting: TypeAlias = Literal["wb", "bw", "ab", "ba", "xb", "bx"]
|
||||
OpenBinaryModeReading: TypeAlias = Literal["rb", "br", "rbU", "rUb", "Urb", "brU", "bUr", "Ubr"]
|
||||
OpenBinaryMode: TypeAlias = OpenBinaryModeUpdating | OpenBinaryModeReading | OpenBinaryModeWriting
|
||||
|
||||
# stable
|
||||
class HasFileno(Protocol):
|
||||
def fileno(self) -> int: ...
|
||||
|
||||
FileDescriptor: TypeAlias = int # stable
|
||||
FileDescriptorLike: TypeAlias = int | HasFileno # stable
|
||||
FileDescriptorOrPath: TypeAlias = int | StrOrBytesPath
|
||||
|
||||
# stable
|
||||
class SupportsRead(Protocol[_T_co]):
|
||||
def read(self, length: int = ..., /) -> _T_co: ...
|
||||
|
||||
# stable
|
||||
class SupportsReadline(Protocol[_T_co]):
|
||||
def readline(self, length: int = ..., /) -> _T_co: ...
|
||||
|
||||
# stable
|
||||
class SupportsNoArgReadline(Protocol[_T_co]):
|
||||
def readline(self) -> _T_co: ...
|
||||
|
||||
# stable
|
||||
class SupportsWrite(Protocol[_T_contra]):
|
||||
def write(self, s: _T_contra, /) -> object: ...
|
||||
|
||||
# stable
|
||||
class SupportsFlush(Protocol):
|
||||
def flush(self) -> object: ...
|
||||
|
||||
# Unfortunately PEP 688 does not allow us to distinguish read-only
|
||||
# from writable buffers. We use these aliases for readability for now.
|
||||
# Perhaps a future extension of the buffer protocol will allow us to
|
||||
# distinguish these cases in the type system.
|
||||
ReadOnlyBuffer: TypeAlias = Buffer # stable
|
||||
# Anything that implements the read-write buffer interface.
|
||||
WriteableBuffer: TypeAlias = Buffer
|
||||
# Same as WriteableBuffer, but also includes read-only buffer types (like bytes).
|
||||
ReadableBuffer: TypeAlias = Buffer # stable
|
||||
|
||||
class SliceableBuffer(Buffer, Protocol):
|
||||
def __getitem__(self, slice: slice, /) -> Sequence[int]: ...
|
||||
|
||||
class IndexableBuffer(Buffer, Protocol):
|
||||
def __getitem__(self, i: int, /) -> int: ...
|
||||
|
||||
class SupportsGetItemBuffer(SliceableBuffer, IndexableBuffer, Protocol):
|
||||
def __contains__(self, x: Any, /) -> bool: ...
|
||||
@overload
|
||||
def __getitem__(self, slice: slice, /) -> Sequence[int]: ...
|
||||
@overload
|
||||
def __getitem__(self, i: int, /) -> int: ...
|
||||
|
||||
class SizedBuffer(Sized, Buffer, Protocol): ...
|
||||
|
||||
# for compatibility with third-party stubs that may use this
|
||||
_BufferWithLen: TypeAlias = SizedBuffer # not stable # noqa: Y047
|
||||
|
||||
ExcInfo: TypeAlias = tuple[type[BaseException], BaseException, TracebackType]
|
||||
OptExcInfo: TypeAlias = ExcInfo | tuple[None, None, None]
|
||||
|
||||
# stable
|
||||
if sys.version_info >= (3, 10):
|
||||
from types import NoneType as NoneType
|
||||
else:
|
||||
# Used by type checkers for checks involving None (does not exist at runtime)
|
||||
@final
|
||||
class NoneType:
|
||||
def __bool__(self) -> Literal[False]: ...
|
||||
|
||||
# This is an internal CPython type that is like, but subtly different from, a NamedTuple
|
||||
# Subclasses of this type are found in multiple modules.
|
||||
# In typeshed, `structseq` is only ever used as a mixin in combination with a fixed-length `Tuple`
|
||||
# See discussion at #6546 & #6560
|
||||
# `structseq` classes are unsubclassable, so are all decorated with `@final`.
|
||||
class structseq(Generic[_T_co]):
|
||||
n_fields: Final[int]
|
||||
n_unnamed_fields: Final[int]
|
||||
n_sequence_fields: Final[int]
|
||||
# The first parameter will generally only take an iterable of a specific length.
|
||||
# E.g. `os.uname_result` takes any iterable of length exactly 5.
|
||||
#
|
||||
# The second parameter will accept a dict of any kind without raising an exception,
|
||||
# but only has any meaning if you supply it a dict where the keys are strings.
|
||||
# https://github.com/python/typeshed/pull/6560#discussion_r767149830
|
||||
def __new__(cls, sequence: Iterable[_T_co], dict: dict[str, Any] = ...) -> _Self: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __replace__(self, **kwargs: Any) -> _Self: ...
|
||||
|
||||
# Superset of typing.AnyStr that also includes LiteralString
|
||||
AnyOrLiteralStr = TypeVar("AnyOrLiteralStr", str, bytes, LiteralString) # noqa: Y001
|
||||
|
||||
# Represents when str or LiteralStr is acceptable. Useful for string processing
|
||||
# APIs where literalness of return value depends on literalness of inputs
|
||||
StrOrLiteralStr = TypeVar("StrOrLiteralStr", LiteralString, str) # noqa: Y001
|
||||
|
||||
# Objects suitable to be passed to sys.setprofile, threading.setprofile, and similar
|
||||
ProfileFunction: TypeAlias = Callable[[FrameType, str, Any], object]
|
||||
|
||||
# Objects suitable to be passed to sys.settrace, threading.settrace, and similar
|
||||
TraceFunction: TypeAlias = Callable[[FrameType, str, Any], TraceFunction | None]
|
||||
|
||||
# experimental
|
||||
# Might not work as expected for pyright, see
|
||||
# https://github.com/python/typeshed/pull/9362
|
||||
# https://github.com/microsoft/pyright/issues/4339
|
||||
class DataclassInstance(Protocol):
|
||||
__dataclass_fields__: ClassVar[dict[str, Field[Any]]]
|
||||
|
||||
# Anything that can be passed to the int/float constructors
|
||||
ConvertibleToInt: TypeAlias = str | ReadableBuffer | SupportsInt | SupportsIndex | SupportsTrunc
|
||||
ConvertibleToFloat: TypeAlias = str | ReadableBuffer | SupportsFloat | SupportsIndex
|
||||
|
||||
# A few classes updated from Foo(str, Enum) to Foo(StrEnum). This is a convenience so these
|
||||
# can be accurate on all python versions without getting too wordy
|
||||
if sys.version_info >= (3, 11):
|
||||
from enum import StrEnum as StrEnum
|
||||
else:
|
||||
from enum import Enum
|
||||
|
||||
class StrEnum(str, Enum): ...
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
# PEP 249 Database API 2.0 Types
|
||||
# https://www.python.org/dev/peps/pep-0249/
|
||||
|
||||
from collections.abc import Mapping, Sequence
|
||||
from typing import Any, Protocol
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
DBAPITypeCode: TypeAlias = Any | None
|
||||
# Strictly speaking, this should be a Sequence, but the type system does
|
||||
# not support fixed-length sequences.
|
||||
DBAPIColumnDescription: TypeAlias = tuple[str, DBAPITypeCode, int | None, int | None, int | None, int | None, bool | None]
|
||||
|
||||
class DBAPIConnection(Protocol):
|
||||
def close(self) -> object: ...
|
||||
def commit(self) -> object: ...
|
||||
# optional:
|
||||
# def rollback(self) -> Any: ...
|
||||
def cursor(self) -> DBAPICursor: ...
|
||||
|
||||
class DBAPICursor(Protocol):
|
||||
@property
|
||||
def description(self) -> Sequence[DBAPIColumnDescription] | None: ...
|
||||
@property
|
||||
def rowcount(self) -> int: ...
|
||||
# optional:
|
||||
# def callproc(self, procname: str, parameters: Sequence[Any] = ..., /) -> Sequence[Any]: ...
|
||||
def close(self) -> object: ...
|
||||
def execute(self, operation: str, parameters: Sequence[Any] | Mapping[str, Any] = ..., /) -> object: ...
|
||||
def executemany(self, operation: str, seq_of_parameters: Sequence[Sequence[Any]], /) -> object: ...
|
||||
def fetchone(self) -> Sequence[Any] | None: ...
|
||||
def fetchmany(self, size: int = ..., /) -> Sequence[Sequence[Any]]: ...
|
||||
def fetchall(self) -> Sequence[Sequence[Any]]: ...
|
||||
# optional:
|
||||
# def nextset(self) -> None | Literal[True]: ...
|
||||
arraysize: int
|
||||
def setinputsizes(self, sizes: Sequence[DBAPITypeCode | int | None], /) -> object: ...
|
||||
def setoutputsize(self, size: int, column: int = ..., /) -> object: ...
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
# Implicit protocols used in importlib.
|
||||
# We intentionally omit deprecated and optional methods.
|
||||
|
||||
from collections.abc import Sequence
|
||||
from importlib.machinery import ModuleSpec
|
||||
from types import ModuleType
|
||||
from typing import Protocol
|
||||
|
||||
__all__ = ["LoaderProtocol", "MetaPathFinderProtocol", "PathEntryFinderProtocol"]
|
||||
|
||||
class LoaderProtocol(Protocol):
|
||||
def load_module(self, fullname: str, /) -> ModuleType: ...
|
||||
|
||||
class MetaPathFinderProtocol(Protocol):
|
||||
def find_spec(self, fullname: str, path: Sequence[str] | None, target: ModuleType | None = ..., /) -> ModuleSpec | None: ...
|
||||
|
||||
class PathEntryFinderProtocol(Protocol):
|
||||
def find_spec(self, fullname: str, target: ModuleType | None = ..., /) -> ModuleSpec | None: ...
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
# Types to support PEP 3333 (WSGI)
|
||||
#
|
||||
# Obsolete since Python 3.11: Use wsgiref.types instead.
|
||||
#
|
||||
# See the README.md file in this directory for more information.
|
||||
|
||||
import sys
|
||||
from _typeshed import OptExcInfo
|
||||
from collections.abc import Callable, Iterable, Iterator
|
||||
from typing import Any, Protocol
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
class _Readable(Protocol):
|
||||
def read(self, size: int = ..., /) -> bytes: ...
|
||||
# Optional: def close(self) -> object: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from wsgiref.types import *
|
||||
else:
|
||||
# stable
|
||||
class StartResponse(Protocol):
|
||||
def __call__(
|
||||
self, status: str, headers: list[tuple[str, str]], exc_info: OptExcInfo | None = ..., /
|
||||
) -> Callable[[bytes], object]: ...
|
||||
|
||||
WSGIEnvironment: TypeAlias = dict[str, Any] # stable
|
||||
WSGIApplication: TypeAlias = Callable[[WSGIEnvironment, StartResponse], Iterable[bytes]] # stable
|
||||
|
||||
# WSGI input streams per PEP 3333, stable
|
||||
class InputStream(Protocol):
|
||||
def read(self, size: int = ..., /) -> bytes: ...
|
||||
def readline(self, size: int = ..., /) -> bytes: ...
|
||||
def readlines(self, hint: int = ..., /) -> list[bytes]: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
|
||||
# WSGI error streams per PEP 3333, stable
|
||||
class ErrorStream(Protocol):
|
||||
def flush(self) -> object: ...
|
||||
def write(self, s: str, /) -> object: ...
|
||||
def writelines(self, seq: list[str], /) -> object: ...
|
||||
|
||||
# Optional file wrapper in wsgi.file_wrapper
|
||||
class FileWrapper(Protocol):
|
||||
def __call__(self, file: _Readable, block_size: int = ..., /) -> Iterable[bytes]: ...
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
# See the README.md file in this directory for more information.
|
||||
|
||||
from typing import Any, Protocol
|
||||
|
||||
# As defined https://docs.python.org/3/library/xml.dom.html#domimplementation-objects
|
||||
class DOMImplementation(Protocol):
|
||||
def hasFeature(self, feature: str, version: str | None, /) -> bool: ...
|
||||
def createDocument(self, namespaceUri: str, qualifiedName: str, doctype: Any | None, /) -> Any: ...
|
||||
def createDocumentType(self, qualifiedName: str, publicId: str, systemId: str, /) -> Any: ...
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,488 +1,8 @@
|
|||
import ssl
|
||||
import sys
|
||||
from _typeshed import FileDescriptorLike, ReadableBuffer, WriteableBuffer
|
||||
from asyncio import _AwaitableLike, _CoroutineLike
|
||||
from asyncio.events import AbstractEventLoop, AbstractServer, Handle, TimerHandle, _TaskFactory
|
||||
from asyncio.futures import Future
|
||||
from asyncio.protocols import BaseProtocol
|
||||
from asyncio.tasks import Task
|
||||
from asyncio.transports import BaseTransport, DatagramTransport, ReadTransport, SubprocessTransport, Transport, WriteTransport
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from concurrent.futures import Executor, ThreadPoolExecutor
|
||||
from contextvars import Context
|
||||
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Literal, TypeVar, overload
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("BaseEventLoop", "Server")
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
_ProtocolT = TypeVar("_ProtocolT", bound=BaseProtocol)
|
||||
_Context: TypeAlias = dict[str, Any]
|
||||
_ExceptionHandler: TypeAlias = Callable[[AbstractEventLoop, _Context], object]
|
||||
_ProtocolFactory: TypeAlias = Callable[[], BaseProtocol]
|
||||
_SSLContext: TypeAlias = bool | None | ssl.SSLContext
|
||||
|
||||
class Server(AbstractServer):
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(
|
||||
self,
|
||||
loop: AbstractEventLoop,
|
||||
sockets: Iterable[socket],
|
||||
protocol_factory: _ProtocolFactory,
|
||||
ssl_context: _SSLContext,
|
||||
backlog: int,
|
||||
ssl_handshake_timeout: float | None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
loop: AbstractEventLoop,
|
||||
sockets: Iterable[socket],
|
||||
protocol_factory: _ProtocolFactory,
|
||||
ssl_context: _SSLContext,
|
||||
backlog: int,
|
||||
ssl_handshake_timeout: float | None,
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
def close_clients(self) -> None: ...
|
||||
def abort_clients(self) -> None: ...
|
||||
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
def is_serving(self) -> bool: ...
|
||||
async def start_serving(self) -> None: ...
|
||||
async def serve_forever(self) -> None: ...
|
||||
@property
|
||||
def sockets(self) -> tuple[socket, ...]: ...
|
||||
def close(self) -> None: ...
|
||||
async def wait_closed(self) -> None: ...
|
||||
|
||||
class BaseEventLoop(AbstractEventLoop):
|
||||
def run_forever(self) -> None: ...
|
||||
def run_until_complete(self, future: _AwaitableLike[_T]) -> _T: ...
|
||||
def stop(self) -> None: ...
|
||||
def is_running(self) -> bool: ...
|
||||
def is_closed(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
async def shutdown_asyncgens(self) -> None: ...
|
||||
# Methods scheduling callbacks. All these return Handles.
|
||||
def call_soon(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
def call_later(
|
||||
self, delay: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
def call_at(
|
||||
self, when: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
def time(self) -> float: ...
|
||||
# Future methods
|
||||
def create_future(self) -> Future[Any]: ...
|
||||
# Tasks methods
|
||||
if sys.version_info >= (3, 11):
|
||||
def create_task(self, coro: _CoroutineLike[_T], *, name: object = None, context: Context | None = None) -> Task[_T]: ...
|
||||
else:
|
||||
def create_task(self, coro: _CoroutineLike[_T], *, name: object = None) -> Task[_T]: ...
|
||||
|
||||
def set_task_factory(self, factory: _TaskFactory | None) -> None: ...
|
||||
def get_task_factory(self) -> _TaskFactory | None: ...
|
||||
# Methods for interacting with threads
|
||||
def call_soon_threadsafe(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
def run_in_executor(self, executor: Executor | None, func: Callable[[Unpack[_Ts]], _T], *args: Unpack[_Ts]) -> Future[_T]: ...
|
||||
def set_default_executor(self, executor: ThreadPoolExecutor) -> None: ... # type: ignore[override]
|
||||
# Network I/O methods returning Futures.
|
||||
async def getaddrinfo(
|
||||
self,
|
||||
host: bytes | str | None,
|
||||
port: bytes | str | int | None,
|
||||
*,
|
||||
family: int = 0,
|
||||
type: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...
|
||||
async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
@overload
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: None = None,
|
||||
local_addr: tuple[str, int] | None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
all_errors: bool = False,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
@overload
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: socket,
|
||||
local_addr: None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
all_errors: bool = False,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
@overload
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: None = None,
|
||||
local_addr: tuple[str, int] | None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
@overload
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: socket,
|
||||
local_addr: None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
else:
|
||||
@overload
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: None = None,
|
||||
local_addr: tuple[str, int] | None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
@overload
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: socket,
|
||||
local_addr: None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
# 3.13 added `keep_alive`.
|
||||
@overload
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
keep_alive: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
keep_alive: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
@overload
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
else:
|
||||
@overload
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
async def start_tls(
|
||||
self,
|
||||
transport: BaseTransport,
|
||||
protocol: BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
*,
|
||||
server_side: bool = False,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> Transport | None: ...
|
||||
async def connect_accepted_socket(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
sock: socket,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
else:
|
||||
async def start_tls(
|
||||
self,
|
||||
transport: BaseTransport,
|
||||
protocol: BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
*,
|
||||
server_side: bool = False,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
) -> Transport | None: ...
|
||||
async def connect_accepted_socket(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
sock: socket,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
|
||||
async def sock_sendfile(
|
||||
self, sock: socket, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool | None = True
|
||||
) -> int: ...
|
||||
async def sendfile(
|
||||
self, transport: WriteTransport, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool = True
|
||||
) -> int: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
async def create_datagram_endpoint( # type: ignore[override]
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
local_addr: tuple[str, int] | str | None = None,
|
||||
remote_addr: tuple[str, int] | str | None = None,
|
||||
*,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
reuse_port: bool | None = None,
|
||||
allow_broadcast: bool | None = None,
|
||||
sock: socket | None = None,
|
||||
) -> tuple[DatagramTransport, _ProtocolT]: ...
|
||||
else:
|
||||
async def create_datagram_endpoint(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
local_addr: tuple[str, int] | str | None = None,
|
||||
remote_addr: tuple[str, int] | str | None = None,
|
||||
*,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
reuse_address: bool | None = ...,
|
||||
reuse_port: bool | None = None,
|
||||
allow_broadcast: bool | None = None,
|
||||
sock: socket | None = None,
|
||||
) -> tuple[DatagramTransport, _ProtocolT]: ...
|
||||
# Pipes and subprocesses.
|
||||
async def connect_read_pipe(
|
||||
self, protocol_factory: Callable[[], _ProtocolT], pipe: Any
|
||||
) -> tuple[ReadTransport, _ProtocolT]: ...
|
||||
async def connect_write_pipe(
|
||||
self, protocol_factory: Callable[[], _ProtocolT], pipe: Any
|
||||
) -> tuple[WriteTransport, _ProtocolT]: ...
|
||||
async def subprocess_shell(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
cmd: bytes | str,
|
||||
*,
|
||||
stdin: int | IO[Any] | None = -1,
|
||||
stdout: int | IO[Any] | None = -1,
|
||||
stderr: int | IO[Any] | None = -1,
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[True] = True,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
**kwargs: Any,
|
||||
) -> tuple[SubprocessTransport, _ProtocolT]: ...
|
||||
async def subprocess_exec(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
program: Any,
|
||||
*args: Any,
|
||||
stdin: int | IO[Any] | None = -1,
|
||||
stdout: int | IO[Any] | None = -1,
|
||||
stderr: int | IO[Any] | None = -1,
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[False] = False,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
**kwargs: Any,
|
||||
) -> tuple[SubprocessTransport, _ProtocolT]: ...
|
||||
def add_reader(self, fd: FileDescriptorLike, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ...
|
||||
def remove_reader(self, fd: FileDescriptorLike) -> bool: ...
|
||||
def add_writer(self, fd: FileDescriptorLike, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ...
|
||||
def remove_writer(self, fd: FileDescriptorLike) -> bool: ...
|
||||
# The sock_* methods (and probably some others) are not actually implemented on
|
||||
# BaseEventLoop, only on subclasses. We list them here for now for convenience.
|
||||
async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ...
|
||||
async def sock_recv_into(self, sock: socket, buf: WriteableBuffer) -> int: ...
|
||||
async def sock_sendall(self, sock: socket, data: ReadableBuffer) -> None: ...
|
||||
async def sock_connect(self, sock: socket, address: _Address) -> None: ...
|
||||
async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
async def sock_recvfrom(self, sock: socket, bufsize: int) -> tuple[bytes, _RetAddress]: ...
|
||||
async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> tuple[int, _RetAddress]: ...
|
||||
async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> int: ...
|
||||
# Signal handling.
|
||||
def add_signal_handler(self, sig: int, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ...
|
||||
def remove_signal_handler(self, sig: int) -> bool: ...
|
||||
# Error handlers.
|
||||
def set_exception_handler(self, handler: _ExceptionHandler | None) -> None: ...
|
||||
def get_exception_handler(self) -> _ExceptionHandler | None: ...
|
||||
def default_exception_handler(self, context: _Context) -> None: ...
|
||||
def call_exception_handler(self, context: _Context) -> None: ...
|
||||
# Debug flag management.
|
||||
def get_debug(self) -> bool: ...
|
||||
def set_debug(self, enabled: bool) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
async def shutdown_default_executor(self, timeout: float | None = None) -> None: ...
|
||||
else:
|
||||
async def shutdown_default_executor(self) -> None: ...
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
from collections.abc import Callable, Sequence
|
||||
from contextvars import Context
|
||||
from typing import Any, Final
|
||||
|
||||
from . import futures
|
||||
|
||||
__all__ = ()
|
||||
|
||||
# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py
|
||||
# but it leads to circular import error in pytype tool.
|
||||
# That's why the import order is reversed.
|
||||
from .futures import isfuture as isfuture
|
||||
|
||||
_PENDING: Final = "PENDING" # undocumented
|
||||
_CANCELLED: Final = "CANCELLED" # undocumented
|
||||
_FINISHED: Final = "FINISHED" # undocumented
|
||||
|
||||
def _format_callbacks(cb: Sequence[tuple[Callable[[futures.Future[Any]], None], Context]]) -> str: ... # undocumented
|
||||
def _future_repr_info(future: futures.Future[Any]) -> list[str]: ... # undocumented
|
||||
|
|
@ -1,63 +0,0 @@
|
|||
import subprocess
|
||||
from collections import deque
|
||||
from collections.abc import Callable, Sequence
|
||||
from typing import IO, Any
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import events, futures, protocols, transports
|
||||
|
||||
_File: TypeAlias = int | IO[Any] | None
|
||||
|
||||
class BaseSubprocessTransport(transports.SubprocessTransport):
|
||||
_closed: bool # undocumented
|
||||
_protocol: protocols.SubprocessProtocol # undocumented
|
||||
_loop: events.AbstractEventLoop # undocumented
|
||||
_proc: subprocess.Popen[Any] | None # undocumented
|
||||
_pid: int | None # undocumented
|
||||
_returncode: int | None # undocumented
|
||||
_exit_waiters: list[futures.Future[Any]] # undocumented
|
||||
_pending_calls: deque[tuple[Callable[..., Any], tuple[Any, ...]]] # undocumented
|
||||
_pipes: dict[int, _File] # undocumented
|
||||
_finished: bool # undocumented
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
protocol: protocols.SubprocessProtocol,
|
||||
args: str | bytes | Sequence[str | bytes],
|
||||
shell: bool,
|
||||
stdin: _File,
|
||||
stdout: _File,
|
||||
stderr: _File,
|
||||
bufsize: int,
|
||||
waiter: futures.Future[Any] | None = None,
|
||||
extra: Any | None = None,
|
||||
**kwargs: Any,
|
||||
) -> None: ...
|
||||
def _start(
|
||||
self,
|
||||
args: str | bytes | Sequence[str | bytes],
|
||||
shell: bool,
|
||||
stdin: _File,
|
||||
stdout: _File,
|
||||
stderr: _File,
|
||||
bufsize: int,
|
||||
**kwargs: Any,
|
||||
) -> None: ... # undocumented
|
||||
def get_pid(self) -> int | None: ... # type: ignore[override]
|
||||
def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore[override]
|
||||
def _check_proc(self) -> None: ... # undocumented
|
||||
def send_signal(self, signal: int) -> None: ...
|
||||
async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented
|
||||
def _call(self, cb: Callable[..., object], *data: Any) -> None: ... # undocumented
|
||||
def _pipe_connection_lost(self, fd: int, exc: BaseException | None) -> None: ... # undocumented
|
||||
def _pipe_data_received(self, fd: int, data: bytes) -> None: ... # undocumented
|
||||
def _process_exited(self, returncode: int) -> None: ... # undocumented
|
||||
async def _wait(self) -> int: ... # undocumented
|
||||
def _try_finish(self) -> None: ... # undocumented
|
||||
def _call_connection_lost(self, exc: BaseException | None) -> None: ... # undocumented
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
class WriteSubprocessPipeProto(protocols.BaseProtocol): # undocumented
|
||||
def __init__(self, proc: BaseSubprocessTransport, fd: int) -> None: ...
|
||||
|
||||
class ReadSubprocessPipeProto(WriteSubprocessPipeProto, protocols.Protocol): ... # undocumented
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
from _typeshed import StrOrBytesPath
|
||||
from types import FrameType
|
||||
from typing import Any
|
||||
|
||||
from . import tasks
|
||||
|
||||
def _task_repr_info(task: tasks.Task[Any]) -> list[str]: ... # undocumented
|
||||
def _task_get_stack(task: tasks.Task[Any], limit: int | None) -> list[FrameType]: ... # undocumented
|
||||
def _task_print_stack(task: tasks.Task[Any], limit: int | None, file: StrOrBytesPath) -> None: ... # undocumented
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
import enum
|
||||
import sys
|
||||
from typing import Final
|
||||
|
||||
LOG_THRESHOLD_FOR_CONNLOST_WRITES: Final = 5
|
||||
ACCEPT_RETRY_DELAY: Final = 1
|
||||
DEBUG_STACK_DEPTH: Final = 10
|
||||
SSL_HANDSHAKE_TIMEOUT: float
|
||||
SENDFILE_FALLBACK_READBUFFER_SIZE: Final = 262144
|
||||
if sys.version_info >= (3, 11):
|
||||
SSL_SHUTDOWN_TIMEOUT: float
|
||||
FLOW_CONTROL_HIGH_WATER_SSL_READ: Final = 256
|
||||
FLOW_CONTROL_HIGH_WATER_SSL_WRITE: Final = 512
|
||||
if sys.version_info >= (3, 12):
|
||||
THREAD_JOIN_TIMEOUT: Final = 300
|
||||
|
||||
class _SendfileMode(enum.Enum):
|
||||
UNSUPPORTED = 1
|
||||
TRY_NATIVE = 2
|
||||
FALLBACK = 3
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
import sys
|
||||
from collections.abc import Awaitable, Callable, Coroutine
|
||||
from typing import Any, TypeVar, overload
|
||||
from typing_extensions import ParamSpec, TypeGuard, TypeIs
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("iscoroutinefunction", "iscoroutine")
|
||||
else:
|
||||
__all__ = ("coroutine", "iscoroutinefunction", "iscoroutine")
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_FunctionT = TypeVar("_FunctionT", bound=Callable[..., Any])
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
def coroutine(func: _FunctionT) -> _FunctionT: ...
|
||||
|
||||
@overload
|
||||
def iscoroutinefunction(func: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ...
|
||||
@overload
|
||||
def iscoroutinefunction(func: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, _T]]]: ...
|
||||
@overload
|
||||
def iscoroutinefunction(func: Callable[_P, object]) -> TypeGuard[Callable[_P, Coroutine[Any, Any, Any]]]: ...
|
||||
@overload
|
||||
def iscoroutinefunction(func: object) -> TypeGuard[Callable[..., Coroutine[Any, Any, Any]]]: ...
|
||||
def iscoroutine(obj: object) -> TypeIs[Coroutine[Any, Any, Any]]: ...
|
||||
|
|
@ -1,642 +0,0 @@
|
|||
import ssl
|
||||
import sys
|
||||
from _asyncio import (
|
||||
_get_running_loop as _get_running_loop,
|
||||
_set_running_loop as _set_running_loop,
|
||||
get_event_loop as get_event_loop,
|
||||
get_running_loop as get_running_loop,
|
||||
)
|
||||
from _typeshed import FileDescriptorLike, ReadableBuffer, StrPath, Unused, WriteableBuffer
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import Callable, Sequence
|
||||
from concurrent.futures import Executor
|
||||
from contextvars import Context
|
||||
from socket import AddressFamily, SocketKind, _Address, _RetAddress, socket
|
||||
from typing import IO, Any, Literal, Protocol, TypeVar, overload
|
||||
from typing_extensions import Self, TypeAlias, TypeVarTuple, Unpack, deprecated
|
||||
|
||||
from . import _AwaitableLike, _CoroutineLike
|
||||
from .base_events import Server
|
||||
from .futures import Future
|
||||
from .protocols import BaseProtocol
|
||||
from .tasks import Task
|
||||
from .transports import BaseTransport, DatagramTransport, ReadTransport, SubprocessTransport, Transport, WriteTransport
|
||||
from .unix_events import AbstractChildWatcher
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = (
|
||||
"AbstractEventLoopPolicy",
|
||||
"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")
|
||||
_ProtocolT = TypeVar("_ProtocolT", bound=BaseProtocol)
|
||||
_Context: TypeAlias = dict[str, Any]
|
||||
_ExceptionHandler: TypeAlias = Callable[[AbstractEventLoop, _Context], object]
|
||||
_ProtocolFactory: TypeAlias = Callable[[], BaseProtocol]
|
||||
_SSLContext: TypeAlias = bool | None | ssl.SSLContext
|
||||
|
||||
class _TaskFactory(Protocol):
|
||||
def __call__(self, loop: AbstractEventLoop, factory: _CoroutineLike[_T], /) -> Future[_T]: ...
|
||||
|
||||
class Handle:
|
||||
_cancelled: bool
|
||||
_args: Sequence[Any]
|
||||
def __init__(
|
||||
self, callback: Callable[..., object], args: Sequence[Any], loop: AbstractEventLoop, context: Context | None = None
|
||||
) -> None: ...
|
||||
def cancel(self) -> None: ...
|
||||
def _run(self) -> None: ...
|
||||
def cancelled(self) -> bool: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def get_context(self) -> Context: ...
|
||||
|
||||
class TimerHandle(Handle):
|
||||
def __init__(
|
||||
self,
|
||||
when: float,
|
||||
callback: Callable[..., object],
|
||||
args: Sequence[Any],
|
||||
loop: AbstractEventLoop,
|
||||
context: Context | None = None,
|
||||
) -> None: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def when(self) -> float: ...
|
||||
def __lt__(self, other: TimerHandle) -> bool: ...
|
||||
def __le__(self, other: TimerHandle) -> bool: ...
|
||||
def __gt__(self, other: TimerHandle) -> bool: ...
|
||||
def __ge__(self, other: TimerHandle) -> bool: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class AbstractServer:
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
@abstractmethod
|
||||
def close_clients(self) -> None: ...
|
||||
@abstractmethod
|
||||
def abort_clients(self) -> None: ...
|
||||
|
||||
async def __aenter__(self) -> Self: ...
|
||||
async def __aexit__(self, *exc: Unused) -> None: ...
|
||||
@abstractmethod
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
@abstractmethod
|
||||
def is_serving(self) -> bool: ...
|
||||
@abstractmethod
|
||||
async def start_serving(self) -> None: ...
|
||||
@abstractmethod
|
||||
async def serve_forever(self) -> None: ...
|
||||
@abstractmethod
|
||||
async def wait_closed(self) -> None: ...
|
||||
|
||||
class AbstractEventLoop:
|
||||
slow_callback_duration: float
|
||||
@abstractmethod
|
||||
def run_forever(self) -> None: ...
|
||||
@abstractmethod
|
||||
def run_until_complete(self, future: _AwaitableLike[_T]) -> _T: ...
|
||||
@abstractmethod
|
||||
def stop(self) -> None: ...
|
||||
@abstractmethod
|
||||
def is_running(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def is_closed(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def close(self) -> None: ...
|
||||
@abstractmethod
|
||||
async def shutdown_asyncgens(self) -> None: ...
|
||||
# Methods scheduling callbacks. All these return Handles.
|
||||
# "context" added in 3.9.10/3.10.2 for call_*
|
||||
@abstractmethod
|
||||
def call_soon(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
@abstractmethod
|
||||
def call_later(
|
||||
self, delay: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def call_at(
|
||||
self, when: float, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> TimerHandle: ...
|
||||
@abstractmethod
|
||||
def time(self) -> float: ...
|
||||
# Future methods
|
||||
@abstractmethod
|
||||
def create_future(self) -> Future[Any]: ...
|
||||
# Tasks methods
|
||||
if sys.version_info >= (3, 11):
|
||||
@abstractmethod
|
||||
def create_task(
|
||||
self, coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None
|
||||
) -> Task[_T]: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
def create_task(self, coro: _CoroutineLike[_T], *, name: str | None = None) -> Task[_T]: ...
|
||||
|
||||
@abstractmethod
|
||||
def set_task_factory(self, factory: _TaskFactory | None) -> None: ...
|
||||
@abstractmethod
|
||||
def get_task_factory(self) -> _TaskFactory | None: ...
|
||||
# Methods for interacting with threads
|
||||
# "context" added in 3.9.10/3.10.2
|
||||
@abstractmethod
|
||||
def call_soon_threadsafe(
|
||||
self, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts], context: Context | None = None
|
||||
) -> Handle: ...
|
||||
@abstractmethod
|
||||
def run_in_executor(self, executor: Executor | None, func: Callable[[Unpack[_Ts]], _T], *args: Unpack[_Ts]) -> Future[_T]: ...
|
||||
@abstractmethod
|
||||
def set_default_executor(self, executor: Executor) -> None: ...
|
||||
# Network I/O methods returning Futures.
|
||||
@abstractmethod
|
||||
async def getaddrinfo(
|
||||
self,
|
||||
host: bytes | str | None,
|
||||
port: bytes | str | int | None,
|
||||
*,
|
||||
family: int = 0,
|
||||
type: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
) -> list[tuple[AddressFamily, SocketKind, int, str, tuple[str, int] | tuple[str, int, int, int]]]: ...
|
||||
@abstractmethod
|
||||
async def getnameinfo(self, sockaddr: tuple[str, int] | tuple[str, int, int, int], flags: int = 0) -> tuple[str, str]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: None = None,
|
||||
local_addr: tuple[str, int] | None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: socket,
|
||||
local_addr: None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
else:
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: str = ...,
|
||||
port: int = ...,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: None = None,
|
||||
local_addr: tuple[str, int] | None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
sock: socket,
|
||||
local_addr: None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
happy_eyeballs_delay: float | None = None,
|
||||
interleave: int | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
# 3.13 added `keep_alive`.
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
keep_alive: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
keep_alive: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
else:
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: str | Sequence[str] | None = None,
|
||||
port: int = ...,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
@overload
|
||||
@abstractmethod
|
||||
async def create_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
host: None = None,
|
||||
port: None = None,
|
||||
*,
|
||||
family: int = ...,
|
||||
flags: int = ...,
|
||||
sock: socket = ...,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@abstractmethod
|
||||
async def start_tls(
|
||||
self,
|
||||
transport: WriteTransport,
|
||||
protocol: BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
*,
|
||||
server_side: bool = False,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> Transport | None: ...
|
||||
async def create_unix_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: StrPath | None = None,
|
||||
*,
|
||||
sock: socket | None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
else:
|
||||
@abstractmethod
|
||||
async def start_tls(
|
||||
self,
|
||||
transport: BaseTransport,
|
||||
protocol: BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
*,
|
||||
server_side: bool = False,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
) -> Transport | None: ...
|
||||
async def create_unix_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: StrPath | None = None,
|
||||
*,
|
||||
sock: socket | None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
) -> Server: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
async def connect_accepted_socket(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
sock: socket,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
elif sys.version_info >= (3, 10):
|
||||
async def connect_accepted_socket(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
sock: socket,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
async def create_unix_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
path: str | None = None,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
sock: socket | None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
else:
|
||||
async def create_unix_connection(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
path: str | None = None,
|
||||
*,
|
||||
ssl: _SSLContext = None,
|
||||
sock: socket | None = None,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
) -> tuple[Transport, _ProtocolT]: ...
|
||||
|
||||
@abstractmethod
|
||||
async def sock_sendfile(
|
||||
self, sock: socket, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool | None = None
|
||||
) -> int: ...
|
||||
@abstractmethod
|
||||
async def sendfile(
|
||||
self, transport: WriteTransport, file: IO[bytes], offset: int = 0, count: int | None = None, *, fallback: bool = True
|
||||
) -> int: ...
|
||||
@abstractmethod
|
||||
async def create_datagram_endpoint(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
local_addr: tuple[str, int] | str | None = None,
|
||||
remote_addr: tuple[str, int] | str | None = None,
|
||||
*,
|
||||
family: int = 0,
|
||||
proto: int = 0,
|
||||
flags: int = 0,
|
||||
reuse_address: bool | None = None,
|
||||
reuse_port: bool | None = None,
|
||||
allow_broadcast: bool | None = None,
|
||||
sock: socket | None = None,
|
||||
) -> tuple[DatagramTransport, _ProtocolT]: ...
|
||||
# Pipes and subprocesses.
|
||||
@abstractmethod
|
||||
async def connect_read_pipe(
|
||||
self, protocol_factory: Callable[[], _ProtocolT], pipe: Any
|
||||
) -> tuple[ReadTransport, _ProtocolT]: ...
|
||||
@abstractmethod
|
||||
async def connect_write_pipe(
|
||||
self, protocol_factory: Callable[[], _ProtocolT], pipe: Any
|
||||
) -> tuple[WriteTransport, _ProtocolT]: ...
|
||||
@abstractmethod
|
||||
async def subprocess_shell(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
cmd: bytes | str,
|
||||
*,
|
||||
stdin: int | IO[Any] | None = -1,
|
||||
stdout: int | IO[Any] | None = -1,
|
||||
stderr: int | IO[Any] | None = -1,
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[True] = True,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = ...,
|
||||
**kwargs: Any,
|
||||
) -> tuple[SubprocessTransport, _ProtocolT]: ...
|
||||
@abstractmethod
|
||||
async def subprocess_exec(
|
||||
self,
|
||||
protocol_factory: Callable[[], _ProtocolT],
|
||||
program: Any,
|
||||
*args: Any,
|
||||
stdin: int | IO[Any] | None = -1,
|
||||
stdout: int | IO[Any] | None = -1,
|
||||
stderr: int | IO[Any] | None = -1,
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[False] = False,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
**kwargs: Any,
|
||||
) -> tuple[SubprocessTransport, _ProtocolT]: ...
|
||||
@abstractmethod
|
||||
def add_reader(self, fd: FileDescriptorLike, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ...
|
||||
@abstractmethod
|
||||
def remove_reader(self, fd: FileDescriptorLike) -> bool: ...
|
||||
@abstractmethod
|
||||
def add_writer(self, fd: FileDescriptorLike, callback: Callable[[Unpack[_Ts]], Any], *args: Unpack[_Ts]) -> None: ...
|
||||
@abstractmethod
|
||||
def remove_writer(self, fd: FileDescriptorLike) -> bool: ...
|
||||
@abstractmethod
|
||||
async def sock_recv(self, sock: socket, nbytes: int) -> bytes: ...
|
||||
@abstractmethod
|
||||
async def sock_recv_into(self, sock: socket, buf: WriteableBuffer) -> int: ...
|
||||
@abstractmethod
|
||||
async def sock_sendall(self, sock: socket, data: ReadableBuffer) -> None: ...
|
||||
@abstractmethod
|
||||
async def sock_connect(self, sock: socket, address: _Address) -> None: ...
|
||||
@abstractmethod
|
||||
async def sock_accept(self, sock: socket) -> tuple[socket, _RetAddress]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
@abstractmethod
|
||||
async def sock_recvfrom(self, sock: socket, bufsize: int) -> tuple[bytes, _RetAddress]: ...
|
||||
@abstractmethod
|
||||
async def sock_recvfrom_into(self, sock: socket, buf: WriteableBuffer, nbytes: int = 0) -> tuple[int, _RetAddress]: ...
|
||||
@abstractmethod
|
||||
async def sock_sendto(self, sock: socket, data: ReadableBuffer, address: _Address) -> int: ...
|
||||
# Signal handling.
|
||||
@abstractmethod
|
||||
def add_signal_handler(self, sig: int, callback: Callable[[Unpack[_Ts]], object], *args: Unpack[_Ts]) -> None: ...
|
||||
@abstractmethod
|
||||
def remove_signal_handler(self, sig: int) -> bool: ...
|
||||
# Error handlers.
|
||||
@abstractmethod
|
||||
def set_exception_handler(self, handler: _ExceptionHandler | None) -> None: ...
|
||||
@abstractmethod
|
||||
def get_exception_handler(self) -> _ExceptionHandler | None: ...
|
||||
@abstractmethod
|
||||
def default_exception_handler(self, context: _Context) -> None: ...
|
||||
@abstractmethod
|
||||
def call_exception_handler(self, context: _Context) -> None: ...
|
||||
# Debug flag management.
|
||||
@abstractmethod
|
||||
def get_debug(self) -> bool: ...
|
||||
@abstractmethod
|
||||
def set_debug(self, enabled: bool) -> None: ...
|
||||
@abstractmethod
|
||||
async def shutdown_default_executor(self) -> None: ...
|
||||
|
||||
class AbstractEventLoopPolicy:
|
||||
@abstractmethod
|
||||
def get_event_loop(self) -> AbstractEventLoop: ...
|
||||
@abstractmethod
|
||||
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
@abstractmethod
|
||||
def new_event_loop(self) -> AbstractEventLoop: ...
|
||||
# Child processes handling (Unix only).
|
||||
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: ...
|
||||
def set_event_loop(self, loop: AbstractEventLoop | None) -> None: ...
|
||||
def new_event_loop(self) -> AbstractEventLoop: ...
|
||||
|
||||
def get_event_loop_policy() -> AbstractEventLoopPolicy: ...
|
||||
def set_event_loop_policy(policy: AbstractEventLoopPolicy | None) -> None: ...
|
||||
def set_event_loop(loop: AbstractEventLoop | None) -> None: ...
|
||||
def new_event_loop() -> AbstractEventLoop: ...
|
||||
|
||||
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: ...
|
||||
|
|
@ -1,44 +0,0 @@
|
|||
import sys
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = (
|
||||
"BrokenBarrierError",
|
||||
"CancelledError",
|
||||
"InvalidStateError",
|
||||
"TimeoutError",
|
||||
"IncompleteReadError",
|
||||
"LimitOverrunError",
|
||||
"SendfileNotAvailableError",
|
||||
)
|
||||
else:
|
||||
__all__ = (
|
||||
"CancelledError",
|
||||
"InvalidStateError",
|
||||
"TimeoutError",
|
||||
"IncompleteReadError",
|
||||
"LimitOverrunError",
|
||||
"SendfileNotAvailableError",
|
||||
)
|
||||
|
||||
class CancelledError(BaseException): ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from builtins import TimeoutError as TimeoutError
|
||||
else:
|
||||
class TimeoutError(Exception): ...
|
||||
|
||||
class InvalidStateError(Exception): ...
|
||||
class SendfileNotAvailableError(RuntimeError): ...
|
||||
|
||||
class IncompleteReadError(EOFError):
|
||||
expected: int | None
|
||||
partial: bytes
|
||||
def __init__(self, partial: bytes, expected: int | None) -> None: ...
|
||||
|
||||
class LimitOverrunError(Exception):
|
||||
consumed: int
|
||||
def __init__(self, message: str, consumed: int) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class BrokenBarrierError(RuntimeError): ...
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
import functools
|
||||
import sys
|
||||
import traceback
|
||||
from collections.abc import Iterable
|
||||
from types import FrameType, FunctionType
|
||||
from typing import Any, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
class _HasWrapper:
|
||||
__wrapper__: _HasWrapper | FunctionType
|
||||
|
||||
_FuncType: TypeAlias = FunctionType | _HasWrapper | functools.partial[Any] | functools.partialmethod[Any]
|
||||
|
||||
@overload
|
||||
def _get_function_source(func: _FuncType) -> tuple[str, int]: ...
|
||||
@overload
|
||||
def _get_function_source(func: object) -> tuple[str, int] | None: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
def _format_callback_source(func: object, args: Iterable[Any], *, debug: bool = False) -> str: ...
|
||||
def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any], *, debug: bool = False) -> str: ...
|
||||
def _format_callback(
|
||||
func: object, args: Iterable[Any], kwargs: dict[str, Any], *, debug: bool = False, suffix: str = ""
|
||||
) -> str: ...
|
||||
|
||||
else:
|
||||
def _format_callback_source(func: object, args: Iterable[Any]) -> str: ...
|
||||
def _format_args_and_kwargs(args: Iterable[Any], kwargs: dict[str, Any]) -> str: ...
|
||||
def _format_callback(func: object, args: Iterable[Any], kwargs: dict[str, Any], suffix: str = "") -> str: ...
|
||||
|
||||
def extract_stack(f: FrameType | None = None, limit: int | None = None) -> traceback.StackSummary: ...
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
from _asyncio import Future as Future
|
||||
from concurrent.futures._base import Future as _ConcurrentFuture
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import TypeIs
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("Future", "wrap_future", "isfuture")
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
# asyncio defines 'isfuture()' in base_futures.py and re-imports it in futures.py
|
||||
# but it leads to circular import error in pytype tool.
|
||||
# That's why the import order is reversed.
|
||||
def isfuture(obj: object) -> TypeIs[Future[Any]]: ...
|
||||
def wrap_future(future: _ConcurrentFuture[_T] | Future[_T], *, loop: AbstractEventLoop | None = None) -> Future[_T]: ...
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
import enum
|
||||
import sys
|
||||
from _typeshed import Unused
|
||||
from collections import deque
|
||||
from collections.abc import Callable
|
||||
from types import TracebackType
|
||||
from typing import Any, Literal, TypeVar
|
||||
from typing_extensions import Self
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from .mixins import _LoopBoundMixin
|
||||
else:
|
||||
_LoopBoundMixin = object
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore", "Barrier")
|
||||
else:
|
||||
__all__ = ("Lock", "Event", "Condition", "Semaphore", "BoundedSemaphore")
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class _ContextManagerMixin:
|
||||
async def __aenter__(self) -> None: ...
|
||||
async def __aexit__(
|
||||
self, exc_type: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
class Lock(_ContextManagerMixin, _LoopBoundMixin):
|
||||
_waiters: deque[Future[Any]] | None
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self) -> None: ...
|
||||
else:
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
|
||||
def locked(self) -> bool: ...
|
||||
async def acquire(self) -> Literal[True]: ...
|
||||
def release(self) -> None: ...
|
||||
|
||||
class Event(_LoopBoundMixin):
|
||||
_waiters: deque[Future[Any]]
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self) -> None: ...
|
||||
else:
|
||||
def __init__(self, *, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
|
||||
def is_set(self) -> bool: ...
|
||||
def set(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
async def wait(self) -> Literal[True]: ...
|
||||
|
||||
class Condition(_ContextManagerMixin, _LoopBoundMixin):
|
||||
_waiters: deque[Future[Any]]
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, lock: Lock | None = None) -> None: ...
|
||||
else:
|
||||
def __init__(self, lock: Lock | None = None, *, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
|
||||
def locked(self) -> bool: ...
|
||||
async def acquire(self) -> Literal[True]: ...
|
||||
def release(self) -> None: ...
|
||||
async def wait(self) -> Literal[True]: ...
|
||||
async def wait_for(self, predicate: Callable[[], _T]) -> _T: ...
|
||||
def notify(self, n: int = 1) -> None: ...
|
||||
def notify_all(self) -> None: ...
|
||||
|
||||
class Semaphore(_ContextManagerMixin, _LoopBoundMixin):
|
||||
_value: int
|
||||
_waiters: deque[Future[Any]] | None
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, value: int = 1) -> None: ...
|
||||
else:
|
||||
def __init__(self, value: int = 1, *, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
|
||||
def locked(self) -> bool: ...
|
||||
async def acquire(self) -> Literal[True]: ...
|
||||
def release(self) -> None: ...
|
||||
def _wake_up_next(self) -> None: ...
|
||||
|
||||
class BoundedSemaphore(Semaphore): ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
class _BarrierState(enum.Enum): # undocumented
|
||||
FILLING = "filling"
|
||||
DRAINING = "draining"
|
||||
RESETTING = "resetting"
|
||||
BROKEN = "broken"
|
||||
|
||||
class Barrier(_LoopBoundMixin):
|
||||
def __init__(self, parties: int) -> None: ...
|
||||
async def __aenter__(self) -> Self: ...
|
||||
async def __aexit__(self, *args: Unused) -> None: ...
|
||||
async def wait(self) -> int: ...
|
||||
async def abort(self) -> None: ...
|
||||
async def reset(self) -> None: ...
|
||||
@property
|
||||
def parties(self) -> int: ...
|
||||
@property
|
||||
def n_waiting(self) -> int: ...
|
||||
@property
|
||||
def broken(self) -> bool: ...
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
import logging
|
||||
|
||||
logger: logging.Logger
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
import sys
|
||||
import threading
|
||||
from typing_extensions import Never
|
||||
|
||||
_global_lock: threading.Lock
|
||||
|
||||
class _LoopBoundMixin:
|
||||
if sys.version_info < (3, 11):
|
||||
def __init__(self, *, loop: Never = ...) -> None: ...
|
||||
|
|
@ -1,65 +0,0 @@
|
|||
import sys
|
||||
from collections.abc import Mapping
|
||||
from socket import socket
|
||||
from typing import Any, ClassVar, Literal
|
||||
|
||||
from . import base_events, constants, events, futures, streams, transports
|
||||
|
||||
__all__ = ("BaseProactorEventLoop",)
|
||||
|
||||
class _ProactorBasePipeTransport(transports._FlowControlMixin, transports.BaseTransport):
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: futures.Future[Any] | None = None,
|
||||
extra: Mapping[Any, Any] | None = None,
|
||||
server: events.AbstractServer | None = None,
|
||||
) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
class _ProactorReadPipeTransport(_ProactorBasePipeTransport, transports.ReadTransport):
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: futures.Future[Any] | None = None,
|
||||
extra: Mapping[Any, Any] | None = None,
|
||||
server: events.AbstractServer | None = None,
|
||||
buffer_size: int = 65536,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: futures.Future[Any] | None = None,
|
||||
extra: Mapping[Any, Any] | None = None,
|
||||
server: events.AbstractServer | None = None,
|
||||
) -> None: ...
|
||||
|
||||
class _ProactorBaseWritePipeTransport(_ProactorBasePipeTransport, transports.WriteTransport): ...
|
||||
class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport): ...
|
||||
class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): ...
|
||||
|
||||
class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport):
|
||||
_sendfile_compatible: ClassVar[constants._SendfileMode]
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
sock: socket,
|
||||
protocol: streams.StreamReaderProtocol,
|
||||
waiter: futures.Future[Any] | None = None,
|
||||
extra: Mapping[Any, Any] | None = None,
|
||||
server: events.AbstractServer | None = None,
|
||||
) -> None: ...
|
||||
def _set_extra(self, sock: socket) -> None: ...
|
||||
def can_write_eof(self) -> Literal[True]: ...
|
||||
|
||||
class BaseProactorEventLoop(base_events.BaseEventLoop):
|
||||
def __init__(self, proactor: Any) -> None: ...
|
||||
async def sock_recv(self, sock: socket, n: int) -> bytes: ...
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
from _typeshed import ReadableBuffer
|
||||
from asyncio import transports
|
||||
from typing import Any
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("BaseProtocol", "Protocol", "DatagramProtocol", "SubprocessProtocol", "BufferedProtocol")
|
||||
|
||||
class BaseProtocol:
|
||||
def connection_made(self, transport: transports.BaseTransport) -> None: ...
|
||||
def connection_lost(self, exc: Exception | None) -> None: ...
|
||||
def pause_writing(self) -> None: ...
|
||||
def resume_writing(self) -> None: ...
|
||||
|
||||
class Protocol(BaseProtocol):
|
||||
def data_received(self, data: bytes) -> None: ...
|
||||
def eof_received(self) -> bool | None: ...
|
||||
|
||||
class BufferedProtocol(BaseProtocol):
|
||||
def get_buffer(self, sizehint: int) -> ReadableBuffer: ...
|
||||
def buffer_updated(self, nbytes: int) -> None: ...
|
||||
def eof_received(self) -> bool | None: ...
|
||||
|
||||
class DatagramProtocol(BaseProtocol):
|
||||
def connection_made(self, transport: transports.DatagramTransport) -> None: ... # type: ignore[override]
|
||||
# addr can be a tuple[int, int] for some unusual protocols like socket.AF_NETLINK.
|
||||
# Use tuple[str | Any, int] to not cause typechecking issues on most usual cases.
|
||||
# This could be improved by using tuple[AnyOf[str, int], int] if the AnyOf feature is accepted.
|
||||
# See https://github.com/python/typing/issues/566
|
||||
def datagram_received(self, data: bytes, addr: tuple[str | Any, int]) -> None: ...
|
||||
def error_received(self, exc: Exception) -> None: ...
|
||||
|
||||
class SubprocessProtocol(BaseProtocol):
|
||||
def pipe_data_received(self, fd: int, data: bytes) -> None: ...
|
||||
def pipe_connection_lost(self, fd: int, exc: Exception | None) -> None: ...
|
||||
def process_exited(self) -> None: ...
|
||||
|
|
@ -1,54 +0,0 @@
|
|||
import sys
|
||||
from asyncio.events import AbstractEventLoop
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, TypeVar
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from .mixins import _LoopBoundMixin
|
||||
else:
|
||||
_LoopBoundMixin = object
|
||||
|
||||
class QueueEmpty(Exception): ...
|
||||
class QueueFull(Exception): ...
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 13):
|
||||
__all__ = ("Queue", "PriorityQueue", "LifoQueue", "QueueFull", "QueueEmpty", "QueueShutDown")
|
||||
|
||||
else:
|
||||
__all__ = ("Queue", "PriorityQueue", "LifoQueue", "QueueFull", "QueueEmpty")
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
class QueueShutDown(Exception): ...
|
||||
|
||||
# If Generic[_T] is last and _LoopBoundMixin is object, pyright is unhappy.
|
||||
# We can remove the noqa pragma when dropping 3.9 support.
|
||||
class Queue(Generic[_T], _LoopBoundMixin): # noqa: Y059
|
||||
if sys.version_info >= (3, 10):
|
||||
def __init__(self, maxsize: int = 0) -> None: ...
|
||||
else:
|
||||
def __init__(self, maxsize: int = 0, *, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
|
||||
def _init(self, maxsize: int) -> None: ...
|
||||
def _get(self) -> _T: ...
|
||||
def _put(self, item: _T) -> None: ...
|
||||
def _format(self) -> str: ...
|
||||
def qsize(self) -> int: ...
|
||||
@property
|
||||
def maxsize(self) -> int: ...
|
||||
def empty(self) -> bool: ...
|
||||
def full(self) -> bool: ...
|
||||
async def put(self, item: _T) -> None: ...
|
||||
def put_nowait(self, item: _T) -> None: ...
|
||||
async def get(self) -> _T: ...
|
||||
def get_nowait(self) -> _T: ...
|
||||
async def join(self) -> None: ...
|
||||
def task_done(self) -> None: ...
|
||||
def __class_getitem__(cls, type: Any, /) -> GenericAlias: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def shutdown(self, immediate: bool = False) -> None: ...
|
||||
|
||||
class PriorityQueue(Queue[_T]): ...
|
||||
class LifoQueue(Queue[_T]): ...
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
import sys
|
||||
from _typeshed import Unused
|
||||
from collections.abc import Callable, Coroutine
|
||||
from contextvars import Context
|
||||
from typing import Any, TypeVar, final
|
||||
from typing_extensions import Self
|
||||
|
||||
from .events import AbstractEventLoop
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = ("Runner", "run")
|
||||
else:
|
||||
__all__ = ("run",)
|
||||
_T = TypeVar("_T")
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@final
|
||||
class Runner:
|
||||
def __init__(self, *, debug: bool | None = None, loop_factory: Callable[[], AbstractEventLoop] | None = None) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, exc_type: Unused, exc_val: Unused, exc_tb: Unused) -> None: ...
|
||||
def close(self) -> None: ...
|
||||
def get_loop(self) -> AbstractEventLoop: ...
|
||||
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
def run(
|
||||
main: Coroutine[Any, Any, _T], *, debug: bool | None = ..., loop_factory: Callable[[], AbstractEventLoop] | None = ...
|
||||
) -> _T: ...
|
||||
|
||||
else:
|
||||
def run(main: Coroutine[Any, Any, _T], *, debug: bool | None = None) -> _T: ...
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
import selectors
|
||||
from socket import socket
|
||||
|
||||
from . import base_events
|
||||
|
||||
__all__ = ("BaseSelectorEventLoop",)
|
||||
|
||||
class BaseSelectorEventLoop(base_events.BaseEventLoop):
|
||||
def __init__(self, selector: selectors.BaseSelector | None = None) -> None: ...
|
||||
async def sock_recv(self, sock: socket, n: int) -> bytes: ...
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
import ssl
|
||||
import sys
|
||||
from collections import deque
|
||||
from collections.abc import Callable
|
||||
from enum import Enum
|
||||
from typing import Any, ClassVar, Final, Literal
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from . import constants, events, futures, protocols, transports
|
||||
|
||||
def _create_transport_context(server_side: bool, server_hostname: str | None) -> ssl.SSLContext: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
SSLAgainErrors: tuple[type[ssl.SSLWantReadError], type[ssl.SSLSyscallError]]
|
||||
|
||||
class SSLProtocolState(Enum):
|
||||
UNWRAPPED = "UNWRAPPED"
|
||||
DO_HANDSHAKE = "DO_HANDSHAKE"
|
||||
WRAPPED = "WRAPPED"
|
||||
FLUSHING = "FLUSHING"
|
||||
SHUTDOWN = "SHUTDOWN"
|
||||
|
||||
class AppProtocolState(Enum):
|
||||
STATE_INIT = "STATE_INIT"
|
||||
STATE_CON_MADE = "STATE_CON_MADE"
|
||||
STATE_EOF = "STATE_EOF"
|
||||
STATE_CON_LOST = "STATE_CON_LOST"
|
||||
|
||||
def add_flowcontrol_defaults(high: int | None, low: int | None, kb: int) -> tuple[int, int]: ...
|
||||
|
||||
else:
|
||||
_UNWRAPPED: Final = "UNWRAPPED"
|
||||
_DO_HANDSHAKE: Final = "DO_HANDSHAKE"
|
||||
_WRAPPED: Final = "WRAPPED"
|
||||
_SHUTDOWN: Final = "SHUTDOWN"
|
||||
|
||||
if sys.version_info < (3, 11):
|
||||
class _SSLPipe:
|
||||
max_size: ClassVar[int]
|
||||
|
||||
_context: ssl.SSLContext
|
||||
_server_side: bool
|
||||
_server_hostname: str | None
|
||||
_state: str
|
||||
_incoming: ssl.MemoryBIO
|
||||
_outgoing: ssl.MemoryBIO
|
||||
_sslobj: ssl.SSLObject | None
|
||||
_need_ssldata: bool
|
||||
_handshake_cb: Callable[[BaseException | None], None] | None
|
||||
_shutdown_cb: Callable[[], None] | None
|
||||
def __init__(self, context: ssl.SSLContext, server_side: bool, server_hostname: str | None = None) -> None: ...
|
||||
@property
|
||||
def context(self) -> ssl.SSLContext: ...
|
||||
@property
|
||||
def ssl_object(self) -> ssl.SSLObject | None: ...
|
||||
@property
|
||||
def need_ssldata(self) -> bool: ...
|
||||
@property
|
||||
def wrapped(self) -> bool: ...
|
||||
def do_handshake(self, callback: Callable[[BaseException | None], object] | None = None) -> list[bytes]: ...
|
||||
def shutdown(self, callback: Callable[[], object] | None = None) -> list[bytes]: ...
|
||||
def feed_eof(self) -> None: ...
|
||||
def feed_ssldata(self, data: bytes, only_handshake: bool = False) -> tuple[list[bytes], list[bytes]]: ...
|
||||
def feed_appdata(self, data: bytes, offset: int = 0) -> tuple[list[bytes], int]: ...
|
||||
|
||||
class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport):
|
||||
_sendfile_compatible: ClassVar[constants._SendfileMode]
|
||||
|
||||
_loop: events.AbstractEventLoop
|
||||
if sys.version_info >= (3, 11):
|
||||
_ssl_protocol: SSLProtocol | None
|
||||
else:
|
||||
_ssl_protocol: SSLProtocol
|
||||
_closed: bool
|
||||
def __init__(self, loop: events.AbstractEventLoop, ssl_protocol: SSLProtocol) -> None: ...
|
||||
def get_extra_info(self, name: str, default: Any | None = None) -> dict[str, Any]: ...
|
||||
@property
|
||||
def _protocol_paused(self) -> bool: ...
|
||||
def write(self, data: bytes | bytearray | memoryview[Any]) -> None: ... # any memoryview format or shape
|
||||
def can_write_eof(self) -> Literal[False]: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def get_write_buffer_limits(self) -> tuple[int, int]: ...
|
||||
def get_read_buffer_limits(self) -> tuple[int, int]: ...
|
||||
def set_read_buffer_limits(self, high: int | None = None, low: int | None = None) -> None: ...
|
||||
def get_read_buffer_size(self) -> int: ...
|
||||
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
_SSLProtocolBase: TypeAlias = protocols.BufferedProtocol
|
||||
else:
|
||||
_SSLProtocolBase: TypeAlias = protocols.Protocol
|
||||
|
||||
class SSLProtocol(_SSLProtocolBase):
|
||||
_server_side: bool
|
||||
_server_hostname: str | None
|
||||
_sslcontext: ssl.SSLContext
|
||||
_extra: dict[str, Any]
|
||||
_write_backlog: deque[tuple[bytes, int]]
|
||||
_write_buffer_size: int
|
||||
_waiter: futures.Future[Any]
|
||||
_loop: events.AbstractEventLoop
|
||||
_app_transport: _SSLProtocolTransport
|
||||
_transport: transports.BaseTransport | None
|
||||
_ssl_handshake_timeout: int | None
|
||||
_app_protocol: protocols.BaseProtocol
|
||||
_app_protocol_is_buffer: bool
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
max_size: ClassVar[int]
|
||||
else:
|
||||
_sslpipe: _SSLPipe | None
|
||||
_session_established: bool
|
||||
_call_connection_made: bool
|
||||
_in_handshake: bool
|
||||
_in_shutdown: bool
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
app_protocol: protocols.BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
waiter: futures.Future[Any],
|
||||
server_side: bool = False,
|
||||
server_hostname: str | None = None,
|
||||
call_connection_made: bool = True,
|
||||
ssl_handshake_timeout: int | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
loop: events.AbstractEventLoop,
|
||||
app_protocol: protocols.BaseProtocol,
|
||||
sslcontext: ssl.SSLContext,
|
||||
waiter: futures.Future[Any],
|
||||
server_side: bool = False,
|
||||
server_hostname: str | None = None,
|
||||
call_connection_made: bool = True,
|
||||
ssl_handshake_timeout: int | None = None,
|
||||
) -> None: ...
|
||||
|
||||
def _set_app_protocol(self, app_protocol: protocols.BaseProtocol) -> None: ...
|
||||
def _wakeup_waiter(self, exc: BaseException | None = None) -> None: ...
|
||||
def connection_lost(self, exc: BaseException | None) -> None: ...
|
||||
def eof_received(self) -> None: ...
|
||||
def _get_extra_info(self, name: str, default: Any | None = None) -> Any: ...
|
||||
def _start_shutdown(self) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def _write_appdata(self, list_of_data: list[bytes]) -> None: ...
|
||||
else:
|
||||
def _write_appdata(self, data: bytes) -> None: ...
|
||||
|
||||
def _start_handshake(self) -> None: ...
|
||||
def _check_handshake_timeout(self) -> None: ...
|
||||
def _on_handshake_complete(self, handshake_exc: BaseException | None) -> None: ...
|
||||
def _fatal_error(self, exc: BaseException, message: str = "Fatal error on transport") -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def _abort(self, exc: BaseException | None) -> None: ...
|
||||
def get_buffer(self, n: int) -> memoryview: ...
|
||||
else:
|
||||
def _abort(self) -> None: ...
|
||||
def _finalize(self) -> None: ...
|
||||
def _process_write_backlog(self) -> None: ...
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
from collections.abc import Awaitable, Callable, Iterable
|
||||
from typing import Any
|
||||
|
||||
from . import events
|
||||
|
||||
__all__ = ("staggered_race",)
|
||||
|
||||
async def staggered_race(
|
||||
coro_fns: Iterable[Callable[[], Awaitable[Any]]], delay: float | None, *, loop: events.AbstractEventLoop | None = None
|
||||
) -> tuple[Any, int | None, list[Exception | None]]: ...
|
||||
|
|
@ -1,158 +0,0 @@
|
|||
import ssl
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer, StrPath
|
||||
from collections.abc import Awaitable, Callable, Iterable, Sequence, Sized
|
||||
from types import ModuleType
|
||||
from typing import Any, Protocol, SupportsIndex
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
from . import events, protocols, transports
|
||||
from .base_events import Server
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform == "win32":
|
||||
__all__ = ("StreamReader", "StreamWriter", "StreamReaderProtocol", "open_connection", "start_server")
|
||||
else:
|
||||
__all__ = (
|
||||
"StreamReader",
|
||||
"StreamWriter",
|
||||
"StreamReaderProtocol",
|
||||
"open_connection",
|
||||
"start_server",
|
||||
"open_unix_connection",
|
||||
"start_unix_server",
|
||||
)
|
||||
|
||||
_ClientConnectedCallback: TypeAlias = Callable[[StreamReader, StreamWriter], Awaitable[None] | None]
|
||||
|
||||
class _ReaduntilBuffer(ReadableBuffer, Sized, Protocol): ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
async def open_connection(
|
||||
host: str | None = None,
|
||||
port: int | str | None = None,
|
||||
*,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
**kwds: Any,
|
||||
) -> tuple[StreamReader, StreamWriter]: ...
|
||||
async def start_server(
|
||||
client_connected_cb: _ClientConnectedCallback,
|
||||
host: str | Sequence[str] | None = None,
|
||||
port: int | str | None = None,
|
||||
*,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
**kwds: Any,
|
||||
) -> Server: ...
|
||||
|
||||
else:
|
||||
async def open_connection(
|
||||
host: str | None = None,
|
||||
port: int | str | None = None,
|
||||
*,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
**kwds: Any,
|
||||
) -> tuple[StreamReader, StreamWriter]: ...
|
||||
async def start_server(
|
||||
client_connected_cb: _ClientConnectedCallback,
|
||||
host: str | None = None,
|
||||
port: int | str | None = None,
|
||||
*,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
limit: int = 65536,
|
||||
ssl_handshake_timeout: float | None = ...,
|
||||
**kwds: Any,
|
||||
) -> Server: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
if sys.version_info >= (3, 10):
|
||||
async def open_unix_connection(
|
||||
path: StrPath | None = None, *, limit: int = 65536, **kwds: Any
|
||||
) -> tuple[StreamReader, StreamWriter]: ...
|
||||
async def start_unix_server(
|
||||
client_connected_cb: _ClientConnectedCallback, path: StrPath | None = None, *, limit: int = 65536, **kwds: Any
|
||||
) -> Server: ...
|
||||
else:
|
||||
async def open_unix_connection(
|
||||
path: StrPath | None = None, *, loop: events.AbstractEventLoop | None = None, limit: int = 65536, **kwds: Any
|
||||
) -> tuple[StreamReader, StreamWriter]: ...
|
||||
async def start_unix_server(
|
||||
client_connected_cb: _ClientConnectedCallback,
|
||||
path: StrPath | None = None,
|
||||
*,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
limit: int = 65536,
|
||||
**kwds: Any,
|
||||
) -> Server: ...
|
||||
|
||||
class FlowControlMixin(protocols.Protocol):
|
||||
def __init__(self, loop: events.AbstractEventLoop | None = None) -> None: ...
|
||||
|
||||
class StreamReaderProtocol(FlowControlMixin, protocols.Protocol):
|
||||
def __init__(
|
||||
self,
|
||||
stream_reader: StreamReader,
|
||||
client_connected_cb: _ClientConnectedCallback | None = None,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
class StreamWriter:
|
||||
def __init__(
|
||||
self,
|
||||
transport: transports.WriteTransport,
|
||||
protocol: protocols.BaseProtocol,
|
||||
reader: StreamReader | None,
|
||||
loop: events.AbstractEventLoop,
|
||||
) -> None: ...
|
||||
@property
|
||||
def transport(self) -> transports.WriteTransport: ...
|
||||
def write(self, data: bytes | bytearray | memoryview) -> None: ...
|
||||
def writelines(self, data: Iterable[bytes | bytearray | memoryview]) -> None: ...
|
||||
def write_eof(self) -> None: ...
|
||||
def can_write_eof(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
def is_closing(self) -> bool: ...
|
||||
async def wait_closed(self) -> None: ...
|
||||
def get_extra_info(self, name: str, default: Any = None) -> Any: ...
|
||||
async def drain(self) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
async def start_tls(
|
||||
self,
|
||||
sslcontext: ssl.SSLContext,
|
||||
*,
|
||||
server_hostname: str | None = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
) -> None: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
async def start_tls(
|
||||
self, sslcontext: ssl.SSLContext, *, server_hostname: str | None = None, ssl_handshake_timeout: float | None = None
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
def __del__(self, warnings: ModuleType = ...) -> None: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
def __del__(self) -> None: ...
|
||||
|
||||
class StreamReader:
|
||||
def __init__(self, limit: int = 65536, loop: events.AbstractEventLoop | None = None) -> None: ...
|
||||
def exception(self) -> Exception: ...
|
||||
def set_exception(self, exc: Exception) -> None: ...
|
||||
def set_transport(self, transport: transports.BaseTransport) -> None: ...
|
||||
def feed_eof(self) -> None: ...
|
||||
def at_eof(self) -> bool: ...
|
||||
def feed_data(self, data: Iterable[SupportsIndex]) -> None: ...
|
||||
async def readline(self) -> bytes: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
async def readuntil(self, separator: _ReaduntilBuffer | tuple[_ReaduntilBuffer, ...] = b"\n") -> bytes: ...
|
||||
else:
|
||||
async def readuntil(self, separator: _ReaduntilBuffer = b"\n") -> bytes: ...
|
||||
|
||||
async def read(self, n: int = -1) -> bytes: ...
|
||||
async def readexactly(self, n: int) -> bytes: ...
|
||||
def __aiter__(self) -> Self: ...
|
||||
async def __anext__(self) -> bytes: ...
|
||||
|
|
@ -1,230 +1,19 @@
|
|||
import subprocess
|
||||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from asyncio import events, protocols, streams, transports
|
||||
from collections.abc import Callable, Collection
|
||||
from typing import IO, Any, Literal
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("create_subprocess_exec", "create_subprocess_shell")
|
||||
|
||||
PIPE: int
|
||||
STDOUT: int
|
||||
DEVNULL: int
|
||||
|
||||
class SubprocessStreamProtocol(streams.FlowControlMixin, protocols.SubprocessProtocol):
|
||||
stdin: streams.StreamWriter | None
|
||||
stdout: streams.StreamReader | None
|
||||
stderr: streams.StreamReader | None
|
||||
def __init__(self, limit: int, loop: events.AbstractEventLoop) -> None: ...
|
||||
def pipe_data_received(self, fd: int, data: bytes | str) -> None: ...
|
||||
|
||||
class Process:
|
||||
stdin: streams.StreamWriter | None
|
||||
stdout: streams.StreamReader | None
|
||||
stderr: streams.StreamReader | None
|
||||
pid: int
|
||||
def __init__(
|
||||
self, transport: transports.BaseTransport, protocol: protocols.BaseProtocol, loop: events.AbstractEventLoop
|
||||
) -> None: ...
|
||||
@property
|
||||
def returncode(self) -> int | None: ...
|
||||
async def wait(self) -> int: ...
|
||||
def send_signal(self, signal: int) -> None: ...
|
||||
def terminate(self) -> None: ...
|
||||
def kill(self) -> None: ...
|
||||
async def communicate(self, input: bytes | bytearray | memoryview | None = None) -> tuple[bytes, bytes]: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
async def create_subprocess_shell(
|
||||
cmd: str | bytes,
|
||||
stdin: int | IO[Any] | None = None,
|
||||
stdout: int | IO[Any] | None = None,
|
||||
stderr: int | IO[Any] | None = None,
|
||||
limit: int = 65536,
|
||||
*,
|
||||
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[True] = True,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: StrOrBytesPath | None = None,
|
||||
preexec_fn: Callable[[], Any] | None = None,
|
||||
close_fds: bool = True,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: subprocess._ENV | None = None,
|
||||
startupinfo: Any | None = None,
|
||||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
umask: int = -1,
|
||||
process_group: int | None = None,
|
||||
pipesize: int = -1,
|
||||
) -> Process: ...
|
||||
async def create_subprocess_exec(
|
||||
program: StrOrBytesPath,
|
||||
*args: StrOrBytesPath,
|
||||
stdin: int | IO[Any] | None = None,
|
||||
stdout: int | IO[Any] | None = None,
|
||||
stderr: int | IO[Any] | None = None,
|
||||
limit: int = 65536,
|
||||
# These parameters are forced to these values by BaseEventLoop.subprocess_exec
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[False] = False,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: StrOrBytesPath | None = None,
|
||||
preexec_fn: Callable[[], Any] | None = None,
|
||||
close_fds: bool = True,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: subprocess._ENV | None = None,
|
||||
startupinfo: Any | None = None,
|
||||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
umask: int = -1,
|
||||
process_group: int | None = None,
|
||||
pipesize: int = -1,
|
||||
) -> Process: ...
|
||||
|
||||
elif sys.version_info >= (3, 10):
|
||||
async def create_subprocess_shell(
|
||||
cmd: str | bytes,
|
||||
stdin: int | IO[Any] | None = None,
|
||||
stdout: int | IO[Any] | None = None,
|
||||
stderr: int | IO[Any] | None = None,
|
||||
limit: int = 65536,
|
||||
*,
|
||||
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[True] = True,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: StrOrBytesPath | None = None,
|
||||
preexec_fn: Callable[[], Any] | None = None,
|
||||
close_fds: bool = True,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: subprocess._ENV | None = None,
|
||||
startupinfo: Any | None = None,
|
||||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
umask: int = -1,
|
||||
pipesize: int = -1,
|
||||
) -> Process: ...
|
||||
async def create_subprocess_exec(
|
||||
program: StrOrBytesPath,
|
||||
*args: StrOrBytesPath,
|
||||
stdin: int | IO[Any] | None = None,
|
||||
stdout: int | IO[Any] | None = None,
|
||||
stderr: int | IO[Any] | None = None,
|
||||
limit: int = 65536,
|
||||
# These parameters are forced to these values by BaseEventLoop.subprocess_exec
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[False] = False,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: StrOrBytesPath | None = None,
|
||||
preexec_fn: Callable[[], Any] | None = None,
|
||||
close_fds: bool = True,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: subprocess._ENV | None = None,
|
||||
startupinfo: Any | None = None,
|
||||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
umask: int = -1,
|
||||
pipesize: int = -1,
|
||||
) -> Process: ...
|
||||
|
||||
else: # >= 3.9
|
||||
async def create_subprocess_shell(
|
||||
cmd: str | bytes,
|
||||
stdin: int | IO[Any] | None = None,
|
||||
stdout: int | IO[Any] | None = None,
|
||||
stderr: int | IO[Any] | None = None,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
limit: int = 65536,
|
||||
*,
|
||||
# These parameters are forced to these values by BaseEventLoop.subprocess_shell
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[True] = True,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: StrOrBytesPath | None = None,
|
||||
preexec_fn: Callable[[], Any] | None = None,
|
||||
close_fds: bool = True,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: subprocess._ENV | None = None,
|
||||
startupinfo: Any | None = None,
|
||||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
umask: int = -1,
|
||||
|
||||
) -> Process: ...
|
||||
async def create_subprocess_exec(
|
||||
program: StrOrBytesPath,
|
||||
*args: StrOrBytesPath,
|
||||
stdin: int | IO[Any] | None = None,
|
||||
stdout: int | IO[Any] | None = None,
|
||||
stderr: int | IO[Any] | None = None,
|
||||
loop: events.AbstractEventLoop | None = None,
|
||||
limit: int = 65536,
|
||||
# These parameters are forced to these values by BaseEventLoop.subprocess_exec
|
||||
universal_newlines: Literal[False] = False,
|
||||
shell: Literal[False] = False,
|
||||
bufsize: Literal[0] = 0,
|
||||
encoding: None = None,
|
||||
errors: None = None,
|
||||
text: Literal[False] | None = None,
|
||||
# These parameters are taken by subprocess.Popen, which this ultimately delegates to
|
||||
executable: StrOrBytesPath | None = None,
|
||||
preexec_fn: Callable[[], Any] | None = None,
|
||||
close_fds: bool = True,
|
||||
cwd: StrOrBytesPath | None = None,
|
||||
env: subprocess._ENV | None = None,
|
||||
startupinfo: Any | None = None,
|
||||
creationflags: int = 0,
|
||||
restore_signals: bool = True,
|
||||
start_new_session: bool = False,
|
||||
pass_fds: Collection[int] = ...,
|
||||
group: None | str | int = None,
|
||||
extra_groups: None | Collection[str | int] = None,
|
||||
user: None | str | int = None,
|
||||
umask: int = -1,
|
||||
|
||||
) -> Process: ...
|
||||
|
|
|
|||
|
|
@ -1,26 +0,0 @@
|
|||
import sys
|
||||
from contextvars import Context
|
||||
from types import TracebackType
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import Self
|
||||
|
||||
from . import _CoroutineLike
|
||||
from .events import AbstractEventLoop
|
||||
from .tasks import Task
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 12):
|
||||
__all__ = ("TaskGroup",)
|
||||
else:
|
||||
__all__ = ["TaskGroup"]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
class TaskGroup:
|
||||
_loop: AbstractEventLoop | None
|
||||
_tasks: set[Task[Any]]
|
||||
|
||||
async def __aenter__(self) -> Self: ...
|
||||
async def __aexit__(self, et: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
def create_task(self, coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None) -> Task[_T]: ...
|
||||
def _on_task_done(self, task: Task[object]) -> None: ...
|
||||
|
|
@ -1,22 +1,7 @@
|
|||
import concurrent.futures
|
||||
import sys
|
||||
from _asyncio import (
|
||||
Task as Task,
|
||||
_enter_task as _enter_task,
|
||||
_leave_task as _leave_task,
|
||||
_register_task as _register_task,
|
||||
_unregister_task as _unregister_task,
|
||||
)
|
||||
from collections.abc import AsyncIterator, Awaitable, Coroutine, Generator, Iterable, Iterator
|
||||
from typing import Any, Literal, Protocol, TypeVar, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
|
||||
from . import _CoroutineLike
|
||||
from .events import AbstractEventLoop
|
||||
from .futures import Future
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from contextvars import Context
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.version_info >= (3, 12):
|
||||
|
|
@ -66,395 +51,12 @@ else:
|
|||
"_leave_task",
|
||||
)
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_T1 = TypeVar("_T1")
|
||||
_T2 = TypeVar("_T2")
|
||||
_T3 = TypeVar("_T3")
|
||||
_T4 = TypeVar("_T4")
|
||||
_T5 = TypeVar("_T5")
|
||||
_T6 = TypeVar("_T6")
|
||||
_FT = TypeVar("_FT", bound=Future[Any])
|
||||
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
|
||||
FIRST_EXCEPTION = concurrent.futures.FIRST_EXCEPTION
|
||||
ALL_COMPLETED = concurrent.futures.ALL_COMPLETED
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
class _SyncAndAsyncIterator(Iterator[_T_co], AsyncIterator[_T_co], Protocol[_T_co]): ...
|
||||
|
||||
def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = None) -> _SyncAndAsyncIterator[Future[_T]]: ...
|
||||
|
||||
elif sys.version_info >= (3, 10):
|
||||
def as_completed(fs: Iterable[_FutureLike[_T]], *, timeout: float | None = None) -> Iterator[Future[_T]]: ...
|
||||
|
||||
else:
|
||||
def as_completed(
|
||||
fs: Iterable[_FutureLike[_T]], *, loop: AbstractEventLoop | None = None, timeout: float | None = None
|
||||
) -> Iterator[Future[_T]]: ...
|
||||
|
||||
@overload
|
||||
def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = None) -> _FT: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | None = None) -> Task[_T]: ...
|
||||
|
||||
# `gather()` actually returns a list with length equal to the number
|
||||
# of tasks passed; however, Tuple is used similar to the annotation for
|
||||
# zip() because typing does not support variadic type variables. See
|
||||
# typing PR #1550 for discussion.
|
||||
#
|
||||
# N.B. Having overlapping overloads is the only way to get acceptable type inference in all edge cases.
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureLike[_T1], /, *, return_exceptions: Literal[False] = False) -> Future[tuple[_T1]]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1], coro_or_future2: _FutureLike[_T2], /, *, return_exceptions: Literal[False] = False
|
||||
) -> Future[tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
coro_or_future5: _FutureLike[_T5],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
coro_or_future5: _FutureLike[_T5],
|
||||
coro_or_future6: _FutureLike[_T6],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
|
||||
@overload
|
||||
def gather(*coros_or_futures: _FutureLike[_T], return_exceptions: Literal[False] = False) -> Future[list[_T]]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def gather(coro_or_future1: _FutureLike[_T1], /, *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ...
|
||||
@overload
|
||||
def gather(
|
||||
coro_or_future1: _FutureLike[_T1], coro_or_future2: _FutureLike[_T2], /, *, return_exceptions: bool
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
|
||||
@overload
|
||||
def gather(
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
|
||||
@overload
|
||||
def gather(
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
|
||||
@overload
|
||||
def gather(
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
coro_or_future5: _FutureLike[_T5],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: bool,
|
||||
) -> Future[
|
||||
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
|
||||
]: ...
|
||||
@overload
|
||||
def gather(
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
coro_or_future5: _FutureLike[_T5],
|
||||
coro_or_future6: _FutureLike[_T6],
|
||||
/,
|
||||
*,
|
||||
return_exceptions: bool,
|
||||
) -> Future[
|
||||
tuple[
|
||||
_T1 | BaseException,
|
||||
_T2 | BaseException,
|
||||
_T3 | BaseException,
|
||||
_T4 | BaseException,
|
||||
_T5 | BaseException,
|
||||
_T6 | BaseException,
|
||||
]
|
||||
]: ...
|
||||
@overload
|
||||
def gather(*coros_or_futures: _FutureLike[_T], return_exceptions: bool) -> Future[list[_T | BaseException]]: ...
|
||||
|
||||
else:
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1], /, *, loop: AbstractEventLoop | None = None, return_exceptions: Literal[False] = False
|
||||
) -> Future[tuple[_T1]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
coro_or_future5: _FutureLike[_T5],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
coro_or_future5: _FutureLike[_T5],
|
||||
coro_or_future6: _FutureLike[_T6],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
*coros_or_futures: _FutureLike[_T], loop: AbstractEventLoop | None = None, return_exceptions: Literal[False] = False
|
||||
) -> Future[list[_T]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1], /, *, loop: AbstractEventLoop | None = None, return_exceptions: bool
|
||||
) -> Future[tuple[_T1 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
coro_or_future1: _FutureLike[_T1],
|
||||
coro_or_future2: _FutureLike[_T2],
|
||||
coro_or_future3: _FutureLike[_T3],
|
||||
coro_or_future4: _FutureLike[_T4],
|
||||
coro_or_future5: _FutureLike[_T5],
|
||||
coro_or_future6: _FutureLike[_T6],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
return_exceptions: bool,
|
||||
) -> Future[
|
||||
tuple[
|
||||
_T1 | BaseException,
|
||||
_T2 | BaseException,
|
||||
_T3 | BaseException,
|
||||
_T4 | BaseException,
|
||||
_T5 | BaseException,
|
||||
_T6 | BaseException,
|
||||
]
|
||||
]: ...
|
||||
@overload
|
||||
def gather(
|
||||
*coros_or_futures: _FutureLike[_T], loop: AbstractEventLoop | None = None, return_exceptions: bool
|
||||
) -> Future[list[_T | BaseException]]: ...
|
||||
|
||||
# unlike some asyncio apis, This does strict runtime checking of actually being a coroutine, not of any future-like.
|
||||
def run_coroutine_threadsafe(coro: Coroutine[Any, Any, _T], loop: AbstractEventLoop) -> concurrent.futures.Future[_T]: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
def shield(arg: _FutureLike[_T]) -> Future[_T]: ...
|
||||
@overload
|
||||
async def sleep(delay: float) -> None: ...
|
||||
@overload
|
||||
async def sleep(delay: float, result: _T) -> _T: ...
|
||||
async def wait_for(fut: _FutureLike[_T], timeout: float | None) -> _T: ...
|
||||
|
||||
else:
|
||||
def shield(arg: _FutureLike[_T], *, loop: AbstractEventLoop | None = None) -> Future[_T]: ...
|
||||
@overload
|
||||
async def sleep(delay: float, *, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
@overload
|
||||
async def sleep(delay: float, result: _T, *, loop: AbstractEventLoop | None = None) -> _T: ...
|
||||
async def wait_for(fut: _FutureLike[_T], timeout: float | None, *, loop: AbstractEventLoop | None = None) -> _T: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@overload
|
||||
async def wait(
|
||||
fs: Iterable[_FT], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
) -> tuple[set[_FT], set[_FT]]: ...
|
||||
@overload
|
||||
async def wait(
|
||||
fs: Iterable[Task[_T]], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
) -> tuple[set[Task[_T]], set[Task[_T]]]: ...
|
||||
|
||||
elif sys.version_info >= (3, 10):
|
||||
@overload
|
||||
async def wait( # type: ignore[overload-overlap]
|
||||
fs: Iterable[_FT], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
) -> tuple[set[_FT], set[_FT]]: ...
|
||||
@overload
|
||||
async def wait(
|
||||
fs: Iterable[Awaitable[_T]], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
) -> tuple[set[Task[_T]], set[Task[_T]]]: ...
|
||||
|
||||
else:
|
||||
@overload
|
||||
async def wait( # type: ignore[overload-overlap]
|
||||
fs: Iterable[_FT],
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
timeout: float | None = None,
|
||||
return_when: str = "ALL_COMPLETED",
|
||||
) -> tuple[set[_FT], set[_FT]]: ...
|
||||
@overload
|
||||
async def wait(
|
||||
fs: Iterable[Awaitable[_T]],
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
timeout: float | None = None,
|
||||
return_when: str = "ALL_COMPLETED",
|
||||
) -> tuple[set[Task[_T]], set[Task[_T]]]: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
_TaskCompatibleCoro: TypeAlias = Coroutine[Any, Any, _T_co]
|
||||
else:
|
||||
_TaskCompatibleCoro: TypeAlias = Generator[_TaskYieldType, None, _T_co] | Coroutine[Any, Any, _T_co]
|
||||
|
||||
def all_tasks(loop: AbstractEventLoop | None = None) -> set[Task[Any]]: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def create_task(coro: _CoroutineLike[_T], *, name: str | None = None, context: Context | None = None) -> Task[_T]: ...
|
||||
|
||||
else:
|
||||
def create_task(coro: _CoroutineLike[_T], *, name: str | None = None) -> Task[_T]: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
from _asyncio import current_task as current_task
|
||||
else:
|
||||
def current_task(loop: AbstractEventLoop | None = None) -> Task[Any] | None: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
_TaskT_co = TypeVar("_TaskT_co", bound=Task[Any], covariant=True)
|
||||
|
||||
class _CustomTaskConstructor(Protocol[_TaskT_co]):
|
||||
def __call__(
|
||||
self,
|
||||
coro: _TaskCompatibleCoro[Any],
|
||||
/,
|
||||
*,
|
||||
loop: AbstractEventLoop,
|
||||
name: str | None,
|
||||
context: Context | None,
|
||||
eager_start: bool,
|
||||
) -> _TaskT_co: ...
|
||||
|
||||
class _EagerTaskFactoryType(Protocol[_TaskT_co]):
|
||||
def __call__(
|
||||
self,
|
||||
loop: AbstractEventLoop,
|
||||
coro: _TaskCompatibleCoro[Any],
|
||||
*,
|
||||
name: str | None = None,
|
||||
context: Context | None = None,
|
||||
) -> _TaskT_co: ...
|
||||
|
||||
def create_eager_task_factory(
|
||||
custom_task_constructor: _CustomTaskConstructor[_TaskT_co],
|
||||
) -> _EagerTaskFactoryType[_TaskT_co]: ...
|
||||
def eager_task_factory(
|
||||
loop: AbstractEventLoop | None,
|
||||
coro: _TaskCompatibleCoro[_T_co],
|
||||
*,
|
||||
name: str | None = None,
|
||||
context: Context | None = None,
|
||||
) -> Task[_T_co]: ...
|
||||
|
|
|
|||
|
|
@ -1,10 +0,0 @@
|
|||
from collections.abc import Callable
|
||||
from typing import TypeVar
|
||||
from typing_extensions import ParamSpec
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("to_thread",)
|
||||
_P = ParamSpec("_P")
|
||||
_R = TypeVar("_R")
|
||||
|
||||
async def to_thread(func: Callable[_P, _R], /, *args: _P.args, **kwargs: _P.kwargs) -> _R: ...
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
from types import TracebackType
|
||||
from typing import final
|
||||
from typing_extensions import Self
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("Timeout", "timeout", "timeout_at")
|
||||
|
||||
@final
|
||||
class Timeout:
|
||||
def __init__(self, when: float | None) -> None: ...
|
||||
def when(self) -> float | None: ...
|
||||
def reschedule(self, when: float | None) -> None: ...
|
||||
def expired(self) -> bool: ...
|
||||
async def __aenter__(self) -> Self: ...
|
||||
async def __aexit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
def timeout(delay: float | None) -> Timeout: ...
|
||||
def timeout_at(when: float | None) -> Timeout: ...
|
||||
|
|
@ -1,50 +0,0 @@
|
|||
from asyncio.events import AbstractEventLoop
|
||||
from asyncio.protocols import BaseProtocol
|
||||
from collections.abc import Iterable, Mapping
|
||||
from socket import _Address
|
||||
from typing import Any
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
__all__ = ("BaseTransport", "ReadTransport", "WriteTransport", "Transport", "DatagramTransport", "SubprocessTransport")
|
||||
|
||||
class BaseTransport:
|
||||
def __init__(self, extra: Mapping[str, Any] | None = None) -> None: ...
|
||||
def get_extra_info(self, name: str, default: Any = None) -> Any: ...
|
||||
def is_closing(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
def set_protocol(self, protocol: BaseProtocol) -> None: ...
|
||||
def get_protocol(self) -> BaseProtocol: ...
|
||||
|
||||
class ReadTransport(BaseTransport):
|
||||
def is_reading(self) -> bool: ...
|
||||
def pause_reading(self) -> None: ...
|
||||
def resume_reading(self) -> None: ...
|
||||
|
||||
class WriteTransport(BaseTransport):
|
||||
def set_write_buffer_limits(self, high: int | None = None, low: int | None = None) -> None: ...
|
||||
def get_write_buffer_size(self) -> int: ...
|
||||
def get_write_buffer_limits(self) -> tuple[int, int]: ...
|
||||
def write(self, data: bytes | bytearray | memoryview[Any]) -> None: ... # any memoryview format or shape
|
||||
def writelines(
|
||||
self, list_of_data: Iterable[bytes | bytearray | memoryview[Any]]
|
||||
) -> None: ... # any memoryview format or shape
|
||||
def write_eof(self) -> None: ...
|
||||
def can_write_eof(self) -> bool: ...
|
||||
def abort(self) -> None: ...
|
||||
|
||||
class Transport(ReadTransport, WriteTransport): ...
|
||||
|
||||
class DatagramTransport(BaseTransport):
|
||||
def sendto(self, data: bytes | bytearray | memoryview, addr: _Address | None = None) -> None: ...
|
||||
def abort(self) -> None: ...
|
||||
|
||||
class SubprocessTransport(BaseTransport):
|
||||
def get_pid(self) -> int: ...
|
||||
def get_returncode(self) -> int | None: ...
|
||||
def get_pipe_transport(self, fd: int) -> BaseTransport | None: ...
|
||||
def send_signal(self, signal: int) -> None: ...
|
||||
def terminate(self) -> None: ...
|
||||
def kill(self) -> None: ...
|
||||
|
||||
class _FlowControlMixin(Transport):
|
||||
def __init__(self, extra: Mapping[str, Any] | None = None, loop: AbstractEventLoop | None = None) -> None: ...
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
import socket
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from builtins import type as Type # alias to avoid name clashes with property named "type"
|
||||
from collections.abc import Iterable
|
||||
from types import TracebackType
|
||||
from typing import Any, BinaryIO, NoReturn, overload
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
# These are based in socket, maybe move them out into _typeshed.pyi or such
|
||||
_Address: TypeAlias = socket._Address
|
||||
_RetAddress: TypeAlias = Any
|
||||
_WriteBuffer: TypeAlias = bytearray | memoryview
|
||||
_CMSG: TypeAlias = tuple[int, int, bytes]
|
||||
|
||||
class TransportSocket:
|
||||
def __init__(self, sock: socket.socket) -> None: ...
|
||||
@property
|
||||
def family(self) -> int: ...
|
||||
@property
|
||||
def type(self) -> int: ...
|
||||
@property
|
||||
def proto(self) -> int: ...
|
||||
def __getstate__(self) -> NoReturn: ...
|
||||
def fileno(self) -> int: ...
|
||||
def dup(self) -> socket.socket: ...
|
||||
def get_inheritable(self) -> bool: ...
|
||||
def shutdown(self, how: int) -> None: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int) -> int: ...
|
||||
@overload
|
||||
def getsockopt(self, level: int, optname: int, buflen: int) -> bytes: ...
|
||||
@overload
|
||||
def setsockopt(self, level: int, optname: int, value: int | ReadableBuffer) -> None: ...
|
||||
@overload
|
||||
def setsockopt(self, level: int, optname: int, value: None, optlen: int) -> None: ...
|
||||
def getpeername(self) -> _RetAddress: ...
|
||||
def getsockname(self) -> _RetAddress: ...
|
||||
def getsockbyname(self) -> NoReturn: ... # This method doesn't exist on socket, yet is passed through?
|
||||
def settimeout(self, value: float | None) -> None: ...
|
||||
def gettimeout(self) -> float | None: ...
|
||||
def setblocking(self, flag: bool) -> None: ...
|
||||
if sys.version_info < (3, 11):
|
||||
def _na(self, what: str) -> None: ...
|
||||
def accept(self) -> tuple[socket.socket, _RetAddress]: ...
|
||||
def connect(self, address: _Address) -> None: ...
|
||||
def connect_ex(self, address: _Address) -> int: ...
|
||||
def bind(self, address: _Address) -> None: ...
|
||||
if sys.platform == "win32":
|
||||
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> None: ...
|
||||
else:
|
||||
def ioctl(self, control: int, option: int | tuple[int, int, int] | bool) -> NoReturn: ...
|
||||
|
||||
def listen(self, backlog: int = ..., /) -> None: ...
|
||||
def makefile(self) -> BinaryIO: ...
|
||||
def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ...
|
||||
def close(self) -> None: ...
|
||||
def detach(self) -> int: ...
|
||||
if sys.platform == "linux":
|
||||
def sendmsg_afalg(
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
|
||||
) -> int: ...
|
||||
else:
|
||||
def sendmsg_afalg(
|
||||
self, msg: Iterable[ReadableBuffer] = ..., *, op: int, iv: Any = ..., assoclen: int = ..., flags: int = ...
|
||||
) -> NoReturn: ...
|
||||
|
||||
def sendmsg(
|
||||
self, buffers: Iterable[ReadableBuffer], ancdata: Iterable[_CMSG] = ..., flags: int = ..., address: _Address = ..., /
|
||||
) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: ReadableBuffer, address: _Address) -> int: ...
|
||||
@overload
|
||||
def sendto(self, data: ReadableBuffer, flags: int, address: _Address) -> int: ...
|
||||
def send(self, data: ReadableBuffer, flags: int = ...) -> int: ...
|
||||
def sendall(self, data: ReadableBuffer, flags: int = ...) -> None: ...
|
||||
def set_inheritable(self, inheritable: bool) -> None: ...
|
||||
if sys.platform == "win32":
|
||||
def share(self, process_id: int) -> bytes: ...
|
||||
else:
|
||||
def share(self, process_id: int) -> NoReturn: ...
|
||||
|
||||
def recv_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> int: ...
|
||||
def recvfrom_into(self, buffer: _WriteBuffer, nbytes: int = ..., flags: int = ...) -> tuple[int, _RetAddress]: ...
|
||||
def recvmsg_into(
|
||||
self, buffers: Iterable[_WriteBuffer], ancbufsize: int = ..., flags: int = ..., /
|
||||
) -> tuple[int, list[_CMSG], int, Any]: ...
|
||||
def recvmsg(self, bufsize: int, ancbufsize: int = ..., flags: int = ..., /) -> tuple[bytes, list[_CMSG], int, Any]: ...
|
||||
def recvfrom(self, bufsize: int, flags: int = ...) -> tuple[bytes, _RetAddress]: ...
|
||||
def recv(self, bufsize: int, flags: int = ...) -> bytes: ...
|
||||
def __enter__(self) -> socket.socket: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
|
@ -1,243 +0,0 @@
|
|||
import sys
|
||||
import types
|
||||
from _typeshed import StrPath
|
||||
from abc import ABCMeta, abstractmethod
|
||||
from collections.abc import Callable
|
||||
from socket import socket
|
||||
from typing import Literal
|
||||
from typing_extensions import Self, TypeVarTuple, Unpack, deprecated
|
||||
|
||||
from .base_events import Server, _ProtocolFactory, _SSLContext
|
||||
from .events import AbstractEventLoop, BaseDefaultEventLoopPolicy
|
||||
from .selector_events import BaseSelectorEventLoop
|
||||
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform != "win32":
|
||||
if sys.version_info >= (3, 14):
|
||||
__all__ = ("SelectorEventLoop", "DefaultEventLoopPolicy", "EventLoop")
|
||||
elif sys.version_info >= (3, 13):
|
||||
# Adds EventLoop
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"AbstractChildWatcher",
|
||||
"SafeChildWatcher",
|
||||
"FastChildWatcher",
|
||||
"PidfdChildWatcher",
|
||||
"MultiLoopChildWatcher",
|
||||
"ThreadedChildWatcher",
|
||||
"DefaultEventLoopPolicy",
|
||||
"EventLoop",
|
||||
)
|
||||
else:
|
||||
# adds PidfdChildWatcher
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"AbstractChildWatcher",
|
||||
"SafeChildWatcher",
|
||||
"FastChildWatcher",
|
||||
"PidfdChildWatcher",
|
||||
"MultiLoopChildWatcher",
|
||||
"ThreadedChildWatcher",
|
||||
"DefaultEventLoopPolicy",
|
||||
)
|
||||
|
||||
# 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, 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: ...
|
||||
|
||||
if sys.platform != "win32":
|
||||
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: ...
|
||||
|
||||
@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: ...
|
||||
|
||||
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 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):
|
||||
if sys.version_info >= (3, 13):
|
||||
async def create_unix_server(
|
||||
self,
|
||||
protocol_factory: _ProtocolFactory,
|
||||
path: StrPath | None = None,
|
||||
*,
|
||||
sock: socket | None = None,
|
||||
backlog: int = 100,
|
||||
ssl: _SSLContext = None,
|
||||
ssl_handshake_timeout: float | None = None,
|
||||
ssl_shutdown_timeout: float | None = None,
|
||||
start_serving: bool = True,
|
||||
cleanup_socket: bool = True,
|
||||
) -> Server: ...
|
||||
|
||||
class _UnixDefaultEventLoopPolicy(BaseDefaultEventLoopPolicy):
|
||||
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, 13):
|
||||
EventLoop = SelectorEventLoop
|
||||
|
||||
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: ...
|
||||
|
||||
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: ...
|
||||
|
|
@ -1,101 +0,0 @@
|
|||
import socket
|
||||
import sys
|
||||
from _typeshed import Incomplete, ReadableBuffer, WriteableBuffer
|
||||
from collections.abc import Callable
|
||||
from typing import IO, Any, ClassVar, Final, NoReturn
|
||||
|
||||
from . import events, futures, proactor_events, selector_events, streams, windows_utils
|
||||
|
||||
# Keep asyncio.__all__ updated with any changes to __all__ here
|
||||
if sys.platform == "win32":
|
||||
if sys.version_info >= (3, 13):
|
||||
# 3.13 added `EventLoop`.
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"ProactorEventLoop",
|
||||
"IocpProactor",
|
||||
"DefaultEventLoopPolicy",
|
||||
"WindowsSelectorEventLoopPolicy",
|
||||
"WindowsProactorEventLoopPolicy",
|
||||
"EventLoop",
|
||||
)
|
||||
else:
|
||||
__all__ = (
|
||||
"SelectorEventLoop",
|
||||
"ProactorEventLoop",
|
||||
"IocpProactor",
|
||||
"DefaultEventLoopPolicy",
|
||||
"WindowsSelectorEventLoopPolicy",
|
||||
"WindowsProactorEventLoopPolicy",
|
||||
)
|
||||
|
||||
NULL: Final = 0
|
||||
INFINITE: Final = 0xFFFFFFFF
|
||||
ERROR_CONNECTION_REFUSED: Final = 1225
|
||||
ERROR_CONNECTION_ABORTED: Final = 1236
|
||||
CONNECT_PIPE_INIT_DELAY: float
|
||||
CONNECT_PIPE_MAX_DELAY: float
|
||||
|
||||
class PipeServer:
|
||||
def __init__(self, address: str) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def closed(self) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
|
||||
class _WindowsSelectorEventLoop(selector_events.BaseSelectorEventLoop): ...
|
||||
|
||||
class ProactorEventLoop(proactor_events.BaseProactorEventLoop):
|
||||
def __init__(self, proactor: IocpProactor | None = None) -> None: ...
|
||||
async def create_pipe_connection(
|
||||
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
|
||||
) -> tuple[proactor_events._ProactorDuplexPipeTransport, streams.StreamReaderProtocol]: ...
|
||||
async def start_serving_pipe(
|
||||
self, protocol_factory: Callable[[], streams.StreamReaderProtocol], address: str
|
||||
) -> list[PipeServer]: ...
|
||||
|
||||
class IocpProactor:
|
||||
def __init__(self, concurrency: int = 0xFFFFFFFF) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def set_loop(self, loop: events.AbstractEventLoop) -> None: ...
|
||||
def select(self, timeout: int | None = None) -> list[futures.Future[Any]]: ...
|
||||
def recv(self, conn: socket.socket, nbytes: int, flags: int = 0) -> futures.Future[bytes]: ...
|
||||
def recv_into(self, conn: socket.socket, buf: WriteableBuffer, flags: int = 0) -> futures.Future[Any]: ...
|
||||
def recvfrom(
|
||||
self, conn: socket.socket, nbytes: int, flags: int = 0
|
||||
) -> futures.Future[tuple[bytes, socket._RetAddress]]: ...
|
||||
def sendto(
|
||||
self, conn: socket.socket, buf: ReadableBuffer, flags: int = 0, addr: socket._Address | None = None
|
||||
) -> futures.Future[int]: ...
|
||||
def send(self, conn: socket.socket, buf: WriteableBuffer, flags: int = 0) -> futures.Future[Any]: ...
|
||||
def accept(self, listener: socket.socket) -> futures.Future[Any]: ...
|
||||
def connect(
|
||||
self,
|
||||
conn: socket.socket,
|
||||
address: tuple[Incomplete, Incomplete] | tuple[Incomplete, Incomplete, Incomplete, Incomplete],
|
||||
) -> futures.Future[Any]: ...
|
||||
def sendfile(self, sock: socket.socket, file: IO[bytes], offset: int, count: int) -> futures.Future[Any]: ...
|
||||
def accept_pipe(self, pipe: socket.socket) -> futures.Future[Any]: ...
|
||||
async def connect_pipe(self, address: str) -> windows_utils.PipeHandle: ...
|
||||
def wait_for_handle(self, handle: windows_utils.PipeHandle, timeout: int | None = None) -> bool: ...
|
||||
def close(self) -> None: ...
|
||||
if sys.version_info >= (3, 11):
|
||||
def recvfrom_into(
|
||||
self, conn: socket.socket, buf: WriteableBuffer, flags: int = 0
|
||||
) -> futures.Future[tuple[int, socket._RetAddress]]: ...
|
||||
|
||||
SelectorEventLoop = _WindowsSelectorEventLoop
|
||||
|
||||
class WindowsSelectorEventLoopPolicy(events.BaseDefaultEventLoopPolicy):
|
||||
_loop_factory: ClassVar[type[SelectorEventLoop]]
|
||||
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]]
|
||||
def get_child_watcher(self) -> NoReturn: ...
|
||||
def set_child_watcher(self, watcher: Any) -> NoReturn: ...
|
||||
|
||||
DefaultEventLoopPolicy = WindowsSelectorEventLoopPolicy
|
||||
if sys.version_info >= (3, 13):
|
||||
EventLoop = ProactorEventLoop
|
||||
|
|
@ -1,49 +0,0 @@
|
|||
import subprocess
|
||||
import sys
|
||||
from collections.abc import Callable
|
||||
from types import TracebackType
|
||||
from typing import Any, AnyStr, Final
|
||||
from typing_extensions import Self
|
||||
|
||||
if sys.platform == "win32":
|
||||
__all__ = ("pipe", "Popen", "PIPE", "PipeHandle")
|
||||
|
||||
BUFSIZE: Final = 8192
|
||||
PIPE = subprocess.PIPE
|
||||
STDOUT = subprocess.STDOUT
|
||||
def pipe(*, duplex: bool = False, overlapped: tuple[bool, bool] = (True, True), bufsize: int = 8192) -> tuple[int, int]: ...
|
||||
|
||||
class PipeHandle:
|
||||
def __init__(self, handle: int) -> None: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, t: type[BaseException] | None, v: BaseException | None, tb: TracebackType | None) -> None: ...
|
||||
@property
|
||||
def handle(self) -> int: ...
|
||||
def fileno(self) -> int: ...
|
||||
def close(self, *, CloseHandle: Callable[[int], object] = ...) -> None: ...
|
||||
|
||||
class Popen(subprocess.Popen[AnyStr]):
|
||||
stdin: PipeHandle | None # type: ignore[assignment]
|
||||
stdout: PipeHandle | None # type: ignore[assignment]
|
||||
stderr: PipeHandle | None # type: ignore[assignment]
|
||||
# For simplicity we omit the full overloaded __new__ signature of
|
||||
# subprocess.Popen. The arguments are mostly the same, but
|
||||
# subprocess.Popen takes other positional-or-keyword arguments before
|
||||
# stdin.
|
||||
def __new__(
|
||||
cls,
|
||||
args: subprocess._CMD,
|
||||
stdin: subprocess._FILE | None = ...,
|
||||
stdout: subprocess._FILE | None = ...,
|
||||
stderr: subprocess._FILE | None = ...,
|
||||
**kwds: Any,
|
||||
) -> Self: ...
|
||||
def __init__(
|
||||
self,
|
||||
args: subprocess._CMD,
|
||||
stdin: subprocess._FILE | None = None,
|
||||
stdout: subprocess._FILE | None = None,
|
||||
stderr: subprocess._FILE | None = None,
|
||||
**kwds: Any,
|
||||
) -> None: ...
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
import sys
|
||||
|
||||
from ._base import (
|
||||
ALL_COMPLETED as ALL_COMPLETED,
|
||||
FIRST_COMPLETED as FIRST_COMPLETED,
|
||||
FIRST_EXCEPTION as FIRST_EXCEPTION,
|
||||
BrokenExecutor as BrokenExecutor,
|
||||
CancelledError as CancelledError,
|
||||
Executor as Executor,
|
||||
Future as Future,
|
||||
InvalidStateError as InvalidStateError,
|
||||
TimeoutError as TimeoutError,
|
||||
as_completed as as_completed,
|
||||
wait as wait,
|
||||
)
|
||||
from .process import ProcessPoolExecutor as ProcessPoolExecutor
|
||||
from .thread import ThreadPoolExecutor as ThreadPoolExecutor
|
||||
|
||||
if sys.version_info >= (3, 13):
|
||||
__all__ = (
|
||||
"FIRST_COMPLETED",
|
||||
"FIRST_EXCEPTION",
|
||||
"ALL_COMPLETED",
|
||||
"CancelledError",
|
||||
"TimeoutError",
|
||||
"InvalidStateError",
|
||||
"BrokenExecutor",
|
||||
"Future",
|
||||
"Executor",
|
||||
"wait",
|
||||
"as_completed",
|
||||
"ProcessPoolExecutor",
|
||||
"ThreadPoolExecutor",
|
||||
)
|
||||
else:
|
||||
__all__ = (
|
||||
"FIRST_COMPLETED",
|
||||
"FIRST_EXCEPTION",
|
||||
"ALL_COMPLETED",
|
||||
"CancelledError",
|
||||
"TimeoutError",
|
||||
"BrokenExecutor",
|
||||
"Future",
|
||||
"Executor",
|
||||
"wait",
|
||||
"as_completed",
|
||||
"ProcessPoolExecutor",
|
||||
"ThreadPoolExecutor",
|
||||
)
|
||||
|
||||
def __dir__() -> tuple[str, ...]: ...
|
||||
|
|
@ -1,108 +0,0 @@
|
|||
import sys
|
||||
import threading
|
||||
from _typeshed import Unused
|
||||
from collections.abc import Callable, Iterable, Iterator
|
||||
from logging import Logger
|
||||
from types import GenericAlias, TracebackType
|
||||
from typing import Any, Final, Generic, NamedTuple, Protocol, TypeVar
|
||||
from typing_extensions import ParamSpec, Self
|
||||
|
||||
FIRST_COMPLETED: Final = "FIRST_COMPLETED"
|
||||
FIRST_EXCEPTION: Final = "FIRST_EXCEPTION"
|
||||
ALL_COMPLETED: Final = "ALL_COMPLETED"
|
||||
PENDING: Final = "PENDING"
|
||||
RUNNING: Final = "RUNNING"
|
||||
CANCELLED: Final = "CANCELLED"
|
||||
CANCELLED_AND_NOTIFIED: Final = "CANCELLED_AND_NOTIFIED"
|
||||
FINISHED: Final = "FINISHED"
|
||||
_FUTURE_STATES: list[str]
|
||||
_STATE_TO_DESCRIPTION_MAP: dict[str, str]
|
||||
LOGGER: Logger
|
||||
|
||||
class Error(Exception): ...
|
||||
class CancelledError(Error): ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from builtins import TimeoutError as TimeoutError
|
||||
else:
|
||||
class TimeoutError(Error): ...
|
||||
|
||||
class InvalidStateError(Error): ...
|
||||
class BrokenExecutor(RuntimeError): ...
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
class Future(Generic[_T]):
|
||||
_condition: threading.Condition
|
||||
_state: str
|
||||
_result: _T | None
|
||||
_exception: BaseException | None
|
||||
_waiters: list[_Waiter]
|
||||
def cancel(self) -> bool: ...
|
||||
def cancelled(self) -> bool: ...
|
||||
def running(self) -> bool: ...
|
||||
def done(self) -> bool: ...
|
||||
def add_done_callback(self, fn: Callable[[Future[_T]], object]) -> None: ...
|
||||
def result(self, timeout: float | None = None) -> _T: ...
|
||||
def set_running_or_notify_cancel(self) -> bool: ...
|
||||
def set_result(self, result: _T) -> None: ...
|
||||
def exception(self, timeout: float | None = None) -> BaseException | None: ...
|
||||
def set_exception(self, exception: BaseException | None) -> None: ...
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
class Executor:
|
||||
def submit(self, fn: Callable[_P, _T], /, *args: _P.args, **kwargs: _P.kwargs) -> Future[_T]: ...
|
||||
def map(
|
||||
self, fn: Callable[..., _T], *iterables: Iterable[Any], timeout: float | None = None, chunksize: int = 1
|
||||
) -> Iterator[_T]: ...
|
||||
def shutdown(self, wait: bool = True, *, cancel_futures: bool = False) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> bool | None: ...
|
||||
|
||||
class _AsCompletedFuture(Protocol[_T_co]):
|
||||
# as_completed only mutates non-generic aspects of passed Futures and does not do any nominal
|
||||
# checks. Therefore, we can use a Protocol here to allow as_completed to act covariantly.
|
||||
# See the tests for concurrent.futures
|
||||
_condition: threading.Condition
|
||||
_state: str
|
||||
_waiters: list[_Waiter]
|
||||
# Not used by as_completed, but needed to propagate the generic type
|
||||
def result(self, timeout: float | None = None) -> _T_co: ...
|
||||
|
||||
def as_completed(fs: Iterable[_AsCompletedFuture[_T]], timeout: float | None = None) -> Iterator[Future[_T]]: ...
|
||||
|
||||
class DoneAndNotDoneFutures(NamedTuple, Generic[_T]):
|
||||
done: set[Future[_T]]
|
||||
not_done: set[Future[_T]]
|
||||
|
||||
def wait(
|
||||
fs: Iterable[Future[_T]], timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
) -> DoneAndNotDoneFutures[_T]: ...
|
||||
|
||||
class _Waiter:
|
||||
event: threading.Event
|
||||
finished_futures: list[Future[Any]]
|
||||
def add_result(self, future: Future[Any]) -> None: ...
|
||||
def add_exception(self, future: Future[Any]) -> None: ...
|
||||
def add_cancelled(self, future: Future[Any]) -> None: ...
|
||||
|
||||
class _AsCompletedWaiter(_Waiter):
|
||||
lock: threading.Lock
|
||||
|
||||
class _FirstCompletedWaiter(_Waiter): ...
|
||||
|
||||
class _AllCompletedWaiter(_Waiter):
|
||||
num_pending_calls: int
|
||||
stop_on_exception: bool
|
||||
lock: threading.Lock
|
||||
def __init__(self, num_pending_calls: int, stop_on_exception: bool) -> None: ...
|
||||
|
||||
class _AcquireFutures:
|
||||
futures: Iterable[Future[Any]]
|
||||
def __init__(self, futures: Iterable[Future[Any]]) -> None: ...
|
||||
def __enter__(self) -> None: ...
|
||||
def __exit__(self, *args: Unused) -> None: ...
|
||||
|
|
@ -1,238 +0,0 @@
|
|||
import sys
|
||||
from collections.abc import Callable, Generator, Iterable, Mapping, MutableMapping, MutableSequence
|
||||
from multiprocessing.connection import Connection
|
||||
from multiprocessing.context import BaseContext, Process
|
||||
from multiprocessing.queues import Queue, SimpleQueue
|
||||
from threading import Lock, Semaphore, Thread
|
||||
from types import TracebackType
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
from weakref import ref
|
||||
|
||||
from ._base import BrokenExecutor, Executor, Future
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
_threads_wakeups: MutableMapping[Any, Any]
|
||||
_global_shutdown: bool
|
||||
|
||||
class _ThreadWakeup:
|
||||
_closed: bool
|
||||
# Any: Unused send and recv methods
|
||||
_reader: Connection[Any, Any]
|
||||
_writer: Connection[Any, Any]
|
||||
def close(self) -> None: ...
|
||||
def wakeup(self) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
|
||||
def _python_exit() -> None: ...
|
||||
|
||||
EXTRA_QUEUED_CALLS: int
|
||||
|
||||
_MAX_WINDOWS_WORKERS: int
|
||||
|
||||
class _RemoteTraceback(Exception):
|
||||
tb: str
|
||||
def __init__(self, tb: TracebackType) -> None: ...
|
||||
|
||||
class _ExceptionWithTraceback:
|
||||
exc: BaseException
|
||||
tb: TracebackType
|
||||
def __init__(self, exc: BaseException, tb: TracebackType) -> None: ...
|
||||
def __reduce__(self) -> str | tuple[Any, ...]: ...
|
||||
|
||||
def _rebuild_exc(exc: Exception, tb: str) -> Exception: ...
|
||||
|
||||
class _WorkItem(Generic[_T]):
|
||||
future: Future[_T]
|
||||
fn: Callable[..., _T]
|
||||
args: Iterable[Any]
|
||||
kwargs: Mapping[str, Any]
|
||||
def __init__(self, future: Future[_T], fn: Callable[..., _T], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
|
||||
|
||||
class _ResultItem:
|
||||
work_id: int
|
||||
exception: Exception
|
||||
result: Any
|
||||
if sys.version_info >= (3, 11):
|
||||
exit_pid: int | None
|
||||
def __init__(
|
||||
self, work_id: int, exception: Exception | None = None, result: Any | None = None, exit_pid: int | None = None
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(self, work_id: int, exception: Exception | None = None, result: Any | None = None) -> None: ...
|
||||
|
||||
class _CallItem:
|
||||
work_id: int
|
||||
fn: Callable[..., Any]
|
||||
args: Iterable[Any]
|
||||
kwargs: Mapping[str, Any]
|
||||
def __init__(self, work_id: int, fn: Callable[..., Any], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
|
||||
|
||||
class _SafeQueue(Queue[Future[Any]]):
|
||||
pending_work_items: dict[int, _WorkItem[Any]]
|
||||
if sys.version_info < (3, 12):
|
||||
shutdown_lock: Lock
|
||||
thread_wakeup: _ThreadWakeup
|
||||
if sys.version_info >= (3, 12):
|
||||
def __init__(
|
||||
self,
|
||||
max_size: int | None = 0,
|
||||
*,
|
||||
ctx: BaseContext,
|
||||
pending_work_items: dict[int, _WorkItem[Any]],
|
||||
thread_wakeup: _ThreadWakeup,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
max_size: int | None = 0,
|
||||
*,
|
||||
ctx: BaseContext,
|
||||
pending_work_items: dict[int, _WorkItem[Any]],
|
||||
shutdown_lock: Lock,
|
||||
thread_wakeup: _ThreadWakeup,
|
||||
) -> None: ...
|
||||
|
||||
def _on_queue_feeder_error(self, e: Exception, obj: _CallItem) -> None: ...
|
||||
|
||||
def _get_chunks(*iterables: Any, chunksize: int) -> Generator[tuple[Any, ...], None, None]: ...
|
||||
def _process_chunk(fn: Callable[..., _T], chunk: Iterable[tuple[Any, ...]]) -> list[_T]: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def _sendback_result(
|
||||
result_queue: SimpleQueue[_WorkItem[Any]],
|
||||
work_id: int,
|
||||
result: Any | None = None,
|
||||
exception: Exception | None = None,
|
||||
exit_pid: int | None = None,
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
def _sendback_result(
|
||||
result_queue: SimpleQueue[_WorkItem[Any]], work_id: int, result: Any | None = None, exception: Exception | None = None
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def _process_worker(
|
||||
call_queue: Queue[_CallItem],
|
||||
result_queue: SimpleQueue[_ResultItem],
|
||||
initializer: Callable[[Unpack[_Ts]], object] | None,
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
max_tasks: int | None = None,
|
||||
) -> None: ...
|
||||
|
||||
else:
|
||||
def _process_worker(
|
||||
call_queue: Queue[_CallItem],
|
||||
result_queue: SimpleQueue[_ResultItem],
|
||||
initializer: Callable[[Unpack[_Ts]], object] | None,
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
) -> None: ...
|
||||
|
||||
class _ExecutorManagerThread(Thread):
|
||||
thread_wakeup: _ThreadWakeup
|
||||
shutdown_lock: Lock
|
||||
executor_reference: ref[Any]
|
||||
processes: MutableMapping[int, Process]
|
||||
call_queue: Queue[_CallItem]
|
||||
result_queue: SimpleQueue[_ResultItem]
|
||||
work_ids_queue: Queue[int]
|
||||
pending_work_items: dict[int, _WorkItem[Any]]
|
||||
def __init__(self, executor: ProcessPoolExecutor) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def add_call_item_to_queue(self) -> None: ...
|
||||
def wait_result_broken_or_wakeup(self) -> tuple[Any, bool, str]: ...
|
||||
def process_result_item(self, result_item: int | _ResultItem) -> None: ...
|
||||
def is_shutting_down(self) -> bool: ...
|
||||
def terminate_broken(self, cause: str) -> None: ...
|
||||
def flag_executor_shutting_down(self) -> None: ...
|
||||
def shutdown_workers(self) -> None: ...
|
||||
def join_executor_internals(self) -> None: ...
|
||||
def get_n_children_alive(self) -> int: ...
|
||||
|
||||
_system_limits_checked: bool
|
||||
_system_limited: bool | None
|
||||
|
||||
def _check_system_limits() -> None: ...
|
||||
def _chain_from_iterable_of_lists(iterable: Iterable[MutableSequence[Any]]) -> Any: ...
|
||||
|
||||
class BrokenProcessPool(BrokenExecutor): ...
|
||||
|
||||
class ProcessPoolExecutor(Executor):
|
||||
_mp_context: BaseContext | None
|
||||
_initializer: Callable[..., None] | None
|
||||
_initargs: tuple[Any, ...]
|
||||
_executor_manager_thread: _ThreadWakeup
|
||||
_processes: MutableMapping[int, Process]
|
||||
_shutdown_thread: bool
|
||||
_shutdown_lock: Lock
|
||||
_idle_worker_semaphore: Semaphore
|
||||
_broken: bool
|
||||
_queue_count: int
|
||||
_pending_work_items: dict[int, _WorkItem[Any]]
|
||||
_cancel_pending_futures: bool
|
||||
_executor_manager_thread_wakeup: _ThreadWakeup
|
||||
_result_queue: SimpleQueue[Any]
|
||||
_work_ids: Queue[Any]
|
||||
if sys.version_info >= (3, 11):
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None = None,
|
||||
mp_context: BaseContext | None = None,
|
||||
initializer: Callable[[], object] | None = None,
|
||||
initargs: tuple[()] = (),
|
||||
*,
|
||||
max_tasks_per_child: int | None = None,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None = None,
|
||||
mp_context: BaseContext | None = None,
|
||||
*,
|
||||
initializer: Callable[[Unpack[_Ts]], object],
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
max_tasks_per_child: int | None = None,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None,
|
||||
mp_context: BaseContext | None,
|
||||
initializer: Callable[[Unpack[_Ts]], object],
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
*,
|
||||
max_tasks_per_child: int | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None = None,
|
||||
mp_context: BaseContext | None = None,
|
||||
initializer: Callable[[], object] | None = None,
|
||||
initargs: tuple[()] = (),
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None = None,
|
||||
mp_context: BaseContext | None = None,
|
||||
*,
|
||||
initializer: Callable[[Unpack[_Ts]], object],
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None,
|
||||
mp_context: BaseContext | None,
|
||||
initializer: Callable[[Unpack[_Ts]], object],
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
) -> None: ...
|
||||
|
||||
def _start_executor_manager_thread(self) -> None: ...
|
||||
def _adjust_process_count(self) -> None: ...
|
||||
|
|
@ -1,76 +0,0 @@
|
|||
import queue
|
||||
from collections.abc import Callable, Iterable, Mapping, Set as AbstractSet
|
||||
from threading import Lock, Semaphore, Thread
|
||||
from types import GenericAlias
|
||||
from typing import Any, Generic, TypeVar, overload
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
from weakref import ref
|
||||
|
||||
from ._base import BrokenExecutor, Executor, Future
|
||||
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
_threads_queues: Mapping[Any, Any]
|
||||
_shutdown: bool
|
||||
_global_shutdown_lock: Lock
|
||||
|
||||
def _python_exit() -> None: ...
|
||||
|
||||
_S = TypeVar("_S")
|
||||
|
||||
class _WorkItem(Generic[_S]):
|
||||
future: Future[_S]
|
||||
fn: Callable[..., _S]
|
||||
args: Iterable[Any]
|
||||
kwargs: Mapping[str, Any]
|
||||
def __init__(self, future: Future[_S], fn: Callable[..., _S], args: Iterable[Any], kwargs: Mapping[str, Any]) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
def _worker(
|
||||
executor_reference: ref[Any],
|
||||
work_queue: queue.SimpleQueue[Any],
|
||||
initializer: Callable[[Unpack[_Ts]], object],
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
) -> None: ...
|
||||
|
||||
class BrokenThreadPool(BrokenExecutor): ...
|
||||
|
||||
class ThreadPoolExecutor(Executor):
|
||||
_max_workers: int
|
||||
_idle_semaphore: Semaphore
|
||||
_threads: AbstractSet[Thread]
|
||||
_broken: bool
|
||||
_shutdown: bool
|
||||
_shutdown_lock: Lock
|
||||
_thread_name_prefix: str | None
|
||||
_initializer: Callable[..., None] | None
|
||||
_initargs: tuple[Any, ...]
|
||||
_work_queue: queue.SimpleQueue[_WorkItem[Any]]
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None = None,
|
||||
thread_name_prefix: str = "",
|
||||
initializer: Callable[[], object] | None = None,
|
||||
initargs: tuple[()] = (),
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None = None,
|
||||
thread_name_prefix: str = "",
|
||||
*,
|
||||
initializer: Callable[[Unpack[_Ts]], object],
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self,
|
||||
max_workers: int | None,
|
||||
thread_name_prefix: str,
|
||||
initializer: Callable[[Unpack[_Ts]], object],
|
||||
initargs: tuple[Unpack[_Ts]],
|
||||
) -> None: ...
|
||||
def _adjust_thread_count(self) -> None: ...
|
||||
def _initializer_failed(self) -> None: ...
|
||||
|
|
@ -1,306 +0,0 @@
|
|||
import sys
|
||||
from _ctypes import (
|
||||
POINTER as POINTER,
|
||||
RTLD_GLOBAL as RTLD_GLOBAL,
|
||||
RTLD_LOCAL as RTLD_LOCAL,
|
||||
Array as Array,
|
||||
CFuncPtr as _CFuncPtr,
|
||||
Structure as Structure,
|
||||
Union as Union,
|
||||
_CanCastTo as _CanCastTo,
|
||||
_CArgObject as _CArgObject,
|
||||
_CData as _CData,
|
||||
_CDataType as _CDataType,
|
||||
_CField as _CField,
|
||||
_Pointer as _Pointer,
|
||||
_PointerLike as _PointerLike,
|
||||
_SimpleCData as _SimpleCData,
|
||||
addressof as addressof,
|
||||
alignment as alignment,
|
||||
byref as byref,
|
||||
get_errno as get_errno,
|
||||
pointer as pointer,
|
||||
resize as resize,
|
||||
set_errno as set_errno,
|
||||
sizeof as sizeof,
|
||||
)
|
||||
from _typeshed import StrPath
|
||||
from ctypes._endian import BigEndianStructure as BigEndianStructure, LittleEndianStructure as LittleEndianStructure
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Generic, Literal, TypeVar, type_check_only
|
||||
from typing_extensions import Self, TypeAlias, deprecated
|
||||
|
||||
if sys.platform == "win32":
|
||||
from _ctypes import FormatError as FormatError, get_last_error as get_last_error, set_last_error as set_last_error
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from ctypes._endian import BigEndianUnion as BigEndianUnion, LittleEndianUnion as LittleEndianUnion
|
||||
|
||||
_T = TypeVar("_T", default=Any)
|
||||
_DLLT = TypeVar("_DLLT", bound=CDLL)
|
||||
_CT = TypeVar("_CT", bound=_CData)
|
||||
|
||||
DEFAULT_MODE: int
|
||||
|
||||
class ArgumentError(Exception): ...
|
||||
|
||||
# defined within CDLL.__init__
|
||||
# Runtime name is ctypes.CDLL.__init__.<locals>._FuncPtr
|
||||
@type_check_only
|
||||
class _CDLLFuncPointer(_CFuncPtr):
|
||||
_flags_: ClassVar[int]
|
||||
_restype_: ClassVar[type[_CDataType]]
|
||||
|
||||
# Not a real class; _CDLLFuncPointer with a __name__ set on it.
|
||||
@type_check_only
|
||||
class _NamedFuncPointer(_CDLLFuncPointer):
|
||||
__name__: str
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
_NameTypes: TypeAlias = StrPath | None
|
||||
else:
|
||||
_NameTypes: TypeAlias = str | None
|
||||
|
||||
class CDLL:
|
||||
_func_flags_: ClassVar[int]
|
||||
_func_restype_: ClassVar[type[_CDataType]]
|
||||
_name: str
|
||||
_handle: int
|
||||
_FuncPtr: type[_CDLLFuncPointer]
|
||||
def __init__(
|
||||
self,
|
||||
name: _NameTypes,
|
||||
mode: int = ...,
|
||||
handle: int | None = None,
|
||||
use_errno: bool = False,
|
||||
use_last_error: bool = False,
|
||||
winmode: int | None = None,
|
||||
) -> None: ...
|
||||
def __getattr__(self, name: str) -> _NamedFuncPointer: ...
|
||||
def __getitem__(self, name_or_ordinal: str) -> _NamedFuncPointer: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
class OleDLL(CDLL): ...
|
||||
class WinDLL(CDLL): ...
|
||||
|
||||
class PyDLL(CDLL): ...
|
||||
|
||||
class LibraryLoader(Generic[_DLLT]):
|
||||
def __init__(self, dlltype: type[_DLLT]) -> None: ...
|
||||
def __getattr__(self, name: str) -> _DLLT: ...
|
||||
def __getitem__(self, name: str) -> _DLLT: ...
|
||||
def LoadLibrary(self, name: str) -> _DLLT: ...
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
cdll: LibraryLoader[CDLL]
|
||||
if sys.platform == "win32":
|
||||
windll: LibraryLoader[WinDLL]
|
||||
oledll: LibraryLoader[OleDLL]
|
||||
pydll: LibraryLoader[PyDLL]
|
||||
pythonapi: PyDLL
|
||||
|
||||
# Class definition within CFUNCTYPE / WINFUNCTYPE / PYFUNCTYPE
|
||||
# Names at runtime are
|
||||
# ctypes.CFUNCTYPE.<locals>.CFunctionType
|
||||
# ctypes.WINFUNCTYPE.<locals>.WinFunctionType
|
||||
# ctypes.PYFUNCTYPE.<locals>.CFunctionType
|
||||
@type_check_only
|
||||
class _CFunctionType(_CFuncPtr):
|
||||
_argtypes_: ClassVar[list[type[_CData | _CDataType]]]
|
||||
_restype_: ClassVar[type[_CData | _CDataType] | None]
|
||||
_flags_: ClassVar[int]
|
||||
|
||||
# Alias for either function pointer type
|
||||
_FuncPointer: TypeAlias = _CDLLFuncPointer | _CFunctionType # noqa: Y047 # not used here
|
||||
|
||||
def CFUNCTYPE(
|
||||
restype: type[_CData | _CDataType] | None,
|
||||
*argtypes: type[_CData | _CDataType],
|
||||
use_errno: bool = False,
|
||||
use_last_error: bool = False,
|
||||
) -> type[_CFunctionType]: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def WINFUNCTYPE(
|
||||
restype: type[_CData | _CDataType] | None,
|
||||
*argtypes: type[_CData | _CDataType],
|
||||
use_errno: bool = False,
|
||||
use_last_error: bool = False,
|
||||
) -> type[_CFunctionType]: ...
|
||||
|
||||
def PYFUNCTYPE(restype: type[_CData | _CDataType] | None, *argtypes: type[_CData | _CDataType]) -> type[_CFunctionType]: ...
|
||||
|
||||
# Any type that can be implicitly converted to c_void_p when passed as a C function argument.
|
||||
# (bytes is not included here, see below.)
|
||||
_CVoidPLike: TypeAlias = _PointerLike | Array[Any] | _CArgObject | int
|
||||
# Same as above, but including types known to be read-only (i. e. bytes).
|
||||
# This distinction is not strictly necessary (ctypes doesn't differentiate between const
|
||||
# and non-const pointers), but it catches errors like memmove(b'foo', buf, 4)
|
||||
# when memmove(buf, b'foo', 4) was intended.
|
||||
_CVoidConstPLike: TypeAlias = _CVoidPLike | bytes
|
||||
|
||||
_CastT = TypeVar("_CastT", bound=_CanCastTo)
|
||||
|
||||
def cast(obj: _CData | _CDataType | _CArgObject | int, typ: type[_CastT]) -> _CastT: ...
|
||||
def create_string_buffer(init: int | bytes, size: int | None = None) -> Array[c_char]: ...
|
||||
|
||||
c_buffer = create_string_buffer
|
||||
|
||||
def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_wchar]: ...
|
||||
@deprecated("Deprecated in Python 3.13; removal scheduled for Python 3.15")
|
||||
def SetPointerType(pointer: type[_Pointer[Any]], cls: Any) -> None: ... # noqa: F811
|
||||
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove
|
||||
|
||||
if sys.platform == "win32":
|
||||
def DllCanUnloadNow() -> int: ...
|
||||
def DllGetClassObject(rclsid: Any, riid: Any, ppv: Any) -> int: ... # TODO: not documented
|
||||
|
||||
# Actually just an instance of _NamedFuncPointer (aka _CDLLFuncPointer),
|
||||
# but we want to set a more specific __call__
|
||||
@type_check_only
|
||||
class _GetLastErrorFunctionType(_NamedFuncPointer):
|
||||
def __call__(self) -> int: ...
|
||||
|
||||
GetLastError: _GetLastErrorFunctionType
|
||||
|
||||
# Actually just an instance of _CFunctionType, but we want to set a more
|
||||
# specific __call__.
|
||||
@type_check_only
|
||||
class _MemmoveFunctionType(_CFunctionType):
|
||||
def __call__(self, dst: _CVoidPLike, src: _CVoidConstPLike, count: int) -> int: ...
|
||||
|
||||
memmove: _MemmoveFunctionType
|
||||
|
||||
# Actually just an instance of _CFunctionType, but we want to set a more
|
||||
# specific __call__.
|
||||
@type_check_only
|
||||
class _MemsetFunctionType(_CFunctionType):
|
||||
def __call__(self, dst: _CVoidPLike, c: int, count: int) -> int: ...
|
||||
|
||||
memset: _MemsetFunctionType
|
||||
|
||||
def string_at(ptr: _CVoidConstPLike, size: int = -1) -> bytes: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def WinError(code: int | None = None, descr: str | None = None) -> OSError: ...
|
||||
|
||||
def wstring_at(ptr: _CVoidConstPLike, size: int = -1) -> str: ...
|
||||
|
||||
class py_object(_CanCastTo, _SimpleCData[_T]):
|
||||
_type_: ClassVar[Literal["O"]]
|
||||
|
||||
class c_bool(_SimpleCData[bool]):
|
||||
_type_: ClassVar[Literal["?"]]
|
||||
def __init__(self, value: bool = ...) -> None: ...
|
||||
|
||||
class c_byte(_SimpleCData[int]):
|
||||
_type_: ClassVar[Literal["b"]]
|
||||
|
||||
class c_ubyte(_SimpleCData[int]):
|
||||
_type_: ClassVar[Literal["B"]]
|
||||
|
||||
class c_short(_SimpleCData[int]):
|
||||
_type_: ClassVar[Literal["h"]]
|
||||
|
||||
class c_ushort(_SimpleCData[int]):
|
||||
_type_: ClassVar[Literal["H"]]
|
||||
|
||||
class c_long(_SimpleCData[int]):
|
||||
_type_: ClassVar[Literal["l"]]
|
||||
|
||||
class c_ulong(_SimpleCData[int]):
|
||||
_type_: ClassVar[Literal["L"]]
|
||||
|
||||
class c_int(_SimpleCData[int]): # can be an alias for c_long
|
||||
_type_: ClassVar[Literal["i", "l"]]
|
||||
|
||||
class c_uint(_SimpleCData[int]): # can be an alias for c_ulong
|
||||
_type_: ClassVar[Literal["I", "L"]]
|
||||
|
||||
class c_longlong(_SimpleCData[int]): # can be an alias for c_long
|
||||
_type_: ClassVar[Literal["q", "l"]]
|
||||
|
||||
class c_ulonglong(_SimpleCData[int]): # can be an alias for c_ulong
|
||||
_type_: ClassVar[Literal["Q", "L"]]
|
||||
|
||||
c_int8 = c_byte
|
||||
c_uint8 = c_ubyte
|
||||
|
||||
class c_int16(_SimpleCData[int]): # can be an alias for c_short or c_int
|
||||
_type_: ClassVar[Literal["h", "i"]]
|
||||
|
||||
class c_uint16(_SimpleCData[int]): # can be an alias for c_ushort or c_uint
|
||||
_type_: ClassVar[Literal["H", "I"]]
|
||||
|
||||
class c_int32(_SimpleCData[int]): # can be an alias for c_int or c_long
|
||||
_type_: ClassVar[Literal["i", "l"]]
|
||||
|
||||
class c_uint32(_SimpleCData[int]): # can be an alias for c_uint or c_ulong
|
||||
_type_: ClassVar[Literal["I", "L"]]
|
||||
|
||||
class c_int64(_SimpleCData[int]): # can be an alias for c_long or c_longlong
|
||||
_type_: ClassVar[Literal["l", "q"]]
|
||||
|
||||
class c_uint64(_SimpleCData[int]): # can be an alias for c_ulong or c_ulonglong
|
||||
_type_: ClassVar[Literal["L", "Q"]]
|
||||
|
||||
class c_ssize_t(_SimpleCData[int]): # alias for c_int, c_long, or c_longlong
|
||||
_type_: ClassVar[Literal["i", "l", "q"]]
|
||||
|
||||
class c_size_t(_SimpleCData[int]): # alias for c_uint, c_ulong, or c_ulonglong
|
||||
_type_: ClassVar[Literal["I", "L", "Q"]]
|
||||
|
||||
class c_float(_SimpleCData[float]):
|
||||
_type_: ClassVar[Literal["f"]]
|
||||
|
||||
class c_double(_SimpleCData[float]):
|
||||
_type_: ClassVar[Literal["d"]]
|
||||
|
||||
class c_longdouble(_SimpleCData[float]): # can be an alias for c_double
|
||||
_type_: ClassVar[Literal["d", "g"]]
|
||||
|
||||
if sys.version_info >= (3, 14):
|
||||
class c_float_complex(_SimpleCData[complex]):
|
||||
_type_: ClassVar[Literal["E"]]
|
||||
|
||||
class c_double_complex(_SimpleCData[complex]):
|
||||
_type_: ClassVar[Literal["C"]]
|
||||
|
||||
class c_longdouble_complex(_SimpleCData[complex]):
|
||||
_type_: ClassVar[Literal["F"]]
|
||||
|
||||
class c_char(_SimpleCData[bytes]):
|
||||
_type_: ClassVar[Literal["c"]]
|
||||
def __init__(self, value: int | bytes | bytearray = ...) -> None: ...
|
||||
|
||||
class c_char_p(_PointerLike, _SimpleCData[bytes | None]):
|
||||
_type_: ClassVar[Literal["z"]]
|
||||
def __init__(self, value: int | bytes | None = ...) -> None: ...
|
||||
@classmethod
|
||||
def from_param(cls, value: Any, /) -> Self | _CArgObject: ...
|
||||
|
||||
class c_void_p(_PointerLike, _SimpleCData[int | None]):
|
||||
_type_: ClassVar[Literal["P"]]
|
||||
@classmethod
|
||||
def from_param(cls, value: Any, /) -> Self | _CArgObject: ...
|
||||
|
||||
c_voidp = c_void_p # backwards compatibility (to a bug)
|
||||
|
||||
class c_wchar(_SimpleCData[str]):
|
||||
_type_: ClassVar[Literal["u"]]
|
||||
|
||||
class c_wchar_p(_PointerLike, _SimpleCData[str | None]):
|
||||
_type_: ClassVar[Literal["Z"]]
|
||||
def __init__(self, value: int | str | None = ...) -> None: ...
|
||||
@classmethod
|
||||
def from_param(cls, value: Any, /) -> Self | _CArgObject: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
class HRESULT(_SimpleCData[int]): # TODO: undocumented
|
||||
_type_: ClassVar[Literal["l"]]
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
# At runtime, this is an alias for either c_int32 or c_int64,
|
||||
# which are themselves an alias for one of c_int, c_long, or c_longlong
|
||||
# This covers all our bases.
|
||||
c_time_t: type[c_int32 | c_int64 | c_int | c_long | c_longlong]
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
import sys
|
||||
from ctypes import Structure, Union
|
||||
|
||||
# At runtime, the native endianness is an alias for Structure,
|
||||
# while the other is a subclass with a metaclass added in.
|
||||
class BigEndianStructure(Structure): ...
|
||||
class LittleEndianStructure(Structure): ...
|
||||
|
||||
# Same thing for these: one is an alias of Union at runtime
|
||||
if sys.version_info >= (3, 11):
|
||||
class BigEndianUnion(Union): ...
|
||||
class LittleEndianUnion(Union): ...
|
||||
|
|
@ -1 +0,0 @@
|
|||
__version__: str
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
from collections.abc import Mapping
|
||||
from ctypes.macholib.dylib import dylib_info as dylib_info
|
||||
from ctypes.macholib.framework import framework_info as framework_info
|
||||
|
||||
__all__ = ["dyld_find", "framework_find", "framework_info", "dylib_info"]
|
||||
|
||||
def dyld_find(name: str, executable_path: str | None = None, env: Mapping[str, str] | None = None) -> str: ...
|
||||
def framework_find(fn: str, executable_path: str | None = None, env: Mapping[str, str] | None = None) -> str: ...
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
from typing import TypedDict, type_check_only
|
||||
|
||||
__all__ = ["dylib_info"]
|
||||
|
||||
# Actual result is produced by re.match.groupdict()
|
||||
@type_check_only
|
||||
class _DylibInfo(TypedDict):
|
||||
location: str
|
||||
name: str
|
||||
shortname: str
|
||||
version: str | None
|
||||
suffix: str | None
|
||||
|
||||
def dylib_info(filename: str) -> _DylibInfo | None: ...
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
from typing import TypedDict, type_check_only
|
||||
|
||||
__all__ = ["framework_info"]
|
||||
|
||||
# Actual result is produced by re.match.groupdict()
|
||||
@type_check_only
|
||||
class _FrameworkInfo(TypedDict):
|
||||
location: str
|
||||
name: str
|
||||
shortname: str
|
||||
version: str | None
|
||||
suffix: str | None
|
||||
|
||||
def framework_info(filename: str) -> _FrameworkInfo | None: ...
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
import sys
|
||||
|
||||
def find_library(name: str) -> str | None: ...
|
||||
|
||||
if sys.platform == "win32":
|
||||
def find_msvcrt() -> str | None: ...
|
||||
|
||||
def test() -> None: ...
|
||||
|
|
@ -1,312 +0,0 @@
|
|||
import sys
|
||||
from _ctypes import _CArgObject, _CField
|
||||
from ctypes import (
|
||||
Array,
|
||||
Structure,
|
||||
_Pointer,
|
||||
_SimpleCData,
|
||||
c_char,
|
||||
c_char_p,
|
||||
c_double,
|
||||
c_float,
|
||||
c_int,
|
||||
c_long,
|
||||
c_longlong,
|
||||
c_short,
|
||||
c_uint,
|
||||
c_ulong,
|
||||
c_ulonglong,
|
||||
c_ushort,
|
||||
c_void_p,
|
||||
c_wchar,
|
||||
c_wchar_p,
|
||||
)
|
||||
from typing import Any, TypeVar
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
from ctypes import c_ubyte
|
||||
|
||||
BYTE = c_ubyte
|
||||
else:
|
||||
from ctypes import c_byte
|
||||
|
||||
BYTE = c_byte
|
||||
|
||||
WORD = c_ushort
|
||||
DWORD = c_ulong
|
||||
CHAR = c_char
|
||||
WCHAR = c_wchar
|
||||
UINT = c_uint
|
||||
INT = c_int
|
||||
DOUBLE = c_double
|
||||
FLOAT = c_float
|
||||
BOOLEAN = BYTE
|
||||
BOOL = c_long
|
||||
|
||||
class VARIANT_BOOL(_SimpleCData[bool]): ...
|
||||
|
||||
ULONG = c_ulong
|
||||
LONG = c_long
|
||||
USHORT = c_ushort
|
||||
SHORT = c_short
|
||||
LARGE_INTEGER = c_longlong
|
||||
_LARGE_INTEGER = c_longlong
|
||||
ULARGE_INTEGER = c_ulonglong
|
||||
_ULARGE_INTEGER = c_ulonglong
|
||||
|
||||
OLESTR = c_wchar_p
|
||||
LPOLESTR = c_wchar_p
|
||||
LPCOLESTR = c_wchar_p
|
||||
LPWSTR = c_wchar_p
|
||||
LPCWSTR = c_wchar_p
|
||||
LPSTR = c_char_p
|
||||
LPCSTR = c_char_p
|
||||
LPVOID = c_void_p
|
||||
LPCVOID = c_void_p
|
||||
|
||||
# These two types are pointer-sized unsigned and signed ints, respectively.
|
||||
# At runtime, they are either c_[u]long or c_[u]longlong, depending on the host's pointer size
|
||||
# (they are not really separate classes).
|
||||
class WPARAM(_SimpleCData[int]): ...
|
||||
class LPARAM(_SimpleCData[int]): ...
|
||||
|
||||
ATOM = WORD
|
||||
LANGID = WORD
|
||||
COLORREF = DWORD
|
||||
LGRPID = DWORD
|
||||
LCTYPE = DWORD
|
||||
LCID = DWORD
|
||||
|
||||
HANDLE = c_void_p
|
||||
HACCEL = HANDLE
|
||||
HBITMAP = HANDLE
|
||||
HBRUSH = HANDLE
|
||||
HCOLORSPACE = HANDLE
|
||||
HDC = HANDLE
|
||||
HDESK = HANDLE
|
||||
HDWP = HANDLE
|
||||
HENHMETAFILE = HANDLE
|
||||
HFONT = HANDLE
|
||||
HGDIOBJ = HANDLE
|
||||
HGLOBAL = HANDLE
|
||||
HHOOK = HANDLE
|
||||
HICON = HANDLE
|
||||
HINSTANCE = HANDLE
|
||||
HKEY = HANDLE
|
||||
HKL = HANDLE
|
||||
HLOCAL = HANDLE
|
||||
HMENU = HANDLE
|
||||
HMETAFILE = HANDLE
|
||||
HMODULE = HANDLE
|
||||
HMONITOR = HANDLE
|
||||
HPALETTE = HANDLE
|
||||
HPEN = HANDLE
|
||||
HRGN = HANDLE
|
||||
HRSRC = HANDLE
|
||||
HSTR = HANDLE
|
||||
HTASK = HANDLE
|
||||
HWINSTA = HANDLE
|
||||
HWND = HANDLE
|
||||
SC_HANDLE = HANDLE
|
||||
SERVICE_STATUS_HANDLE = HANDLE
|
||||
|
||||
_CIntLikeT = TypeVar("_CIntLikeT", bound=_SimpleCData[int])
|
||||
_CIntLikeField: TypeAlias = _CField[_CIntLikeT, int, _CIntLikeT | int]
|
||||
|
||||
class RECT(Structure):
|
||||
left: _CIntLikeField[LONG]
|
||||
top: _CIntLikeField[LONG]
|
||||
right: _CIntLikeField[LONG]
|
||||
bottom: _CIntLikeField[LONG]
|
||||
|
||||
RECTL = RECT
|
||||
_RECTL = RECT
|
||||
tagRECT = RECT
|
||||
|
||||
class _SMALL_RECT(Structure):
|
||||
Left: _CIntLikeField[SHORT]
|
||||
Top: _CIntLikeField[SHORT]
|
||||
Right: _CIntLikeField[SHORT]
|
||||
Bottom: _CIntLikeField[SHORT]
|
||||
|
||||
SMALL_RECT = _SMALL_RECT
|
||||
|
||||
class _COORD(Structure):
|
||||
X: _CIntLikeField[SHORT]
|
||||
Y: _CIntLikeField[SHORT]
|
||||
|
||||
class POINT(Structure):
|
||||
x: _CIntLikeField[LONG]
|
||||
y: _CIntLikeField[LONG]
|
||||
|
||||
POINTL = POINT
|
||||
_POINTL = POINT
|
||||
tagPOINT = POINT
|
||||
|
||||
class SIZE(Structure):
|
||||
cx: _CIntLikeField[LONG]
|
||||
cy: _CIntLikeField[LONG]
|
||||
|
||||
SIZEL = SIZE
|
||||
tagSIZE = SIZE
|
||||
|
||||
def RGB(red: int, green: int, blue: int) -> int: ...
|
||||
|
||||
class FILETIME(Structure):
|
||||
dwLowDateTime: _CIntLikeField[DWORD]
|
||||
dwHighDateTime: _CIntLikeField[DWORD]
|
||||
|
||||
_FILETIME = FILETIME
|
||||
|
||||
class MSG(Structure):
|
||||
hWnd: _CField[HWND, int | None, HWND | int | None]
|
||||
message: _CIntLikeField[UINT]
|
||||
wParam: _CIntLikeField[WPARAM]
|
||||
lParam: _CIntLikeField[LPARAM]
|
||||
time: _CIntLikeField[DWORD]
|
||||
pt: _CField[POINT, POINT, POINT]
|
||||
|
||||
tagMSG = MSG
|
||||
MAX_PATH: int
|
||||
|
||||
class WIN32_FIND_DATAA(Structure):
|
||||
dwFileAttributes: _CIntLikeField[DWORD]
|
||||
ftCreationTime: _CField[FILETIME, FILETIME, FILETIME]
|
||||
ftLastAccessTime: _CField[FILETIME, FILETIME, FILETIME]
|
||||
ftLastWriteTime: _CField[FILETIME, FILETIME, FILETIME]
|
||||
nFileSizeHigh: _CIntLikeField[DWORD]
|
||||
nFileSizeLow: _CIntLikeField[DWORD]
|
||||
dwReserved0: _CIntLikeField[DWORD]
|
||||
dwReserved1: _CIntLikeField[DWORD]
|
||||
cFileName: _CField[Array[CHAR], bytes, bytes]
|
||||
cAlternateFileName: _CField[Array[CHAR], bytes, bytes]
|
||||
|
||||
class WIN32_FIND_DATAW(Structure):
|
||||
dwFileAttributes: _CIntLikeField[DWORD]
|
||||
ftCreationTime: _CField[FILETIME, FILETIME, FILETIME]
|
||||
ftLastAccessTime: _CField[FILETIME, FILETIME, FILETIME]
|
||||
ftLastWriteTime: _CField[FILETIME, FILETIME, FILETIME]
|
||||
nFileSizeHigh: _CIntLikeField[DWORD]
|
||||
nFileSizeLow: _CIntLikeField[DWORD]
|
||||
dwReserved0: _CIntLikeField[DWORD]
|
||||
dwReserved1: _CIntLikeField[DWORD]
|
||||
cFileName: _CField[Array[WCHAR], str, str]
|
||||
cAlternateFileName: _CField[Array[WCHAR], str, str]
|
||||
|
||||
# These are all defined with the POINTER() function, which keeps a cache and will
|
||||
# return a previously created class if it can. The self-reported __name__
|
||||
# of these classes is f"LP_{typ.__name__}", where typ is the original class
|
||||
# passed in to the POINTER() function.
|
||||
|
||||
# LP_c_short
|
||||
class PSHORT(_Pointer[SHORT]): ...
|
||||
|
||||
# LP_c_ushort
|
||||
class PUSHORT(_Pointer[USHORT]): ...
|
||||
|
||||
PWORD = PUSHORT
|
||||
LPWORD = PUSHORT
|
||||
|
||||
# LP_c_long
|
||||
class PLONG(_Pointer[LONG]): ...
|
||||
|
||||
LPLONG = PLONG
|
||||
PBOOL = PLONG
|
||||
LPBOOL = PLONG
|
||||
|
||||
# LP_c_ulong
|
||||
class PULONG(_Pointer[ULONG]): ...
|
||||
|
||||
PDWORD = PULONG
|
||||
LPDWORD = PDWORD
|
||||
LPCOLORREF = PDWORD
|
||||
PLCID = PDWORD
|
||||
|
||||
# LP_c_int (or LP_c_long if int and long have the same size)
|
||||
class PINT(_Pointer[INT]): ...
|
||||
|
||||
LPINT = PINT
|
||||
|
||||
# LP_c_uint (or LP_c_ulong if int and long have the same size)
|
||||
class PUINT(_Pointer[UINT]): ...
|
||||
|
||||
LPUINT = PUINT
|
||||
|
||||
# LP_c_float
|
||||
class PFLOAT(_Pointer[FLOAT]): ...
|
||||
|
||||
# LP_c_longlong (or LP_c_long if long and long long have the same size)
|
||||
class PLARGE_INTEGER(_Pointer[LARGE_INTEGER]): ...
|
||||
|
||||
# LP_c_ulonglong (or LP_c_ulong if long and long long have the same size)
|
||||
class PULARGE_INTEGER(_Pointer[ULARGE_INTEGER]): ...
|
||||
|
||||
# LP_c_byte types
|
||||
class PBYTE(_Pointer[BYTE]): ...
|
||||
|
||||
LPBYTE = PBYTE
|
||||
PBOOLEAN = PBYTE
|
||||
|
||||
# LP_c_char
|
||||
class PCHAR(_Pointer[CHAR]):
|
||||
# this is inherited from ctypes.c_char_p, kind of.
|
||||
@classmethod
|
||||
def from_param(cls, value: Any, /) -> Self | _CArgObject: ...
|
||||
|
||||
# LP_c_wchar
|
||||
class PWCHAR(_Pointer[WCHAR]):
|
||||
# inherited from ctypes.c_wchar_p, kind of
|
||||
@classmethod
|
||||
def from_param(cls, value: Any, /) -> Self | _CArgObject: ...
|
||||
|
||||
# LP_c_void_p
|
||||
class PHANDLE(_Pointer[HANDLE]): ...
|
||||
|
||||
LPHANDLE = PHANDLE
|
||||
PHKEY = PHANDLE
|
||||
LPHKL = PHANDLE
|
||||
LPSC_HANDLE = PHANDLE
|
||||
|
||||
# LP_FILETIME
|
||||
class PFILETIME(_Pointer[FILETIME]): ...
|
||||
|
||||
LPFILETIME = PFILETIME
|
||||
|
||||
# LP_MSG
|
||||
class PMSG(_Pointer[MSG]): ...
|
||||
|
||||
LPMSG = PMSG
|
||||
|
||||
# LP_POINT
|
||||
class PPOINT(_Pointer[POINT]): ...
|
||||
|
||||
LPPOINT = PPOINT
|
||||
PPOINTL = PPOINT
|
||||
|
||||
# LP_RECT
|
||||
class PRECT(_Pointer[RECT]): ...
|
||||
|
||||
LPRECT = PRECT
|
||||
PRECTL = PRECT
|
||||
LPRECTL = PRECT
|
||||
|
||||
# LP_SIZE
|
||||
class PSIZE(_Pointer[SIZE]): ...
|
||||
|
||||
LPSIZE = PSIZE
|
||||
PSIZEL = PSIZE
|
||||
LPSIZEL = PSIZE
|
||||
|
||||
# LP__SMALL_RECT
|
||||
class PSMALL_RECT(_Pointer[SMALL_RECT]): ...
|
||||
|
||||
# LP_WIN32_FIND_DATAA
|
||||
class PWIN32_FIND_DATAA(_Pointer[WIN32_FIND_DATAA]): ...
|
||||
|
||||
LPWIN32_FIND_DATAA = PWIN32_FIND_DATAA
|
||||
|
||||
# LP_WIN32_FIND_DATAW
|
||||
class PWIN32_FIND_DATAW(_Pointer[WIN32_FIND_DATAW]): ...
|
||||
|
||||
LPWIN32_FIND_DATAW = PWIN32_FIND_DATAW
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
import sys
|
||||
from _curses import *
|
||||
from _curses import window as window
|
||||
from _typeshed import structseq
|
||||
from collections.abc import Callable
|
||||
from typing import Final, TypeVar, final, type_check_only
|
||||
from typing_extensions import Concatenate, ParamSpec
|
||||
|
||||
# NOTE: The _curses module is ordinarily only available on Unix, but the
|
||||
# windows-curses package makes it available on Windows as well with the same
|
||||
# contents.
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
# available after calling `curses.initscr()`
|
||||
LINES: int
|
||||
COLS: int
|
||||
|
||||
# available after calling `curses.start_color()`
|
||||
COLORS: int
|
||||
COLOR_PAIRS: int
|
||||
|
||||
def wrapper(func: Callable[Concatenate[window, _P], _T], /, *arg: _P.args, **kwds: _P.kwargs) -> _T: ...
|
||||
|
||||
# At runtime this class is unexposed and calls itself curses.ncurses_version.
|
||||
# That name would conflict with the actual curses.ncurses_version, which is
|
||||
# an instance of this class.
|
||||
@final
|
||||
@type_check_only
|
||||
class _ncurses_version(structseq[int], tuple[int, int, int]):
|
||||
if sys.version_info >= (3, 10):
|
||||
__match_args__: Final = ("major", "minor", "patch")
|
||||
|
||||
@property
|
||||
def major(self) -> int: ...
|
||||
@property
|
||||
def minor(self) -> int: ...
|
||||
@property
|
||||
def patch(self) -> int: ...
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
from typing import TypeVar
|
||||
|
||||
_CharT = TypeVar("_CharT", str, int)
|
||||
|
||||
NUL: int
|
||||
SOH: int
|
||||
STX: int
|
||||
ETX: int
|
||||
EOT: int
|
||||
ENQ: int
|
||||
ACK: int
|
||||
BEL: int
|
||||
BS: int
|
||||
TAB: int
|
||||
HT: int
|
||||
LF: int
|
||||
NL: int
|
||||
VT: int
|
||||
FF: int
|
||||
CR: int
|
||||
SO: int
|
||||
SI: int
|
||||
DLE: int
|
||||
DC1: int
|
||||
DC2: int
|
||||
DC3: int
|
||||
DC4: int
|
||||
NAK: int
|
||||
SYN: int
|
||||
ETB: int
|
||||
CAN: int
|
||||
EM: int
|
||||
SUB: int
|
||||
ESC: int
|
||||
FS: int
|
||||
GS: int
|
||||
RS: int
|
||||
US: int
|
||||
SP: int
|
||||
DEL: int
|
||||
|
||||
controlnames: list[int]
|
||||
|
||||
def isalnum(c: str | int) -> bool: ...
|
||||
def isalpha(c: str | int) -> bool: ...
|
||||
def isascii(c: str | int) -> bool: ...
|
||||
def isblank(c: str | int) -> bool: ...
|
||||
def iscntrl(c: str | int) -> bool: ...
|
||||
def isdigit(c: str | int) -> bool: ...
|
||||
def isgraph(c: str | int) -> bool: ...
|
||||
def islower(c: str | int) -> bool: ...
|
||||
def isprint(c: str | int) -> bool: ...
|
||||
def ispunct(c: str | int) -> bool: ...
|
||||
def isspace(c: str | int) -> bool: ...
|
||||
def isupper(c: str | int) -> bool: ...
|
||||
def isxdigit(c: str | int) -> bool: ...
|
||||
def isctrl(c: str | int) -> bool: ...
|
||||
def ismeta(c: str | int) -> bool: ...
|
||||
def ascii(c: _CharT) -> _CharT: ...
|
||||
def ctrl(c: _CharT) -> _CharT: ...
|
||||
def alt(c: _CharT) -> _CharT: ...
|
||||
def unctrl(c: str | int) -> str: ...
|
||||
|
|
@ -1 +0,0 @@
|
|||
def has_key(ch: int | str) -> bool: ...
|
||||
|
|
@ -1 +0,0 @@
|
|||
from _curses_panel import *
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
from _curses import window
|
||||
from collections.abc import Callable
|
||||
|
||||
def rectangle(win: window, uly: int, ulx: int, lry: int, lrx: int) -> None: ...
|
||||
|
||||
class Textbox:
|
||||
stripspaces: bool
|
||||
def __init__(self, win: window, insert_mode: bool = False) -> None: ...
|
||||
def edit(self, validate: Callable[[int], int] | None = None) -> str: ...
|
||||
def do_command(self, ch: str | int) -> None: ...
|
||||
def gather(self) -> str: ...
|
||||
|
|
@ -1,104 +0,0 @@
|
|||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from collections.abc import Iterator, MutableMapping
|
||||
from types import TracebackType
|
||||
from typing import Literal, type_check_only
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
__all__ = ["open", "whichdb", "error"]
|
||||
|
||||
_KeyType: TypeAlias = str | bytes
|
||||
_ValueType: TypeAlias = str | bytes | bytearray
|
||||
_TFlags: TypeAlias = Literal[
|
||||
"r",
|
||||
"w",
|
||||
"c",
|
||||
"n",
|
||||
"rf",
|
||||
"wf",
|
||||
"cf",
|
||||
"nf",
|
||||
"rs",
|
||||
"ws",
|
||||
"cs",
|
||||
"ns",
|
||||
"ru",
|
||||
"wu",
|
||||
"cu",
|
||||
"nu",
|
||||
"rfs",
|
||||
"wfs",
|
||||
"cfs",
|
||||
"nfs",
|
||||
"rfu",
|
||||
"wfu",
|
||||
"cfu",
|
||||
"nfu",
|
||||
"rsf",
|
||||
"wsf",
|
||||
"csf",
|
||||
"nsf",
|
||||
"rsu",
|
||||
"wsu",
|
||||
"csu",
|
||||
"nsu",
|
||||
"ruf",
|
||||
"wuf",
|
||||
"cuf",
|
||||
"nuf",
|
||||
"rus",
|
||||
"wus",
|
||||
"cus",
|
||||
"nus",
|
||||
"rfsu",
|
||||
"wfsu",
|
||||
"cfsu",
|
||||
"nfsu",
|
||||
"rfus",
|
||||
"wfus",
|
||||
"cfus",
|
||||
"nfus",
|
||||
"rsfu",
|
||||
"wsfu",
|
||||
"csfu",
|
||||
"nsfu",
|
||||
"rsuf",
|
||||
"wsuf",
|
||||
"csuf",
|
||||
"nsuf",
|
||||
"rufs",
|
||||
"wufs",
|
||||
"cufs",
|
||||
"nufs",
|
||||
"rusf",
|
||||
"wusf",
|
||||
"cusf",
|
||||
"nusf",
|
||||
]
|
||||
|
||||
class _Database(MutableMapping[_KeyType, bytes]):
|
||||
def close(self) -> None: ...
|
||||
def __getitem__(self, key: _KeyType) -> bytes: ...
|
||||
def __setitem__(self, key: _KeyType, value: _ValueType) -> None: ...
|
||||
def __delitem__(self, key: _KeyType) -> None: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
# This class is not exposed. It calls itself dbm.error.
|
||||
@type_check_only
|
||||
class _error(Exception): ...
|
||||
|
||||
error: tuple[type[_error], type[OSError]]
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def whichdb(filename: StrOrBytesPath) -> str | None: ...
|
||||
def open(file: StrOrBytesPath, flag: _TFlags = "r", mode: int = 0o666) -> _Database: ...
|
||||
|
||||
else:
|
||||
def whichdb(filename: str) -> str | None: ...
|
||||
def open(file: str, flag: _TFlags = "r", mode: int = 0o666) -> _Database: ...
|
||||
|
|
@ -1,37 +0,0 @@
|
|||
import sys
|
||||
from _typeshed import StrOrBytesPath
|
||||
from collections.abc import Iterator, MutableMapping
|
||||
from types import TracebackType
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
__all__ = ["error", "open"]
|
||||
|
||||
_KeyType: TypeAlias = str | bytes
|
||||
_ValueType: TypeAlias = str | bytes
|
||||
|
||||
error = OSError
|
||||
|
||||
# This class doesn't exist at runtime. open() can return an instance of
|
||||
# any of the three implementations of dbm (dumb, gnu, ndbm), and this
|
||||
# class is intended to represent the common interface supported by all three.
|
||||
class _Database(MutableMapping[_KeyType, bytes]):
|
||||
def __init__(self, filebasename: str, mode: str, flag: str = "c") -> None: ...
|
||||
def sync(self) -> None: ...
|
||||
def iterkeys(self) -> Iterator[bytes]: ... # undocumented
|
||||
def close(self) -> None: ...
|
||||
def __getitem__(self, key: _KeyType) -> bytes: ...
|
||||
def __setitem__(self, key: _KeyType, val: _ValueType) -> None: ...
|
||||
def __delitem__(self, key: _KeyType) -> None: ...
|
||||
def __iter__(self) -> Iterator[bytes]: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __del__(self) -> None: ...
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def open(file: StrOrBytesPath, flag: str = "c", mode: int = 0o666) -> _Database: ...
|
||||
|
||||
else:
|
||||
def open(file: str, flag: str = "c", mode: int = 0o666) -> _Database: ...
|
||||
|
|
@ -1 +0,0 @@
|
|||
from _gdbm import *
|
||||
|
|
@ -1 +0,0 @@
|
|||
from _dbm import *
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
from _typeshed import ReadableBuffer, StrOrBytesPath, Unused
|
||||
from collections.abc import Generator, MutableMapping
|
||||
from typing import Final, Literal
|
||||
from typing_extensions import LiteralString, Self, TypeAlias
|
||||
|
||||
BUILD_TABLE: Final[LiteralString]
|
||||
GET_SIZE: Final[LiteralString]
|
||||
LOOKUP_KEY: Final[LiteralString]
|
||||
STORE_KV: Final[LiteralString]
|
||||
DELETE_KEY: Final[LiteralString]
|
||||
ITER_KEYS: Final[LiteralString]
|
||||
|
||||
_SqliteData: TypeAlias = str | ReadableBuffer | int | float
|
||||
|
||||
class error(OSError): ...
|
||||
|
||||
class _Database(MutableMapping[bytes, bytes]):
|
||||
def __init__(self, path: StrOrBytesPath, /, *, flag: Literal["r", "w", "c", "n"], mode: int) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, key: _SqliteData) -> bytes: ...
|
||||
def __setitem__(self, key: _SqliteData, value: _SqliteData) -> None: ...
|
||||
def __delitem__(self, key: _SqliteData) -> None: ...
|
||||
def __iter__(self) -> Generator[bytes]: ...
|
||||
def close(self) -> None: ...
|
||||
def keys(self) -> list[bytes]: ... # type: ignore[override]
|
||||
def __enter__(self) -> Self: ...
|
||||
def __exit__(self, *args: Unused) -> None: ...
|
||||
|
||||
def open(filename: StrOrBytesPath, /, flag: Literal["r", "w,", "c", "n"] = "r", mode: int = 0o666) -> _Database: ...
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
# Attempts to improve these stubs are probably not the best use of time:
|
||||
# - distutils is deleted in Python 3.12 and newer
|
||||
# - Most users already do not use stdlib distutils, due to setuptools monkeypatching
|
||||
# - We have very little quality assurance on these stubs, since due to the two above issues
|
||||
# we allowlist all distutils errors in stubtest.
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from distutils.ccompiler import CCompiler
|
||||
from typing import ClassVar, Final
|
||||
|
||||
PLAT_SPEC_TO_RUNTIME: Final[dict[str, str]]
|
||||
PLAT_TO_VCVARS: Final[dict[str, str]]
|
||||
|
||||
class MSVCCompiler(CCompiler):
|
||||
compiler_type: ClassVar[str]
|
||||
executables: ClassVar[dict[Incomplete, Incomplete]]
|
||||
res_extension: ClassVar[str]
|
||||
initialized: bool
|
||||
def initialize(self, plat_name: str | None = None) -> None: ...
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
from _typeshed import StrOrBytesPath, StrPath
|
||||
from typing import Literal, overload
|
||||
|
||||
@overload
|
||||
def make_archive(
|
||||
base_name: str,
|
||||
format: str,
|
||||
root_dir: StrOrBytesPath | None = None,
|
||||
base_dir: str | None = None,
|
||||
verbose: bool | Literal[0, 1] = 0,
|
||||
dry_run: bool | Literal[0, 1] = 0,
|
||||
owner: str | None = None,
|
||||
group: str | None = None,
|
||||
) -> str: ...
|
||||
@overload
|
||||
def make_archive(
|
||||
base_name: StrPath,
|
||||
format: str,
|
||||
root_dir: StrOrBytesPath,
|
||||
base_dir: str | None = None,
|
||||
verbose: bool | Literal[0, 1] = 0,
|
||||
dry_run: bool | Literal[0, 1] = 0,
|
||||
owner: str | None = None,
|
||||
group: str | None = None,
|
||||
) -> str: ...
|
||||
def make_tarball(
|
||||
base_name: str,
|
||||
base_dir: StrPath,
|
||||
compress: str | None = "gzip",
|
||||
verbose: bool | Literal[0, 1] = 0,
|
||||
dry_run: bool | Literal[0, 1] = 0,
|
||||
owner: str | None = None,
|
||||
group: str | None = None,
|
||||
) -> str: ...
|
||||
def make_zipfile(base_name: str, base_dir: str, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0) -> str: ...
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
from distutils.ccompiler import CCompiler
|
||||
|
||||
class BCPPCompiler(CCompiler): ...
|
||||
|
|
@ -1,176 +0,0 @@
|
|||
from _typeshed import BytesPath, StrPath, Unused
|
||||
from collections.abc import Callable, Iterable, Sequence
|
||||
from distutils.file_util import _BytesPathT, _StrPathT
|
||||
from typing import Literal, overload
|
||||
from typing_extensions import TypeAlias, TypeVarTuple, Unpack
|
||||
|
||||
_Macro: TypeAlias = tuple[str] | tuple[str, str | None]
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
def gen_lib_options(
|
||||
compiler: CCompiler, library_dirs: list[str], runtime_library_dirs: list[str], libraries: list[str]
|
||||
) -> list[str]: ...
|
||||
def gen_preprocess_options(macros: list[_Macro], include_dirs: list[str]) -> list[str]: ...
|
||||
def get_default_compiler(osname: str | None = None, platform: str | None = None) -> str: ...
|
||||
def new_compiler(
|
||||
plat: str | None = None,
|
||||
compiler: str | None = None,
|
||||
verbose: bool | Literal[0, 1] = 0,
|
||||
dry_run: bool | Literal[0, 1] = 0,
|
||||
force: bool | Literal[0, 1] = 0,
|
||||
) -> CCompiler: ...
|
||||
def show_compilers() -> None: ...
|
||||
|
||||
class CCompiler:
|
||||
dry_run: bool
|
||||
force: bool
|
||||
verbose: bool
|
||||
output_dir: str | None
|
||||
macros: list[_Macro]
|
||||
include_dirs: list[str]
|
||||
libraries: list[str]
|
||||
library_dirs: list[str]
|
||||
runtime_library_dirs: list[str]
|
||||
objects: list[str]
|
||||
def __init__(
|
||||
self, verbose: bool | Literal[0, 1] = 0, dry_run: bool | Literal[0, 1] = 0, force: bool | Literal[0, 1] = 0
|
||||
) -> None: ...
|
||||
def add_include_dir(self, dir: str) -> None: ...
|
||||
def set_include_dirs(self, dirs: list[str]) -> None: ...
|
||||
def add_library(self, libname: str) -> None: ...
|
||||
def set_libraries(self, libnames: list[str]) -> None: ...
|
||||
def add_library_dir(self, dir: str) -> None: ...
|
||||
def set_library_dirs(self, dirs: list[str]) -> None: ...
|
||||
def add_runtime_library_dir(self, dir: str) -> None: ...
|
||||
def set_runtime_library_dirs(self, dirs: list[str]) -> None: ...
|
||||
def define_macro(self, name: str, value: str | None = None) -> None: ...
|
||||
def undefine_macro(self, name: str) -> None: ...
|
||||
def add_link_object(self, object: str) -> None: ...
|
||||
def set_link_objects(self, objects: list[str]) -> None: ...
|
||||
def detect_language(self, sources: str | list[str]) -> str | None: ...
|
||||
def find_library_file(self, dirs: list[str], lib: str, debug: bool | Literal[0, 1] = 0) -> str | None: ...
|
||||
def has_function(
|
||||
self,
|
||||
funcname: str,
|
||||
includes: list[str] | None = None,
|
||||
include_dirs: list[str] | None = None,
|
||||
libraries: list[str] | None = None,
|
||||
library_dirs: list[str] | None = None,
|
||||
) -> bool: ...
|
||||
def library_dir_option(self, dir: str) -> str: ...
|
||||
def library_option(self, lib: str) -> str: ...
|
||||
def runtime_library_dir_option(self, dir: str) -> str: ...
|
||||
def set_executables(self, **args: str) -> None: ...
|
||||
def compile(
|
||||
self,
|
||||
sources: Sequence[StrPath],
|
||||
output_dir: str | None = None,
|
||||
macros: list[_Macro] | None = None,
|
||||
include_dirs: list[str] | None = None,
|
||||
debug: bool | Literal[0, 1] = 0,
|
||||
extra_preargs: list[str] | None = None,
|
||||
extra_postargs: list[str] | None = None,
|
||||
depends: list[str] | None = None,
|
||||
) -> list[str]: ...
|
||||
def create_static_lib(
|
||||
self,
|
||||
objects: list[str],
|
||||
output_libname: str,
|
||||
output_dir: str | None = None,
|
||||
debug: bool | Literal[0, 1] = 0,
|
||||
target_lang: str | None = None,
|
||||
) -> None: ...
|
||||
def link(
|
||||
self,
|
||||
target_desc: str,
|
||||
objects: list[str],
|
||||
output_filename: str,
|
||||
output_dir: str | None = None,
|
||||
libraries: list[str] | None = None,
|
||||
library_dirs: list[str] | None = None,
|
||||
runtime_library_dirs: list[str] | None = None,
|
||||
export_symbols: list[str] | None = None,
|
||||
debug: bool | Literal[0, 1] = 0,
|
||||
extra_preargs: list[str] | None = None,
|
||||
extra_postargs: list[str] | None = None,
|
||||
build_temp: str | None = None,
|
||||
target_lang: str | None = None,
|
||||
) -> None: ...
|
||||
def link_executable(
|
||||
self,
|
||||
objects: list[str],
|
||||
output_progname: str,
|
||||
output_dir: str | None = None,
|
||||
libraries: list[str] | None = None,
|
||||
library_dirs: list[str] | None = None,
|
||||
runtime_library_dirs: list[str] | None = None,
|
||||
debug: bool | Literal[0, 1] = 0,
|
||||
extra_preargs: list[str] | None = None,
|
||||
extra_postargs: list[str] | None = None,
|
||||
target_lang: str | None = None,
|
||||
) -> None: ...
|
||||
def link_shared_lib(
|
||||
self,
|
||||
objects: list[str],
|
||||
output_libname: str,
|
||||
output_dir: str | None = None,
|
||||
libraries: list[str] | None = None,
|
||||
library_dirs: list[str] | None = None,
|
||||
runtime_library_dirs: list[str] | None = None,
|
||||
export_symbols: list[str] | None = None,
|
||||
debug: bool | Literal[0, 1] = 0,
|
||||
extra_preargs: list[str] | None = None,
|
||||
extra_postargs: list[str] | None = None,
|
||||
build_temp: str | None = None,
|
||||
target_lang: str | None = None,
|
||||
) -> None: ...
|
||||
def link_shared_object(
|
||||
self,
|
||||
objects: list[str],
|
||||
output_filename: str,
|
||||
output_dir: str | None = None,
|
||||
libraries: list[str] | None = None,
|
||||
library_dirs: list[str] | None = None,
|
||||
runtime_library_dirs: list[str] | None = None,
|
||||
export_symbols: list[str] | None = None,
|
||||
debug: bool | Literal[0, 1] = 0,
|
||||
extra_preargs: list[str] | None = None,
|
||||
extra_postargs: list[str] | None = None,
|
||||
build_temp: str | None = None,
|
||||
target_lang: str | None = None,
|
||||
) -> None: ...
|
||||
def preprocess(
|
||||
self,
|
||||
source: str,
|
||||
output_file: str | None = None,
|
||||
macros: list[_Macro] | None = None,
|
||||
include_dirs: list[str] | None = None,
|
||||
extra_preargs: list[str] | None = None,
|
||||
extra_postargs: list[str] | None = None,
|
||||
) -> None: ...
|
||||
@overload
|
||||
def executable_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
|
||||
@overload
|
||||
def executable_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
|
||||
def library_filename(
|
||||
self, libname: str, lib_type: str = "static", strip_dir: bool | Literal[0, 1] = 0, output_dir: StrPath = ""
|
||||
) -> str: ...
|
||||
def object_filenames(
|
||||
self, source_filenames: Iterable[StrPath], strip_dir: bool | Literal[0, 1] = 0, output_dir: StrPath | None = ""
|
||||
) -> list[str]: ...
|
||||
@overload
|
||||
def shared_object_filename(self, basename: str, strip_dir: Literal[0, False] = 0, output_dir: StrPath = "") -> str: ...
|
||||
@overload
|
||||
def shared_object_filename(self, basename: StrPath, strip_dir: Literal[1, True], output_dir: StrPath = "") -> str: ...
|
||||
def execute(
|
||||
self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1
|
||||
) -> None: ...
|
||||
def spawn(self, cmd: Iterable[str]) -> None: ...
|
||||
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
|
||||
@overload
|
||||
def move_file(self, src: StrPath, dst: _StrPathT) -> _StrPathT | str: ...
|
||||
@overload
|
||||
def move_file(self, src: BytesPath, dst: _BytesPathT) -> _BytesPathT | bytes: ...
|
||||
def announce(self, msg: str, level: int = 1) -> None: ...
|
||||
def warn(self, msg: str) -> None: ...
|
||||
def debug_print(self, msg: str) -> None: ...
|
||||
|
|
@ -1,229 +0,0 @@
|
|||
from _typeshed import BytesPath, Incomplete, StrOrBytesPath, StrPath, Unused
|
||||
from abc import abstractmethod
|
||||
from collections.abc import Callable, Iterable
|
||||
from distutils.command.bdist import bdist
|
||||
from distutils.command.bdist_dumb import bdist_dumb
|
||||
from distutils.command.bdist_rpm import bdist_rpm
|
||||
from distutils.command.build import build
|
||||
from distutils.command.build_clib import build_clib
|
||||
from distutils.command.build_ext import build_ext
|
||||
from distutils.command.build_py import build_py
|
||||
from distutils.command.build_scripts import build_scripts
|
||||
from distutils.command.check import check
|
||||
from distutils.command.clean import clean
|
||||
from distutils.command.config import config
|
||||
from distutils.command.install import install
|
||||
from distutils.command.install_data import install_data
|
||||
from distutils.command.install_egg_info import install_egg_info
|
||||
from distutils.command.install_headers import install_headers
|
||||
from distutils.command.install_lib import install_lib
|
||||
from distutils.command.install_scripts import install_scripts
|
||||
from distutils.command.register import register
|
||||
from distutils.command.sdist import sdist
|
||||
from distutils.command.upload import upload
|
||||
from distutils.dist import Distribution
|
||||
from distutils.file_util import _BytesPathT, _StrPathT
|
||||
from typing import Any, ClassVar, Literal, TypeVar, overload
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
|
||||
_CommandT = TypeVar("_CommandT", bound=Command)
|
||||
_Ts = TypeVarTuple("_Ts")
|
||||
|
||||
class Command:
|
||||
dry_run: bool | Literal[0, 1] # Exposed from __getattr_. Same as Distribution.dry_run
|
||||
distribution: Distribution
|
||||
# Any to work around variance issues
|
||||
sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]]
|
||||
def __init__(self, dist: Distribution) -> None: ...
|
||||
@abstractmethod
|
||||
def initialize_options(self) -> None: ...
|
||||
@abstractmethod
|
||||
def finalize_options(self) -> None: ...
|
||||
@abstractmethod
|
||||
def run(self) -> None: ...
|
||||
def announce(self, msg: str, level: int = 1) -> None: ...
|
||||
def debug_print(self, msg: str) -> None: ...
|
||||
def ensure_string(self, option: str, default: str | None = None) -> None: ...
|
||||
def ensure_string_list(self, option: str) -> None: ...
|
||||
def ensure_filename(self, option: str) -> None: ...
|
||||
def ensure_dirname(self, option: str) -> None: ...
|
||||
def get_command_name(self) -> str: ...
|
||||
def set_undefined_options(self, src_cmd: str, *option_pairs: tuple[str, str]) -> None: ...
|
||||
# NOTE: This list comes directly from the distutils/command folder. Minus bdist_msi and bdist_wininst.
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["bdist"], create: bool | Literal[0, 1] = 1) -> bdist: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["bdist_dumb"], create: bool | Literal[0, 1] = 1) -> bdist_dumb: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["bdist_rpm"], create: bool | Literal[0, 1] = 1) -> bdist_rpm: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["build"], create: bool | Literal[0, 1] = 1) -> build: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["build_clib"], create: bool | Literal[0, 1] = 1) -> build_clib: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["build_ext"], create: bool | Literal[0, 1] = 1) -> build_ext: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["build_py"], create: bool | Literal[0, 1] = 1) -> build_py: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["build_scripts"], create: bool | Literal[0, 1] = 1) -> build_scripts: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["check"], create: bool | Literal[0, 1] = 1) -> check: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["clean"], create: bool | Literal[0, 1] = 1) -> clean: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["config"], create: bool | Literal[0, 1] = 1) -> config: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["install"], create: bool | Literal[0, 1] = 1) -> install: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["install_data"], create: bool | Literal[0, 1] = 1) -> install_data: ...
|
||||
@overload
|
||||
def get_finalized_command(
|
||||
self, command: Literal["install_egg_info"], create: bool | Literal[0, 1] = 1
|
||||
) -> install_egg_info: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["install_headers"], create: bool | Literal[0, 1] = 1) -> install_headers: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["install_lib"], create: bool | Literal[0, 1] = 1) -> install_lib: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["install_scripts"], create: bool | Literal[0, 1] = 1) -> install_scripts: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["register"], create: bool | Literal[0, 1] = 1) -> register: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["sdist"], create: bool | Literal[0, 1] = 1) -> sdist: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: Literal["upload"], create: bool | Literal[0, 1] = 1) -> upload: ...
|
||||
@overload
|
||||
def get_finalized_command(self, command: str, create: bool | Literal[0, 1] = 1) -> Command: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["bdist"], reinit_subcommands: bool | Literal[0, 1] = 0) -> bdist: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["bdist_dumb"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> bdist_dumb: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["bdist_rpm"], reinit_subcommands: bool | Literal[0, 1] = 0) -> bdist_rpm: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["build"], reinit_subcommands: bool | Literal[0, 1] = 0) -> build: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["build_clib"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> build_clib: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["build_ext"], reinit_subcommands: bool | Literal[0, 1] = 0) -> build_ext: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["build_py"], reinit_subcommands: bool | Literal[0, 1] = 0) -> build_py: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["build_scripts"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> build_scripts: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["check"], reinit_subcommands: bool | Literal[0, 1] = 0) -> check: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["clean"], reinit_subcommands: bool | Literal[0, 1] = 0) -> clean: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["config"], reinit_subcommands: bool | Literal[0, 1] = 0) -> config: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["install"], reinit_subcommands: bool | Literal[0, 1] = 0) -> install: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["install_data"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> install_data: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["install_egg_info"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> install_egg_info: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["install_headers"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> install_headers: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["install_lib"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> install_lib: ...
|
||||
@overload
|
||||
def reinitialize_command(
|
||||
self, command: Literal["install_scripts"], reinit_subcommands: bool | Literal[0, 1] = 0
|
||||
) -> install_scripts: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["register"], reinit_subcommands: bool | Literal[0, 1] = 0) -> register: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["sdist"], reinit_subcommands: bool | Literal[0, 1] = 0) -> sdist: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: Literal["upload"], reinit_subcommands: bool | Literal[0, 1] = 0) -> upload: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: str, reinit_subcommands: bool | Literal[0, 1] = 0) -> Command: ...
|
||||
@overload
|
||||
def reinitialize_command(self, command: _CommandT, reinit_subcommands: bool | Literal[0, 1] = 0) -> _CommandT: ...
|
||||
def run_command(self, command: str) -> None: ...
|
||||
def get_sub_commands(self) -> list[str]: ...
|
||||
def warn(self, msg: str) -> None: ...
|
||||
def execute(
|
||||
self, func: Callable[[Unpack[_Ts]], Unused], args: tuple[Unpack[_Ts]], msg: str | None = None, level: int = 1
|
||||
) -> None: ...
|
||||
def mkpath(self, name: str, mode: int = 0o777) -> None: ...
|
||||
@overload
|
||||
def copy_file(
|
||||
self,
|
||||
infile: StrPath,
|
||||
outfile: _StrPathT,
|
||||
preserve_mode: bool | Literal[0, 1] = 1,
|
||||
preserve_times: bool | Literal[0, 1] = 1,
|
||||
link: str | None = None,
|
||||
level: Unused = 1,
|
||||
) -> tuple[_StrPathT | str, bool]: ...
|
||||
@overload
|
||||
def copy_file(
|
||||
self,
|
||||
infile: BytesPath,
|
||||
outfile: _BytesPathT,
|
||||
preserve_mode: bool | Literal[0, 1] = 1,
|
||||
preserve_times: bool | Literal[0, 1] = 1,
|
||||
link: str | None = None,
|
||||
level: Unused = 1,
|
||||
) -> tuple[_BytesPathT | bytes, bool]: ...
|
||||
def copy_tree(
|
||||
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,
|
||||
level: Unused = 1,
|
||||
) -> list[str]: ...
|
||||
@overload
|
||||
def move_file(self, src: StrPath, dst: _StrPathT, level: Unused = 1) -> _StrPathT | str: ...
|
||||
@overload
|
||||
def move_file(self, src: BytesPath, dst: _BytesPathT, level: Unused = 1) -> _BytesPathT | bytes: ...
|
||||
def spawn(self, cmd: Iterable[str], search_path: bool | Literal[0, 1] = 1, level: Unused = 1) -> None: ...
|
||||
@overload
|
||||
def make_archive(
|
||||
self,
|
||||
base_name: str,
|
||||
format: str,
|
||||
root_dir: StrOrBytesPath | None = None,
|
||||
base_dir: str | None = None,
|
||||
owner: str | None = None,
|
||||
group: str | None = None,
|
||||
) -> str: ...
|
||||
@overload
|
||||
def make_archive(
|
||||
self,
|
||||
base_name: StrPath,
|
||||
format: str,
|
||||
root_dir: StrOrBytesPath,
|
||||
base_dir: str | None = None,
|
||||
owner: str | None = None,
|
||||
group: str | None = None,
|
||||
) -> str: ...
|
||||
def make_file(
|
||||
self,
|
||||
infiles: str | list[str] | tuple[str, ...],
|
||||
outfile: StrOrBytesPath,
|
||||
func: Callable[[Unpack[_Ts]], Unused],
|
||||
args: tuple[Unpack[_Ts]],
|
||||
exec_msg: str | None = None,
|
||||
skip_msg: str | None = None,
|
||||
level: Unused = 1,
|
||||
) -> None: ...
|
||||
def ensure_finalized(self) -> None: ...
|
||||
def dump_options(self, header: Incomplete | None = None, indent: str = "") -> None: ...
|
||||
|
|
@ -1,48 +0,0 @@
|
|||
import sys
|
||||
|
||||
from . import (
|
||||
bdist,
|
||||
bdist_dumb,
|
||||
bdist_rpm,
|
||||
build,
|
||||
build_clib,
|
||||
build_ext,
|
||||
build_py,
|
||||
build_scripts,
|
||||
check,
|
||||
clean,
|
||||
install,
|
||||
install_data,
|
||||
install_headers,
|
||||
install_lib,
|
||||
install_scripts,
|
||||
register,
|
||||
sdist,
|
||||
upload,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"build",
|
||||
"build_py",
|
||||
"build_ext",
|
||||
"build_clib",
|
||||
"build_scripts",
|
||||
"clean",
|
||||
"install",
|
||||
"install_lib",
|
||||
"install_headers",
|
||||
"install_scripts",
|
||||
"install_data",
|
||||
"sdist",
|
||||
"register",
|
||||
"bdist",
|
||||
"bdist_dumb",
|
||||
"bdist_rpm",
|
||||
"check",
|
||||
"upload",
|
||||
]
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
from . import bdist_wininst
|
||||
|
||||
__all__ += ["bdist_wininst"]
|
||||
|
|
@ -1,27 +0,0 @@
|
|||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
def show_formats() -> None: ...
|
||||
|
||||
class bdist(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
|
||||
no_format_option: ClassVar[tuple[str, ...]]
|
||||
default_format: ClassVar[dict[str, str]]
|
||||
format_commands: ClassVar[list[str]]
|
||||
format_command: ClassVar[dict[str, tuple[str, str]]]
|
||||
bdist_base: Incomplete
|
||||
plat_name: Incomplete
|
||||
formats: Incomplete
|
||||
dist_dir: Incomplete
|
||||
skip_build: int
|
||||
group: Incomplete
|
||||
owner: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
|
|
@ -1,22 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
class bdist_dumb(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
default_format: ClassVar[dict[str, str]]
|
||||
bdist_dir: Incomplete
|
||||
plat_name: Incomplete
|
||||
format: Incomplete
|
||||
keep_temp: int
|
||||
dist_dir: Incomplete
|
||||
skip_build: Incomplete
|
||||
relative: int
|
||||
owner: Incomplete
|
||||
group: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
import sys
|
||||
from _typeshed import Incomplete
|
||||
from typing import ClassVar, Literal
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
if sys.platform == "win32":
|
||||
from msilib import Control, Dialog
|
||||
|
||||
class PyDialog(Dialog):
|
||||
def __init__(self, *args, **kw) -> None: ...
|
||||
def title(self, title) -> None: ...
|
||||
def back(self, title, next, name: str = "Back", active: bool | Literal[0, 1] = 1) -> Control: ...
|
||||
def cancel(self, title, next, name: str = "Cancel", active: bool | Literal[0, 1] = 1) -> Control: ...
|
||||
def next(self, title, next, name: str = "Next", active: bool | Literal[0, 1] = 1) -> Control: ...
|
||||
def xbutton(self, name, title, next, xpos) -> Control: ...
|
||||
|
||||
class bdist_msi(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
all_versions: Incomplete
|
||||
other_version: str
|
||||
def __init__(self, *args, **kw) -> None: ...
|
||||
bdist_dir: Incomplete
|
||||
plat_name: Incomplete
|
||||
keep_temp: int
|
||||
no_target_compile: int
|
||||
no_target_optimize: int
|
||||
target_version: Incomplete
|
||||
dist_dir: Incomplete
|
||||
skip_build: Incomplete
|
||||
install_script: Incomplete
|
||||
pre_install_script: Incomplete
|
||||
versions: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
install_script_key: Incomplete
|
||||
def finalize_options(self) -> None: ...
|
||||
db: Incomplete
|
||||
def run(self) -> None: ...
|
||||
def add_files(self) -> None: ...
|
||||
def add_find_python(self) -> None: ...
|
||||
def add_scripts(self) -> None: ...
|
||||
def add_ui(self) -> None: ...
|
||||
def get_installer_filename(self, fullname): ...
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
class bdist_rpm(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
negative_opt: ClassVar[dict[str, str]]
|
||||
bdist_base: Incomplete
|
||||
rpm_base: Incomplete
|
||||
dist_dir: Incomplete
|
||||
python: Incomplete
|
||||
fix_python: Incomplete
|
||||
spec_only: Incomplete
|
||||
binary_only: Incomplete
|
||||
source_only: Incomplete
|
||||
use_bzip2: Incomplete
|
||||
distribution_name: Incomplete
|
||||
group: Incomplete
|
||||
release: Incomplete
|
||||
serial: Incomplete
|
||||
vendor: Incomplete
|
||||
packager: Incomplete
|
||||
doc_files: Incomplete
|
||||
changelog: Incomplete
|
||||
icon: Incomplete
|
||||
prep_script: Incomplete
|
||||
build_script: Incomplete
|
||||
install_script: Incomplete
|
||||
clean_script: Incomplete
|
||||
verify_script: Incomplete
|
||||
pre_install: Incomplete
|
||||
post_install: Incomplete
|
||||
pre_uninstall: Incomplete
|
||||
post_uninstall: Incomplete
|
||||
prep: Incomplete
|
||||
provides: Incomplete
|
||||
requires: Incomplete
|
||||
conflicts: Incomplete
|
||||
build_requires: Incomplete
|
||||
obsoletes: Incomplete
|
||||
keep_temp: int
|
||||
use_rpm_opt_flags: int
|
||||
rpm3_mode: int
|
||||
no_autoreq: int
|
||||
force_arch: Incomplete
|
||||
quiet: int
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def finalize_package_data(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
|
|
@ -1,16 +0,0 @@
|
|||
from _typeshed import StrOrBytesPath
|
||||
from distutils.cmd import Command
|
||||
from typing import ClassVar
|
||||
|
||||
class bdist_wininst(Command):
|
||||
description: ClassVar[str]
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def get_inidata(self) -> str: ...
|
||||
def create_exe(self, arcname: StrOrBytesPath, fullname: str, bitmap: StrOrBytesPath | None = None) -> None: ...
|
||||
def get_installer_filename(self, fullname: str) -> str: ...
|
||||
def get_exe_bytes(self) -> bytes: ...
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
def show_compilers() -> None: ...
|
||||
|
||||
class build(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
|
||||
build_base: str
|
||||
build_purelib: Incomplete
|
||||
build_platlib: Incomplete
|
||||
build_lib: Incomplete
|
||||
build_temp: Incomplete
|
||||
build_scripts: Incomplete
|
||||
compiler: Incomplete
|
||||
plat_name: Incomplete
|
||||
debug: Incomplete
|
||||
force: int
|
||||
executable: Incomplete
|
||||
parallel: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def has_pure_modules(self): ...
|
||||
def has_c_libraries(self): ...
|
||||
def has_ext_modules(self): ...
|
||||
def has_scripts(self): ...
|
||||
# Any to work around variance issues
|
||||
sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]]
|
||||
|
|
@ -1,29 +0,0 @@
|
|||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
def show_compilers() -> None: ...
|
||||
|
||||
class build_clib(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
|
||||
build_clib: Incomplete
|
||||
build_temp: Incomplete
|
||||
libraries: Incomplete
|
||||
include_dirs: Incomplete
|
||||
define: Incomplete
|
||||
undef: Incomplete
|
||||
debug: Incomplete
|
||||
force: int
|
||||
compiler: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def check_library_list(self, libraries) -> None: ...
|
||||
def get_library_names(self): ...
|
||||
def get_source_files(self): ...
|
||||
def build_libraries(self, libraries) -> None: ...
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Callable
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
extension_name_re: Incomplete
|
||||
|
||||
def show_compilers() -> None: ...
|
||||
|
||||
class build_ext(Command):
|
||||
description: str
|
||||
sep_by: Incomplete
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
|
||||
extensions: Incomplete
|
||||
build_lib: Incomplete
|
||||
plat_name: Incomplete
|
||||
build_temp: Incomplete
|
||||
inplace: int
|
||||
package: Incomplete
|
||||
include_dirs: Incomplete
|
||||
define: Incomplete
|
||||
undef: Incomplete
|
||||
libraries: Incomplete
|
||||
library_dirs: Incomplete
|
||||
rpath: Incomplete
|
||||
link_objects: Incomplete
|
||||
debug: Incomplete
|
||||
force: Incomplete
|
||||
compiler: Incomplete
|
||||
swig: Incomplete
|
||||
swig_cpp: Incomplete
|
||||
swig_opts: Incomplete
|
||||
user: Incomplete
|
||||
parallel: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def check_extensions_list(self, extensions) -> None: ...
|
||||
def get_source_files(self): ...
|
||||
def get_outputs(self): ...
|
||||
def build_extensions(self) -> None: ...
|
||||
def build_extension(self, ext) -> None: ...
|
||||
def swig_sources(self, sources, extension): ...
|
||||
def find_swig(self): ...
|
||||
def get_ext_fullpath(self, ext_name: str) -> str: ...
|
||||
def get_ext_fullname(self, ext_name: str) -> str: ...
|
||||
def get_ext_filename(self, ext_name: str) -> str: ...
|
||||
def get_export_symbols(self, ext): ...
|
||||
def get_libraries(self, ext): ...
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar, Literal
|
||||
|
||||
from ..cmd import Command
|
||||
from ..util import Mixin2to3 as Mixin2to3
|
||||
|
||||
class build_py(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
negative_opt: ClassVar[dict[str, str]]
|
||||
build_lib: Incomplete
|
||||
py_modules: Incomplete
|
||||
package: Incomplete
|
||||
package_data: Incomplete
|
||||
package_dir: Incomplete
|
||||
compile: int
|
||||
optimize: int
|
||||
force: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
packages: Incomplete
|
||||
data_files: Incomplete
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def get_data_files(self): ...
|
||||
def find_data_files(self, package, src_dir): ...
|
||||
def build_package_data(self) -> None: ...
|
||||
def get_package_dir(self, package): ...
|
||||
def check_package(self, package, package_dir): ...
|
||||
def check_module(self, module, module_file): ...
|
||||
def find_package_modules(self, package, package_dir): ...
|
||||
def find_modules(self): ...
|
||||
def find_all_modules(self): ...
|
||||
def get_source_files(self): ...
|
||||
def get_module_outfile(self, build_dir, package, module): ...
|
||||
def get_outputs(self, include_bytecode: bool | Literal[0, 1] = 1) -> list[str]: ...
|
||||
def build_module(self, module, module_file, package): ...
|
||||
def build_modules(self) -> None: ...
|
||||
def build_packages(self) -> None: ...
|
||||
def byte_compile(self, files) -> None: ...
|
||||
|
||||
class build_py_2to3(build_py, Mixin2to3):
|
||||
updated_files: Incomplete
|
||||
def run(self) -> None: ...
|
||||
def build_module(self, module, module_file, package): ...
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
from ..util import Mixin2to3 as Mixin2to3
|
||||
|
||||
first_line_re: Incomplete
|
||||
|
||||
class build_scripts(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
build_dir: Incomplete
|
||||
scripts: Incomplete
|
||||
force: Incomplete
|
||||
executable: Incomplete
|
||||
outfiles: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def get_source_files(self): ...
|
||||
def run(self) -> None: ...
|
||||
def copy_scripts(self): ...
|
||||
|
||||
class build_scripts_2to3(build_scripts, Mixin2to3):
|
||||
def copy_scripts(self): ...
|
||||
|
|
@ -1,40 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import Any, ClassVar, Final, Literal
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
_Reporter: TypeAlias = Any # really docutils.utils.Reporter
|
||||
|
||||
# Only defined if docutils is installed.
|
||||
# Depends on a third-party stub. Since distutils is deprecated anyway,
|
||||
# it's easier to just suppress the "any subclassing" error.
|
||||
class SilentReporter(_Reporter):
|
||||
messages: Incomplete
|
||||
def __init__(
|
||||
self,
|
||||
source,
|
||||
report_level,
|
||||
halt_level,
|
||||
stream: Incomplete | None = ...,
|
||||
debug: bool | Literal[0, 1] = 0,
|
||||
encoding: str = ...,
|
||||
error_handler: str = ...,
|
||||
) -> None: ...
|
||||
def system_message(self, level, message, *children, **kwargs): ...
|
||||
|
||||
HAS_DOCUTILS: Final[bool]
|
||||
|
||||
class check(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
restructuredtext: int
|
||||
metadata: int
|
||||
strict: int
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def warn(self, msg): ...
|
||||
def run(self) -> None: ...
|
||||
def check_metadata(self) -> None: ...
|
||||
def check_restructuredtext(self) -> None: ...
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
class clean(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
build_base: Incomplete
|
||||
build_lib: Incomplete
|
||||
build_temp: Incomplete
|
||||
build_scripts: Incomplete
|
||||
bdist_base: Incomplete
|
||||
all: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
|
|
@ -1,84 +0,0 @@
|
|||
from _typeshed import Incomplete, StrOrBytesPath
|
||||
from collections.abc import Sequence
|
||||
from re import Pattern
|
||||
from typing import ClassVar, Final, Literal
|
||||
|
||||
from ..ccompiler import CCompiler
|
||||
from ..cmd import Command
|
||||
|
||||
LANG_EXT: Final[dict[str, str]]
|
||||
|
||||
class config(Command):
|
||||
description: str
|
||||
# Tuple is full name, short name, description
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
compiler: str | CCompiler
|
||||
cc: str | None
|
||||
include_dirs: Sequence[str] | None
|
||||
libraries: Sequence[str] | None
|
||||
library_dirs: Sequence[str] | None
|
||||
noisy: int
|
||||
dump_source: int
|
||||
temp_files: Sequence[str]
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def try_cpp(
|
||||
self,
|
||||
body: str | None = None,
|
||||
headers: Sequence[str] | None = None,
|
||||
include_dirs: Sequence[str] | None = None,
|
||||
lang: str = "c",
|
||||
) -> bool: ...
|
||||
def search_cpp(
|
||||
self,
|
||||
pattern: Pattern[str] | str,
|
||||
body: str | None = None,
|
||||
headers: Sequence[str] | None = None,
|
||||
include_dirs: Sequence[str] | None = None,
|
||||
lang: str = "c",
|
||||
) -> bool: ...
|
||||
def try_compile(
|
||||
self, body: str, headers: Sequence[str] | None = None, include_dirs: Sequence[str] | None = None, lang: str = "c"
|
||||
) -> bool: ...
|
||||
def try_link(
|
||||
self,
|
||||
body: str,
|
||||
headers: Sequence[str] | None = None,
|
||||
include_dirs: Sequence[str] | None = None,
|
||||
libraries: Sequence[str] | None = None,
|
||||
library_dirs: Sequence[str] | None = None,
|
||||
lang: str = "c",
|
||||
) -> bool: ...
|
||||
def try_run(
|
||||
self,
|
||||
body: str,
|
||||
headers: Sequence[str] | None = None,
|
||||
include_dirs: Sequence[str] | None = None,
|
||||
libraries: Sequence[str] | None = None,
|
||||
library_dirs: Sequence[str] | None = None,
|
||||
lang: str = "c",
|
||||
) -> bool: ...
|
||||
def check_func(
|
||||
self,
|
||||
func: str,
|
||||
headers: Sequence[str] | None = None,
|
||||
include_dirs: Sequence[str] | None = None,
|
||||
libraries: Sequence[str] | None = None,
|
||||
library_dirs: Sequence[str] | None = None,
|
||||
decl: bool | Literal[0, 1] = 0,
|
||||
call: bool | Literal[0, 1] = 0,
|
||||
) -> bool: ...
|
||||
def check_lib(
|
||||
self,
|
||||
library: str,
|
||||
library_dirs: Sequence[str] | None = None,
|
||||
headers: Sequence[str] | None = None,
|
||||
include_dirs: Sequence[str] | None = None,
|
||||
other_libraries: list[str] = [],
|
||||
) -> bool: ...
|
||||
def check_header(
|
||||
self, header: str, include_dirs: Sequence[str] | None = None, library_dirs: Sequence[str] | None = None, lang: str = "c"
|
||||
) -> bool: ...
|
||||
|
||||
def dump_file(filename: StrOrBytesPath, head: Incomplete | None = None) -> None: ...
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
import sys
|
||||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar, Final, Literal
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
HAS_USER_SITE: Final[bool]
|
||||
|
||||
SCHEME_KEYS: Final[tuple[Literal["purelib"], Literal["platlib"], Literal["headers"], Literal["scripts"], Literal["data"]]]
|
||||
INSTALL_SCHEMES: Final[dict[str, dict[str, str]]]
|
||||
|
||||
if sys.version_info < (3, 10):
|
||||
WINDOWS_SCHEME: Final[dict[str, str]]
|
||||
|
||||
class install(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
negative_opt: ClassVar[dict[str, str]]
|
||||
prefix: str | None
|
||||
exec_prefix: Incomplete
|
||||
home: str | None
|
||||
user: bool
|
||||
install_base: Incomplete
|
||||
install_platbase: Incomplete
|
||||
root: str | None
|
||||
install_purelib: Incomplete
|
||||
install_platlib: Incomplete
|
||||
install_headers: Incomplete
|
||||
install_lib: str | None
|
||||
install_scripts: Incomplete
|
||||
install_data: Incomplete
|
||||
install_userbase: Incomplete
|
||||
install_usersite: Incomplete
|
||||
compile: Incomplete
|
||||
optimize: Incomplete
|
||||
extra_path: Incomplete
|
||||
install_path_file: int
|
||||
force: int
|
||||
skip_build: int
|
||||
warn_dir: int
|
||||
build_base: Incomplete
|
||||
build_lib: Incomplete
|
||||
record: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
config_vars: Incomplete
|
||||
install_libbase: Incomplete
|
||||
def finalize_options(self) -> None: ...
|
||||
def dump_dirs(self, msg) -> None: ...
|
||||
def finalize_unix(self) -> None: ...
|
||||
def finalize_other(self) -> None: ...
|
||||
def select_scheme(self, name) -> None: ...
|
||||
def expand_basedirs(self) -> None: ...
|
||||
def expand_dirs(self) -> None: ...
|
||||
def convert_paths(self, *names) -> None: ...
|
||||
path_file: Incomplete
|
||||
extra_dirs: Incomplete
|
||||
def handle_extra_path(self) -> None: ...
|
||||
def change_roots(self, *names) -> None: ...
|
||||
def create_home_path(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def create_path_file(self) -> None: ...
|
||||
def get_outputs(self): ...
|
||||
def get_inputs(self): ...
|
||||
def has_lib(self): ...
|
||||
def has_headers(self): ...
|
||||
def has_scripts(self): ...
|
||||
def has_data(self): ...
|
||||
# Any to work around variance issues
|
||||
sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]]
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
class install_data(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
install_dir: Incomplete
|
||||
outfiles: Incomplete
|
||||
root: Incomplete
|
||||
force: int
|
||||
data_files: Incomplete
|
||||
warn_dir: int
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def get_inputs(self): ...
|
||||
def get_outputs(self): ...
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
class install_egg_info(Command):
|
||||
description: ClassVar[str]
|
||||
user_options: ClassVar[list[tuple[str, str, str]]]
|
||||
install_dir: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
target: Incomplete
|
||||
outputs: Incomplete
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def get_outputs(self) -> list[str]: ...
|
||||
|
||||
def safe_name(name): ...
|
||||
def safe_version(version): ...
|
||||
def to_filename(name): ...
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
class install_headers(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
install_dir: Incomplete
|
||||
force: int
|
||||
outfiles: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def get_inputs(self): ...
|
||||
def get_outputs(self): ...
|
||||
|
|
@ -1,26 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar, Final
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
PYTHON_SOURCE_EXTENSION: Final = ".py"
|
||||
|
||||
class install_lib(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
negative_opt: ClassVar[dict[str, str]]
|
||||
install_dir: Incomplete
|
||||
build_dir: Incomplete
|
||||
force: int
|
||||
compile: Incomplete
|
||||
optimize: Incomplete
|
||||
skip_build: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def build(self) -> None: ...
|
||||
def install(self): ...
|
||||
def byte_compile(self, files) -> None: ...
|
||||
def get_outputs(self): ...
|
||||
def get_inputs(self): ...
|
||||
|
|
@ -1,19 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
class install_scripts(Command):
|
||||
description: str
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
install_dir: Incomplete
|
||||
force: int
|
||||
build_dir: Incomplete
|
||||
skip_build: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
outfiles: Incomplete
|
||||
def run(self) -> None: ...
|
||||
def get_inputs(self): ...
|
||||
def get_outputs(self): ...
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from ..config import PyPIRCCommand
|
||||
|
||||
class register(PyPIRCCommand):
|
||||
description: str
|
||||
# Any to work around variance issues
|
||||
sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]]
|
||||
list_classifiers: int
|
||||
strict: int
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def check_metadata(self) -> None: ...
|
||||
def classifiers(self) -> None: ...
|
||||
def verify_metadata(self) -> None: ...
|
||||
def send_metadata(self) -> None: ...
|
||||
def build_post_data(self, action): ...
|
||||
def post_to_server(self, data, auth: Incomplete | None = None): ...
|
||||
|
|
@ -1,45 +0,0 @@
|
|||
from _typeshed import Incomplete, Unused
|
||||
from collections.abc import Callable
|
||||
from typing import Any, ClassVar
|
||||
|
||||
from ..cmd import Command
|
||||
|
||||
def show_formats() -> None: ...
|
||||
|
||||
class sdist(Command):
|
||||
description: str
|
||||
def checking_metadata(self): ...
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
help_options: ClassVar[list[tuple[str, str | None, str, Callable[[], Unused]]]]
|
||||
negative_opt: ClassVar[dict[str, str]]
|
||||
# Any to work around variance issues
|
||||
sub_commands: ClassVar[list[tuple[str, Callable[[Any], bool] | None]]]
|
||||
READMES: ClassVar[tuple[str, ...]]
|
||||
template: Incomplete
|
||||
manifest: Incomplete
|
||||
use_defaults: int
|
||||
prune: int
|
||||
manifest_only: int
|
||||
force_manifest: int
|
||||
formats: Incomplete
|
||||
keep_temp: int
|
||||
dist_dir: Incomplete
|
||||
archive_files: Incomplete
|
||||
metadata_check: int
|
||||
owner: Incomplete
|
||||
group: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
filelist: Incomplete
|
||||
def run(self) -> None: ...
|
||||
def check_metadata(self) -> None: ...
|
||||
def get_file_list(self) -> None: ...
|
||||
def add_defaults(self) -> None: ...
|
||||
def read_template(self) -> None: ...
|
||||
def prune_file_list(self) -> None: ...
|
||||
def write_manifest(self) -> None: ...
|
||||
def read_manifest(self) -> None: ...
|
||||
def make_release_tree(self, base_dir, files) -> None: ...
|
||||
def make_distribution(self) -> None: ...
|
||||
def get_archive_files(self): ...
|
||||
|
|
@ -1,18 +0,0 @@
|
|||
from _typeshed import Incomplete
|
||||
from typing import ClassVar
|
||||
|
||||
from ..config import PyPIRCCommand
|
||||
|
||||
class upload(PyPIRCCommand):
|
||||
description: ClassVar[str]
|
||||
username: str
|
||||
password: str
|
||||
show_response: int
|
||||
sign: bool
|
||||
identity: Incomplete
|
||||
def initialize_options(self) -> None: ...
|
||||
repository: Incomplete
|
||||
realm: Incomplete
|
||||
def finalize_options(self) -> None: ...
|
||||
def run(self) -> None: ...
|
||||
def upload_file(self, command: str, pyversion: str, filename: str) -> None: ...
|
||||
|
|
@ -1,17 +0,0 @@
|
|||
from abc import abstractmethod
|
||||
from distutils.cmd import Command
|
||||
from typing import ClassVar
|
||||
|
||||
DEFAULT_PYPIRC: str
|
||||
|
||||
class PyPIRCCommand(Command):
|
||||
DEFAULT_REPOSITORY: ClassVar[str]
|
||||
DEFAULT_REALM: ClassVar[str]
|
||||
repository: None
|
||||
realm: None
|
||||
user_options: ClassVar[list[tuple[str, str | None, str]]]
|
||||
boolean_options: ClassVar[list[str]]
|
||||
def initialize_options(self) -> None: ...
|
||||
def finalize_options(self) -> None: ...
|
||||
@abstractmethod
|
||||
def run(self) -> None: ...
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
from _typeshed import Incomplete, StrOrBytesPath
|
||||
from collections.abc import Mapping
|
||||
from distutils.cmd import Command as Command
|
||||
from distutils.dist import Distribution as Distribution
|
||||
from distutils.extension import Extension as Extension
|
||||
from typing import Any, Final, Literal
|
||||
|
||||
USAGE: Final[str]
|
||||
|
||||
def gen_usage(script_name: StrOrBytesPath) -> str: ...
|
||||
|
||||
setup_keywords: tuple[str, ...]
|
||||
extension_keywords: tuple[str, ...]
|
||||
|
||||
def setup(
|
||||
*,
|
||||
name: str = ...,
|
||||
version: str = ...,
|
||||
description: str = ...,
|
||||
long_description: str = ...,
|
||||
author: str = ...,
|
||||
author_email: str = ...,
|
||||
maintainer: str = ...,
|
||||
maintainer_email: str = ...,
|
||||
url: str = ...,
|
||||
download_url: str = ...,
|
||||
packages: list[str] = ...,
|
||||
py_modules: list[str] = ...,
|
||||
scripts: list[str] = ...,
|
||||
ext_modules: list[Extension] = ...,
|
||||
classifiers: list[str] = ...,
|
||||
distclass: type[Distribution] = ...,
|
||||
script_name: str = ...,
|
||||
script_args: list[str] = ...,
|
||||
options: Mapping[str, Incomplete] = ...,
|
||||
license: str = ...,
|
||||
keywords: list[str] | str = ...,
|
||||
platforms: list[str] | str = ...,
|
||||
cmdclass: Mapping[str, type[Command]] = ...,
|
||||
data_files: list[tuple[str, list[str]]] = ...,
|
||||
package_dir: Mapping[str, str] = ...,
|
||||
obsoletes: list[str] = ...,
|
||||
provides: list[str] = ...,
|
||||
requires: list[str] = ...,
|
||||
command_packages: list[str] = ...,
|
||||
command_options: Mapping[str, Mapping[str, tuple[Incomplete, Incomplete]]] = ...,
|
||||
package_data: Mapping[str, list[str]] = ...,
|
||||
include_package_data: bool | Literal[0, 1] = ...,
|
||||
libraries: list[str] = ...,
|
||||
headers: list[str] = ...,
|
||||
ext_package: str = ...,
|
||||
include_dirs: list[str] = ...,
|
||||
password: str = ...,
|
||||
fullname: str = ...,
|
||||
# Custom Distributions could accept more params
|
||||
**attrs: Any,
|
||||
) -> Distribution: ...
|
||||
def run_setup(script_name: str, script_args: list[str] | None = None, stop_after: str = "run") -> Distribution: ...
|
||||
|
|
@ -1,20 +0,0 @@
|
|||
from distutils.unixccompiler import UnixCCompiler
|
||||
from distutils.version import LooseVersion
|
||||
from re import Pattern
|
||||
from typing import Final, Literal
|
||||
|
||||
def get_msvcr() -> list[str] | None: ...
|
||||
|
||||
class CygwinCCompiler(UnixCCompiler): ...
|
||||
class Mingw32CCompiler(CygwinCCompiler): ...
|
||||
|
||||
CONFIG_H_OK: Final = "ok"
|
||||
CONFIG_H_NOTOK: Final = "not ok"
|
||||
CONFIG_H_UNCERTAIN: Final = "uncertain"
|
||||
|
||||
def check_config_h() -> tuple[Literal["ok", "not ok", "uncertain"], str]: ...
|
||||
|
||||
RE_VERSION: Final[Pattern[bytes]]
|
||||
|
||||
def get_versions() -> tuple[LooseVersion | None, ...]: ...
|
||||
def is_cygwingcc() -> bool: ...
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
from typing import Final
|
||||
|
||||
DEBUG: Final[str | None]
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
from _typeshed import StrOrBytesPath, SupportsLenAndGetItem
|
||||
from collections.abc import Iterable
|
||||
from typing import Literal, TypeVar
|
||||
|
||||
_SourcesT = TypeVar("_SourcesT", bound=StrOrBytesPath)
|
||||
_TargetsT = TypeVar("_TargetsT", bound=StrOrBytesPath)
|
||||
|
||||
def newer(source: StrOrBytesPath, target: StrOrBytesPath) -> bool | Literal[1]: ...
|
||||
def newer_pairwise(
|
||||
sources: SupportsLenAndGetItem[_SourcesT], targets: SupportsLenAndGetItem[_TargetsT]
|
||||
) -> tuple[list[_SourcesT], list[_TargetsT]]: ...
|
||||
def newer_group(
|
||||
sources: Iterable[StrOrBytesPath], target: StrOrBytesPath, missing: Literal["error", "ignore", "newer"] = "error"
|
||||
) -> Literal[0, 1]: ...
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
from _typeshed import StrOrBytesPath, StrPath
|
||||
from collections.abc import Iterable
|
||||
from typing import Literal
|
||||
|
||||
def mkpath(name: str, mode: int = 0o777, verbose: bool | Literal[0, 1] = 1, dry_run: bool | Literal[0, 1] = 0) -> list[str]: ...
|
||||
def create_tree(
|
||||
base_dir: StrPath,
|
||||
files: Iterable[StrPath],
|
||||
mode: int = 0o777,
|
||||
verbose: bool | Literal[0, 1] = 1,
|
||||
dry_run: bool | Literal[0, 1] = 0,
|
||||
) -> None: ...
|
||||
def copy_tree(
|
||||
src: StrPath,
|
||||
dst: str,
|
||||
preserve_mode: bool | Literal[0, 1] = 1,
|
||||
preserve_times: bool | Literal[0, 1] = 1,
|
||||
preserve_symlinks: bool | Literal[0, 1] = 0,
|
||||
update: bool | Literal[0, 1] = 0,
|
||||
verbose: bool | Literal[0, 1] = 1,
|
||||
dry_run: bool | Literal[0, 1] = 0,
|
||||
) -> list[str]: ...
|
||||
def remove_tree(directory: StrOrBytesPath, verbose: bool | Literal[0, 1] = 1, dry_run: bool | Literal[0, 1] = 0) -> None: ...
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue