mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 21:46:42 +08:00
fix the __init__ of several C-classes (#13211)
This commit is contained in:
@@ -65,7 +65,7 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
|
||||
self,
|
||||
coro: _TaskCompatibleCoro[_T_co],
|
||||
*,
|
||||
loop: AbstractEventLoop = ...,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
name: str | None = ...,
|
||||
context: Context | None = None,
|
||||
eager_start: bool = False,
|
||||
@@ -75,13 +75,13 @@ class Task(Future[_T_co]): # type: ignore[type-var] # pyright: ignore[reportIn
|
||||
self,
|
||||
coro: _TaskCompatibleCoro[_T_co],
|
||||
*,
|
||||
loop: AbstractEventLoop = ...,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
name: str | None = ...,
|
||||
context: Context | None = None,
|
||||
) -> None: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop = ..., name: str | None = ...
|
||||
self, coro: _TaskCompatibleCoro[_T_co], *, loop: AbstractEventLoop | None = None, name: str | None = ...
|
||||
) -> None: ...
|
||||
|
||||
if sys.version_info >= (3, 12):
|
||||
|
||||
@@ -22,8 +22,8 @@ class blake2b:
|
||||
digest_size: int
|
||||
name: str
|
||||
if sys.version_info >= (3, 9):
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -39,10 +39,10 @@ class blake2b:
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -57,7 +57,7 @@ class blake2b:
|
||||
node_depth: int = 0,
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
|
||||
def copy(self) -> Self: ...
|
||||
def digest(self) -> bytes: ...
|
||||
@@ -74,8 +74,8 @@ class blake2s:
|
||||
digest_size: int
|
||||
name: str
|
||||
if sys.version_info >= (3, 9):
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -91,10 +91,10 @@ class blake2s:
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
usedforsecurity: bool = True,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
data: ReadableBuffer = b"",
|
||||
/,
|
||||
*,
|
||||
@@ -109,7 +109,7 @@ class blake2s:
|
||||
node_depth: int = 0,
|
||||
inner_size: int = 0,
|
||||
last_node: bool = False,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
|
||||
def copy(self) -> Self: ...
|
||||
def digest(self) -> bytes: ...
|
||||
|
||||
@@ -1,9 +1,15 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from typing import final
|
||||
from typing_extensions import Self
|
||||
|
||||
@final
|
||||
class BZ2Compressor:
|
||||
def __init__(self, compresslevel: int = 9) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, compresslevel: int = 9, /) -> Self: ...
|
||||
else:
|
||||
def __init__(self, compresslevel: int = 9, /) -> None: ...
|
||||
|
||||
def compress(self, data: ReadableBuffer, /) -> bytes: ...
|
||||
def flush(self) -> bytes: ...
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import sys
|
||||
from collections.abc import Callable, Iterator, Mapping
|
||||
from typing import Any, ClassVar, Generic, TypeVar, final, overload
|
||||
from typing_extensions import ParamSpec
|
||||
from typing_extensions import ParamSpec, Self
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
@@ -13,9 +13,9 @@ _P = ParamSpec("_P")
|
||||
@final
|
||||
class ContextVar(Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, name: str) -> None: ...
|
||||
def __new__(cls, name: str) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, name: str, *, default: _T) -> None: ...
|
||||
def __new__(cls, name: str, *, default: _T) -> Self: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@property
|
||||
def name(self) -> str: ...
|
||||
|
||||
@@ -32,8 +32,8 @@ class Dialect:
|
||||
lineterminator: str
|
||||
quoting: _QuotingType
|
||||
strict: bool
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
dialect: _DialectLike | None = ...,
|
||||
delimiter: str = ",",
|
||||
doublequote: bool = True,
|
||||
@@ -43,7 +43,7 @@ class Dialect:
|
||||
quoting: _QuotingType = 0,
|
||||
skipinitialspace: bool = False,
|
||||
strict: bool = False,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
# This class calls itself _csv.reader.
|
||||
|
||||
@@ -169,18 +169,18 @@ class CFuncPtr(_PointerLike, _CData, metaclass=_PyCFuncPtrType):
|
||||
# Abstract attribute that must be defined on subclasses
|
||||
_flags_: ClassVar[int]
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def __new__(cls) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, address: int, /) -> None: ...
|
||||
def __new__(cls, address: int, /) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, callable: Callable[..., Any], /) -> None: ...
|
||||
def __new__(cls, callable: Callable[..., Any], /) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> None: ...
|
||||
def __new__(cls, func_spec: tuple[str | int, CDLL], paramflags: tuple[_PF, ...] | None = ..., /) -> Self: ...
|
||||
if sys.platform == "win32":
|
||||
@overload
|
||||
def __init__(
|
||||
self, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., /
|
||||
) -> None: ...
|
||||
def __new__(
|
||||
cls, vtbl_index: int, name: str, paramflags: tuple[_PF, ...] | None = ..., iid: _CData | _CDataType | None = ..., /
|
||||
) -> Self: ...
|
||||
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ class BufferedRandom(BufferedIOBase, _BufferedIOBase, BinaryIO): # type: ignore
|
||||
def truncate(self, pos: int | None = None, /) -> int: ...
|
||||
|
||||
class BufferedRWPair(BufferedIOBase, _BufferedIOBase):
|
||||
def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = 8192) -> None: ...
|
||||
def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = 8192, /) -> None: ...
|
||||
def peek(self, size: int = 0, /) -> bytes: ...
|
||||
|
||||
class _TextIOBase(_IOBase):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from collections.abc import Callable
|
||||
from typing import Any, final
|
||||
from typing_extensions import Self
|
||||
|
||||
@final
|
||||
class make_encoder:
|
||||
@@ -19,8 +20,8 @@ class make_encoder:
|
||||
def encoder(self) -> Callable[[str], str]: ...
|
||||
@property
|
||||
def item_separator(self) -> str: ...
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
markers: dict[int, Any] | None,
|
||||
default: Callable[[Any], Any],
|
||||
encoder: Callable[[str], str],
|
||||
@@ -30,7 +31,7 @@ class make_encoder:
|
||||
sort_keys: bool,
|
||||
skipkeys: bool,
|
||||
allow_nan: bool,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
def __call__(self, obj: object, _current_indent_level: int) -> Any: ...
|
||||
|
||||
@final
|
||||
@@ -42,7 +43,7 @@ class make_scanner:
|
||||
parse_float: Any
|
||||
strict: bool
|
||||
# TODO: 'context' needs the attrs above (ducktype), but not __call__.
|
||||
def __init__(self, context: make_scanner) -> None: ...
|
||||
def __new__(cls, context: make_scanner) -> Self: ...
|
||||
def __call__(self, string: str, index: int) -> tuple[Any, int]: ...
|
||||
|
||||
def encode_basestring(s: str, /) -> str: ...
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import sys
|
||||
from _typeshed import ReadableBuffer
|
||||
from collections.abc import Mapping, Sequence
|
||||
from typing import Any, Final, final
|
||||
from typing_extensions import TypeAlias
|
||||
from typing_extensions import Self, TypeAlias
|
||||
|
||||
_FilterChain: TypeAlias = Sequence[Mapping[str, Any]]
|
||||
|
||||
@@ -36,7 +37,11 @@ PRESET_EXTREME: int # v big number
|
||||
|
||||
@final
|
||||
class LZMADecompressor:
|
||||
def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> Self: ...
|
||||
else:
|
||||
def __init__(self, format: int | None = ..., memlimit: int | None = ..., filters: _FilterChain | None = ...) -> None: ...
|
||||
|
||||
def decompress(self, data: ReadableBuffer, max_length: int = -1) -> bytes: ...
|
||||
@property
|
||||
def check(self) -> int: ...
|
||||
@@ -49,9 +54,15 @@ class LZMADecompressor:
|
||||
|
||||
@final
|
||||
class LZMACompressor:
|
||||
def __init__(
|
||||
self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(
|
||||
cls, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, format: int | None = ..., check: int = ..., preset: int | None = ..., filters: _FilterChain | None = ...
|
||||
) -> None: ...
|
||||
|
||||
def compress(self, data: ReadableBuffer, /) -> bytes: ...
|
||||
def flush(self) -> bytes: ...
|
||||
|
||||
|
||||
@@ -66,7 +66,6 @@ class Pickler:
|
||||
self,
|
||||
file: SupportsWrite[bytes],
|
||||
protocol: int | None = None,
|
||||
*,
|
||||
fix_imports: bool = True,
|
||||
buffer_callback: _BufferCallback = None,
|
||||
) -> None: ...
|
||||
|
||||
@@ -24,19 +24,21 @@ class array(MutableSequence[_T]):
|
||||
@property
|
||||
def itemsize(self) -> int: ...
|
||||
@overload
|
||||
def __init__(self: array[int], typecode: _IntTypeCode, initializer: bytes | bytearray | Iterable[int] = ..., /) -> None: ...
|
||||
def __new__(
|
||||
cls: type[array[int]], typecode: _IntTypeCode, initializer: bytes | bytearray | Iterable[int] = ..., /
|
||||
) -> array[int]: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self: array[float], typecode: _FloatTypeCode, initializer: bytes | bytearray | Iterable[float] = ..., /
|
||||
) -> None: ...
|
||||
def __new__(
|
||||
cls: type[array[float]], typecode: _FloatTypeCode, initializer: bytes | bytearray | Iterable[float] = ..., /
|
||||
) -> array[float]: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self: array[str], typecode: _UnicodeTypeCode, initializer: bytes | bytearray | Iterable[str] = ..., /
|
||||
) -> None: ...
|
||||
def __new__(
|
||||
cls: type[array[str]], typecode: _UnicodeTypeCode, initializer: bytes | bytearray | Iterable[str] = ..., /
|
||||
) -> array[str]: ...
|
||||
@overload
|
||||
def __init__(self, typecode: str, initializer: Iterable[_T], /) -> None: ...
|
||||
def __new__(cls, typecode: str, initializer: Iterable[_T], /) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, typecode: str, initializer: bytes | bytearray = ..., /) -> None: ...
|
||||
def __new__(cls, typecode: str, initializer: bytes | bytearray = ..., /) -> Self: ...
|
||||
def append(self, v: _T, /) -> None: ...
|
||||
def buffer_info(self) -> tuple[int, int]: ...
|
||||
def byteswap(self) -> None: ...
|
||||
|
||||
@@ -1489,18 +1489,18 @@ def locals() -> dict[str, Any]: ...
|
||||
|
||||
class map(Generic[_S]):
|
||||
@overload
|
||||
def __new__(cls, func: Callable[[_T1], _S], iter1: Iterable[_T1], /) -> Self: ...
|
||||
def __new__(cls, func: Callable[[_T1], _S], iterable: Iterable[_T1], /) -> Self: ...
|
||||
@overload
|
||||
def __new__(cls, func: Callable[[_T1, _T2], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], /) -> Self: ...
|
||||
def __new__(cls, func: Callable[[_T1, _T2], _S], iterable: Iterable[_T1], iter2: Iterable[_T2], /) -> Self: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls, func: Callable[[_T1, _T2, _T3], _S], iter1: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /
|
||||
cls, func: Callable[[_T1, _T2, _T3], _S], iterable: Iterable[_T1], iter2: Iterable[_T2], iter3: Iterable[_T3], /
|
||||
) -> Self: ...
|
||||
@overload
|
||||
def __new__(
|
||||
cls,
|
||||
func: Callable[[_T1, _T2, _T3, _T4], _S],
|
||||
iter1: Iterable[_T1],
|
||||
iterable: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4],
|
||||
@@ -1510,7 +1510,7 @@ class map(Generic[_S]):
|
||||
def __new__(
|
||||
cls,
|
||||
func: Callable[[_T1, _T2, _T3, _T4, _T5], _S],
|
||||
iter1: Iterable[_T1],
|
||||
iterable: Iterable[_T1],
|
||||
iter2: Iterable[_T2],
|
||||
iter3: Iterable[_T3],
|
||||
iter4: Iterable[_T4],
|
||||
@@ -1521,7 +1521,7 @@ class map(Generic[_S]):
|
||||
def __new__(
|
||||
cls,
|
||||
func: Callable[..., _S],
|
||||
iter1: Iterable[Any],
|
||||
iterable: Iterable[Any],
|
||||
iter2: Iterable[Any],
|
||||
iter3: Iterable[Any],
|
||||
iter4: Iterable[Any],
|
||||
|
||||
@@ -29,7 +29,7 @@ class timezone(tzinfo):
|
||||
utc: ClassVar[timezone]
|
||||
min: ClassVar[timezone]
|
||||
max: ClassVar[timezone]
|
||||
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
|
||||
def __new__(cls, offset: timedelta, name: str = ...) -> Self: ...
|
||||
def tzname(self, dt: datetime | None, /) -> str: ...
|
||||
def utcoffset(self, dt: datetime | None, /) -> timedelta: ...
|
||||
def dst(self, dt: datetime | None, /) -> None: ...
|
||||
|
||||
@@ -189,7 +189,6 @@ class Context:
|
||||
clamp: int | None = ...,
|
||||
flags: None | dict[_TrapType, bool] | Container[_TrapType] = ...,
|
||||
traps: None | dict[_TrapType, bool] | Container[_TrapType] = ...,
|
||||
_ignored_flags: list[_TrapType] | None = ...,
|
||||
) -> None: ...
|
||||
def __reduce__(self) -> tuple[type[Self], tuple[Any, ...]]: ...
|
||||
def clear_flags(self) -> None: ...
|
||||
|
||||
@@ -32,7 +32,6 @@ class _IPAddressBase:
|
||||
def version(self) -> int: ...
|
||||
|
||||
class _BaseAddress(_IPAddressBase):
|
||||
def __init__(self, address: object) -> None: ...
|
||||
def __add__(self, other: int) -> Self: ...
|
||||
def __hash__(self) -> int: ...
|
||||
def __int__(self) -> int: ...
|
||||
@@ -54,7 +53,6 @@ class _BaseAddress(_IPAddressBase):
|
||||
class _BaseNetwork(_IPAddressBase, Generic[_A]):
|
||||
network_address: _A
|
||||
netmask: _A
|
||||
def __init__(self, address: object, strict: bool = ...) -> None: ...
|
||||
def __contains__(self, other: Any) -> bool: ...
|
||||
def __getitem__(self, n: int) -> _A: ...
|
||||
def __iter__(self) -> Iterator[_A]: ...
|
||||
@@ -114,6 +112,7 @@ class _BaseV4:
|
||||
def max_prefixlen(self) -> Literal[32]: ...
|
||||
|
||||
class IPv4Address(_BaseV4, _BaseAddress):
|
||||
def __init__(self, address: object) -> None: ...
|
||||
@property
|
||||
def is_global(self) -> bool: ...
|
||||
@property
|
||||
@@ -134,7 +133,8 @@ class IPv4Address(_BaseV4, _BaseAddress):
|
||||
@property
|
||||
def ipv6_mapped(self) -> IPv6Address: ...
|
||||
|
||||
class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]): ...
|
||||
class IPv4Network(_BaseV4, _BaseNetwork[IPv4Address]):
|
||||
def __init__(self, address: object, strict: bool = ...) -> None: ...
|
||||
|
||||
class IPv4Interface(IPv4Address):
|
||||
netmask: IPv4Address
|
||||
@@ -159,6 +159,7 @@ class _BaseV6:
|
||||
def max_prefixlen(self) -> Literal[128]: ...
|
||||
|
||||
class IPv6Address(_BaseV6, _BaseAddress):
|
||||
def __init__(self, address: object) -> None: ...
|
||||
@property
|
||||
def is_global(self) -> bool: ...
|
||||
@property
|
||||
@@ -191,6 +192,7 @@ class IPv6Address(_BaseV6, _BaseAddress):
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
class IPv6Network(_BaseV6, _BaseNetwork[IPv6Address]):
|
||||
def __init__(self, address: object, strict: bool = ...) -> None: ...
|
||||
@property
|
||||
def is_site_local(self) -> bool: ...
|
||||
|
||||
|
||||
@@ -40,29 +40,29 @@ class count(Generic[_N]):
|
||||
def __iter__(self) -> Self: ...
|
||||
|
||||
class cycle(Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T], /) -> None: ...
|
||||
def __new__(cls, iterable: Iterable[_T], /) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
|
||||
class repeat(Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, object: _T) -> None: ...
|
||||
def __new__(cls, object: _T) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, object: _T, times: int) -> None: ...
|
||||
def __new__(cls, object: _T, times: int) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __length_hint__(self) -> int: ...
|
||||
|
||||
class accumulate(Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> None: ...
|
||||
def __new__(cls, iterable: Iterable[_T], func: None = None, *, initial: _T | None = ...) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> None: ...
|
||||
def __new__(cls, iterable: Iterable[_S], func: Callable[[_T, _S], _T], *, initial: _T | None = ...) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class chain(Generic[_T]):
|
||||
def __init__(self, *iterables: Iterable[_T]) -> None: ...
|
||||
def __new__(cls, *iterables: Iterable[_T]) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
@classmethod
|
||||
@@ -72,17 +72,17 @@ class chain(Generic[_T]):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
class compress(Generic[_T]):
|
||||
def __init__(self, data: Iterable[_T], selectors: Iterable[Any]) -> None: ...
|
||||
def __new__(cls, data: Iterable[_T], selectors: Iterable[Any]) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class dropwhile(Generic[_T]):
|
||||
def __init__(self, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> None: ...
|
||||
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
class filterfalse(Generic[_T]):
|
||||
def __init__(self, predicate: _Predicate[_T] | None, iterable: Iterable[_T], /) -> None: ...
|
||||
def __new__(cls, function: _Predicate[_T] | None, iterable: Iterable[_T], /) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
@@ -96,9 +96,9 @@ class groupby(Generic[_T_co, _S_co]):
|
||||
|
||||
class islice(Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T], stop: int | None, /) -> None: ...
|
||||
def __new__(cls, iterable: Iterable[_T], stop: int | None, /) -> Self: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> None: ...
|
||||
def __new__(cls, iterable: Iterable[_T], start: int | None, stop: int | None, step: int | None = ..., /) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
@@ -108,7 +108,7 @@ class starmap(Generic[_T_co]):
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
class takewhile(Generic[_T]):
|
||||
def __init__(self, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> None: ...
|
||||
def __new__(cls, predicate: _Predicate[_T], iterable: Iterable[_T], /) -> Self: ...
|
||||
def __iter__(self) -> Self: ...
|
||||
def __next__(self) -> _T: ...
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ class mmap:
|
||||
def __init__(self, fileno: int, length: int, tagname: str | None = ..., access: int = ..., offset: int = ...) -> None: ...
|
||||
else:
|
||||
if sys.version_info >= (3, 13):
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
fileno: int,
|
||||
length: int,
|
||||
flags: int = ...,
|
||||
@@ -45,11 +45,11 @@ class mmap:
|
||||
offset: int = ...,
|
||||
*,
|
||||
trackfd: bool = True,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ...
|
||||
) -> None: ...
|
||||
def __new__(
|
||||
cls, fileno: int, length: int, flags: int = ..., prot: int = ..., access: int = ..., offset: int = ...
|
||||
) -> Self: ...
|
||||
|
||||
def close(self) -> None: ...
|
||||
def flush(self, offset: int = ..., size: int = ...) -> None: ...
|
||||
|
||||
@@ -54,7 +54,7 @@ from _operator import (
|
||||
)
|
||||
from _typeshed import SupportsGetItem
|
||||
from typing import Any, Generic, TypeVar, final, overload
|
||||
from typing_extensions import TypeVarTuple, Unpack
|
||||
from typing_extensions import Self, TypeVarTuple, Unpack
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_T_co = TypeVar("_T_co", covariant=True)
|
||||
@@ -211,5 +211,5 @@ class itemgetter(Generic[_T_co]):
|
||||
|
||||
@final
|
||||
class methodcaller:
|
||||
def __init__(self, name: str, /, *args: Any, **kwargs: Any) -> None: ...
|
||||
def __new__(cls, name: str, /, *args: Any, **kwargs: Any) -> Self: ...
|
||||
def __call__(self, obj: Any) -> Any: ...
|
||||
|
||||
@@ -15,6 +15,7 @@ from _pickle import (
|
||||
from _typeshed import ReadableBuffer, SupportsWrite
|
||||
from collections.abc import Callable, Iterable, Mapping
|
||||
from typing import Any, ClassVar, SupportsBytes, SupportsIndex, final
|
||||
from typing_extensions import Self
|
||||
|
||||
__all__ = [
|
||||
"PickleBuffer",
|
||||
@@ -108,7 +109,7 @@ bytes_types: tuple[type[Any], ...] # undocumented
|
||||
|
||||
@final
|
||||
class PickleBuffer:
|
||||
def __init__(self, buffer: ReadableBuffer) -> None: ...
|
||||
def __new__(cls, buffer: ReadableBuffer) -> Self: ...
|
||||
def raw(self) -> memoryview: ...
|
||||
def release(self) -> None: ...
|
||||
def __buffer__(self, flags: int, /) -> memoryview: ...
|
||||
|
||||
@@ -429,7 +429,7 @@ class PrepareProtocol:
|
||||
def __init__(self, *args: object, **kwargs: object) -> None: ...
|
||||
|
||||
class Row(Sequence[Any]):
|
||||
def __init__(self, cursor: Cursor, data: tuple[Any, ...], /) -> None: ...
|
||||
def __new__(cls, cursor: Cursor, data: tuple[Any, ...], /) -> Self: ...
|
||||
def keys(self) -> list[str]: ...
|
||||
@overload
|
||||
def __getitem__(self, key: int | str, /) -> Any: ...
|
||||
|
||||
@@ -89,14 +89,26 @@ class FunctionType:
|
||||
__type_params__: tuple[TypeVar | ParamSpec | TypeVarTuple, ...]
|
||||
|
||||
__module__: str
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = ...,
|
||||
argdefs: tuple[object, ...] | None = ...,
|
||||
closure: tuple[CellType, ...] | None = ...,
|
||||
) -> Self: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = None,
|
||||
argdefs: tuple[object, ...] | None = None,
|
||||
closure: tuple[CellType, ...] | None = None,
|
||||
kwdefaults: dict[str, object] | None = None,
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __new__(
|
||||
cls,
|
||||
code: CodeType,
|
||||
globals: dict[str, Any],
|
||||
name: str | None = None,
|
||||
argdefs: tuple[object, ...] | None = None,
|
||||
closure: tuple[CellType, ...] | None = None,
|
||||
) -> Self: ...
|
||||
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
@overload
|
||||
def __get__(self, instance: None, owner: type, /) -> FunctionType: ...
|
||||
@@ -442,7 +454,7 @@ class MethodType:
|
||||
def __name__(self) -> str: ... # inherited from the added function
|
||||
@property
|
||||
def __qualname__(self) -> str: ... # inherited from the added function
|
||||
def __new__(cls, func: Callable[..., Any], obj: object, /) -> Self: ...
|
||||
def __new__(cls, func: Callable[..., Any], instance: object, /) -> Self: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> Any: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
@@ -604,7 +616,7 @@ if sys.version_info >= (3, 9):
|
||||
def __args__(self) -> tuple[Any, ...]: ...
|
||||
@property
|
||||
def __parameters__(self) -> tuple[Any, ...]: ...
|
||||
def __new__(cls, origin: type, args: Any) -> Self: ...
|
||||
def __new__(cls, origin: type, args: Any, /) -> Self: ...
|
||||
def __getitem__(self, typeargs: Any, /) -> GenericAlias: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
def __hash__(self) -> int: ...
|
||||
|
||||
@@ -155,8 +155,8 @@ class TypeVar:
|
||||
@property
|
||||
def __default__(self) -> Any: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
name: str,
|
||||
*constraints: Any,
|
||||
bound: Any | None = None,
|
||||
@@ -164,17 +164,21 @@ class TypeVar:
|
||||
covariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
default: Any = ...,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
elif sys.version_info >= (3, 12):
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
name: str,
|
||||
*constraints: Any,
|
||||
bound: Any | None = None,
|
||||
covariant: bool = False,
|
||||
contravariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
def __new__(
|
||||
cls, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, name: str, *constraints: Any, bound: Any | None = None, covariant: bool = False, contravariant: bool = False
|
||||
@@ -232,7 +236,9 @@ if sys.version_info >= (3, 11):
|
||||
def __default__(self) -> Any: ...
|
||||
def has_default(self) -> bool: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __init__(self, name: str, *, default: Any = ...) -> None: ...
|
||||
def __new__(cls, name: str, *, default: Any = ...) -> Self: ...
|
||||
elif sys.version_info >= (3, 12):
|
||||
def __new__(cls, name: str) -> Self: ...
|
||||
else:
|
||||
def __init__(self, name: str) -> None: ...
|
||||
|
||||
@@ -245,14 +251,22 @@ if sys.version_info >= (3, 10):
|
||||
class ParamSpecArgs:
|
||||
@property
|
||||
def __origin__(self) -> ParamSpec: ...
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, origin: ParamSpec) -> Self: ...
|
||||
else:
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
@final
|
||||
class ParamSpecKwargs:
|
||||
@property
|
||||
def __origin__(self) -> ParamSpec: ...
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
def __new__(cls, origin: ParamSpec) -> Self: ...
|
||||
else:
|
||||
def __init__(self, origin: ParamSpec) -> None: ...
|
||||
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
|
||||
@final
|
||||
@@ -272,8 +286,8 @@ if sys.version_info >= (3, 10):
|
||||
@property
|
||||
def __default__(self) -> Any: ...
|
||||
if sys.version_info >= (3, 13):
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
name: str,
|
||||
*,
|
||||
bound: Any | None = None,
|
||||
@@ -281,17 +295,21 @@ if sys.version_info >= (3, 10):
|
||||
covariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
default: Any = ...,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
elif sys.version_info >= (3, 12):
|
||||
def __init__(
|
||||
self,
|
||||
def __new__(
|
||||
cls,
|
||||
name: str,
|
||||
*,
|
||||
bound: Any | None = None,
|
||||
contravariant: bool = False,
|
||||
covariant: bool = False,
|
||||
infer_variance: bool = False,
|
||||
) -> None: ...
|
||||
) -> Self: ...
|
||||
elif sys.version_info >= (3, 11):
|
||||
def __new__(
|
||||
cls, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False
|
||||
) -> Self: ...
|
||||
else:
|
||||
def __init__(
|
||||
self, name: str, *, bound: Any | None = None, contravariant: bool = False, covariant: bool = False
|
||||
@@ -1039,9 +1057,7 @@ if sys.version_info >= (3, 12):
|
||||
def override(method: _F, /) -> _F: ...
|
||||
@final
|
||||
class TypeAliasType:
|
||||
def __init__(
|
||||
self, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()
|
||||
) -> None: ...
|
||||
def __new__(cls, name: str, value: Any, *, type_params: tuple[TypeVar | ParamSpec | TypeVarTuple, ...] = ()) -> Self: ...
|
||||
@property
|
||||
def __value__(self) -> Any: ...
|
||||
@property
|
||||
|
||||
@@ -21,7 +21,7 @@ if sys.version_info >= (3, 9):
|
||||
class ZoneInfo(tzinfo):
|
||||
@property
|
||||
def key(self) -> str: ...
|
||||
def __init__(self, key: str) -> None: ...
|
||||
def __new__(cls, key: str) -> Self: ...
|
||||
@classmethod
|
||||
def no_cache(cls, key: str) -> Self: ...
|
||||
@classmethod
|
||||
|
||||
Reference in New Issue
Block a user