mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Fix positional-only differences in many stdlib modules (#7226)
This commit is contained in:
@@ -322,7 +322,7 @@ if sys.version_info >= (3, 9):
|
||||
class Namespace(_AttributeHolder):
|
||||
def __init__(self, **kwargs: Any) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
def __setattr__(self, __name: str, __value: Any) -> None: ...
|
||||
def __contains__(self, key: str) -> bool: ...
|
||||
|
||||
class FileType:
|
||||
|
||||
@@ -340,7 +340,7 @@ class complex:
|
||||
def __add__(self, __x: complex) -> complex: ...
|
||||
def __sub__(self, __x: complex) -> complex: ...
|
||||
def __mul__(self, __x: complex) -> complex: ...
|
||||
def __pow__(self, __x: complex, mod: None = ...) -> complex: ...
|
||||
def __pow__(self, __x: complex, __mod: None = ...) -> complex: ...
|
||||
def __truediv__(self, __x: complex) -> complex: ...
|
||||
def __radd__(self, __x: complex) -> complex: ...
|
||||
def __rsub__(self, __x: complex) -> complex: ...
|
||||
@@ -444,7 +444,7 @@ class str(Sequence[str]):
|
||||
def __mod__(self, __x: Any) -> str: ...
|
||||
def __mul__(self, __n: SupportsIndex) -> str: ...
|
||||
def __ne__(self, __x: object) -> bool: ...
|
||||
def __rmul__(self, n: SupportsIndex) -> str: ...
|
||||
def __rmul__(self, __n: SupportsIndex) -> str: ...
|
||||
def __getnewargs__(self) -> tuple[str]: ...
|
||||
|
||||
class bytes(ByteString):
|
||||
@@ -642,7 +642,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
@overload
|
||||
def __getitem__(self, __s: slice) -> bytearray: ...
|
||||
@overload
|
||||
def __setitem__(self, __i: SupportsIndex, x: SupportsIndex) -> None: ...
|
||||
def __setitem__(self, __i: SupportsIndex, __x: SupportsIndex) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, __s: slice, __x: Iterable[SupportsIndex] | bytes) -> None: ...
|
||||
def __delitem__(self, __i: SupportsIndex | slice) -> None: ...
|
||||
@@ -889,7 +889,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
def pop(self, __key: _KT, __default: _VT | _T = ...) -> _VT | _T: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __getitem__(self, __k: _KT) -> _VT: ...
|
||||
def __setitem__(self, __k: _KT, v: _VT) -> None: ...
|
||||
def __setitem__(self, __k: _KT, __v: _VT) -> None: ...
|
||||
def __delitem__(self, __v: _KT) -> None: ...
|
||||
def __iter__(self) -> Iterator[_KT]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
@@ -84,9 +84,9 @@ class DoneAndNotDoneFutures(Sequence[set[Future[_T]]]):
|
||||
def __new__(_cls, done: set[Future[_T]], not_done: set[Future[_T]]) -> DoneAndNotDoneFutures[_T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, i: SupportsIndex) -> set[Future[_T]]: ...
|
||||
def __getitem__(self, __i: SupportsIndex) -> set[Future[_T]]: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> DoneAndNotDoneFutures[_T]: ...
|
||||
def __getitem__(self, __s: slice) -> DoneAndNotDoneFutures[_T]: ...
|
||||
|
||||
def wait(fs: Iterable[Future[_T]], timeout: float | None = ..., return_when: str = ...) -> DoneAndNotDoneFutures[_T]: ...
|
||||
|
||||
|
||||
@@ -46,6 +46,6 @@ class Context(Mapping[ContextVar[Any], Any]):
|
||||
def get(self, __key: ContextVar[_T], __default: _D) -> _T | _D: ...
|
||||
def run(self, callable: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> _T: ...
|
||||
def copy(self) -> Context: ...
|
||||
def __getitem__(self, key: ContextVar[_T]) -> _T: ...
|
||||
def __getitem__(self, __key: ContextVar[_T]) -> _T: ...
|
||||
def __iter__(self) -> Iterator[ContextVar[Any]]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
@@ -18,7 +18,7 @@ class Charset:
|
||||
def header_encode_lines(self, string: str, maxlengths: Iterator[int]) -> list[str]: ...
|
||||
def body_encode(self, string: str) -> str: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __ne__(self, __other: object) -> bool: ...
|
||||
|
||||
def add_charset(
|
||||
charset: str, header_enc: int | None = ..., body_enc: int | None = ..., output_charset: str | None = ...
|
||||
|
||||
@@ -13,7 +13,7 @@ class Header:
|
||||
def append(self, s: bytes | str, charset: Charset | str | None = ..., errors: str = ...) -> None: ...
|
||||
def encode(self, splitchars: str = ..., maxlinelen: int | None = ..., linesep: str = ...) -> str: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __ne__(self, __other: object) -> bool: ...
|
||||
|
||||
def decode_header(header: Header | str) -> list[tuple[bytes, str | None]]: ...
|
||||
def make_header(
|
||||
|
||||
@@ -18,12 +18,12 @@ def ip_network(address: _RawIPAddress | _RawNetworkPart, strict: bool = ...) ->
|
||||
def ip_interface(address: _RawIPAddress | _RawNetworkPart) -> IPv4Interface | IPv6Interface: ...
|
||||
|
||||
class _IPAddressBase:
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ge__(self: Self, other: Self) -> bool: ...
|
||||
def __gt__(self: Self, other: Self) -> bool: ...
|
||||
def __le__(self: Self, other: Self) -> bool: ...
|
||||
def __lt__(self: Self, other: Self) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __eq__(self, __other: object) -> bool: ...
|
||||
def __ge__(self: Self, __other: Self) -> bool: ...
|
||||
def __gt__(self: Self, __other: Self) -> bool: ...
|
||||
def __le__(self: Self, __other: Self) -> bool: ...
|
||||
def __lt__(self: Self, __other: Self) -> bool: ...
|
||||
def __ne__(self, __other: object) -> bool: ...
|
||||
@property
|
||||
def compressed(self) -> str: ...
|
||||
@property
|
||||
|
||||
@@ -59,14 +59,14 @@ class mmap(AbstractContextManager[mmap], Iterable[int], Sized):
|
||||
def read(self, n: int | None = ...) -> bytes: ...
|
||||
def write(self, bytes: ReadableBuffer) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, index: int) -> int: ...
|
||||
def __getitem__(self, __index: int) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, index: slice) -> bytes: ...
|
||||
def __delitem__(self, index: int | slice) -> NoReturn: ...
|
||||
def __getitem__(self, __index: slice) -> bytes: ...
|
||||
def __delitem__(self, __index: int | slice) -> NoReturn: ...
|
||||
@overload
|
||||
def __setitem__(self, index: int, object: int) -> None: ...
|
||||
def __setitem__(self, __index: int, __object: int) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, index: slice, object: ReadableBuffer) -> None: ...
|
||||
def __setitem__(self, __index: slice, __object: ReadableBuffer) -> None: ...
|
||||
# Doesn't actually exist, but the object is actually iterable because it has __getitem__ and
|
||||
# __len__, so we claim that there is also an __iter__ to help type checkers.
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
|
||||
@@ -160,7 +160,7 @@ class Values:
|
||||
def read_file(self, filename: str, mode: str = ...) -> None: ...
|
||||
def read_module(self, modname: str, mode: str = ...) -> None: ...
|
||||
def __getattr__(self, name: str) -> Any: ...
|
||||
def __setattr__(self, name: str, value: Any) -> None: ...
|
||||
def __setattr__(self, __name: str, __value: Any) -> None: ...
|
||||
|
||||
class OptionParser(OptionContainer):
|
||||
allow_interspersed_args: bool
|
||||
|
||||
@@ -91,7 +91,7 @@ class _Call(tuple[Any, ...]):
|
||||
self, value: Any = ..., name: Any | None = ..., parent: Any | None = ..., two: bool = ..., from_kall: bool = ...
|
||||
) -> None: ...
|
||||
def __eq__(self, other: object) -> bool: ...
|
||||
def __ne__(self, other: object) -> bool: ...
|
||||
def __ne__(self, __other: object) -> bool: ...
|
||||
def __call__(self, *args: Any, **kwargs: Any) -> _Call: ...
|
||||
def __getattr__(self, attr: Any) -> Any: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
Reference in New Issue
Block a user