mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Make arguments positional-only for `int, memoryview, classmethod, staticmethod and BaseException` (#6272)
This commit is contained in:
@@ -118,16 +118,16 @@ class object:
|
||||
class staticmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable[..., Any]
|
||||
__isabstractmethod__: bool
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __init__(self, __f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
|
||||
def __get__(self, __obj: _T, __type: Type[_T] | None = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class classmethod(object): # Special, only valid as a decorator.
|
||||
__func__: Callable[..., Any]
|
||||
__isabstractmethod__: bool
|
||||
def __init__(self, f: Callable[..., Any]) -> None: ...
|
||||
def __init__(self, __f: Callable[..., Any]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, obj: _T, type: Type[_T] | None = ...) -> Callable[..., Any]: ...
|
||||
def __get__(self, __obj: _T, __type: Type[_T] | None = ...) -> Callable[..., Any]: ...
|
||||
|
||||
class type(object):
|
||||
__base__: type
|
||||
@@ -174,9 +174,9 @@ class super(object):
|
||||
|
||||
class int:
|
||||
@overload
|
||||
def __new__(cls: Type[_T], x: str | bytes | SupportsInt | SupportsIndex | _SupportsTrunc = ...) -> _T: ...
|
||||
def __new__(cls: Type[_T], __x: str | bytes | SupportsInt | SupportsIndex | _SupportsTrunc = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], x: str | bytes | bytearray, base: SupportsIndex) -> _T: ...
|
||||
def __new__(cls: Type[_T], __x: str | bytes | bytearray, base: SupportsIndex) -> _T: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def as_integer_ratio(self) -> tuple[int, Literal[1]]: ...
|
||||
@property
|
||||
@@ -196,35 +196,35 @@ class int:
|
||||
def from_bytes(
|
||||
cls, bytes: Iterable[SupportsIndex] | SupportsBytes, byteorder: Literal["little", "big"], *, signed: bool = ...
|
||||
) -> int: ... # TODO buffer object argument
|
||||
def __add__(self, x: int) -> int: ...
|
||||
def __sub__(self, x: int) -> int: ...
|
||||
def __mul__(self, x: int) -> int: ...
|
||||
def __floordiv__(self, x: int) -> int: ...
|
||||
def __truediv__(self, x: int) -> float: ...
|
||||
def __mod__(self, x: int) -> int: ...
|
||||
def __divmod__(self, x: int) -> tuple[int, int]: ...
|
||||
def __radd__(self, x: int) -> int: ...
|
||||
def __rsub__(self, x: int) -> int: ...
|
||||
def __rmul__(self, x: int) -> int: ...
|
||||
def __rfloordiv__(self, x: int) -> int: ...
|
||||
def __rtruediv__(self, x: int) -> float: ...
|
||||
def __rmod__(self, x: int) -> int: ...
|
||||
def __rdivmod__(self, x: int) -> tuple[int, int]: ...
|
||||
def __add__(self, __x: int) -> int: ...
|
||||
def __sub__(self, __x: int) -> int: ...
|
||||
def __mul__(self, __x: int) -> int: ...
|
||||
def __floordiv__(self, __x: int) -> int: ...
|
||||
def __truediv__(self, __x: int) -> float: ...
|
||||
def __mod__(self, __x: int) -> int: ...
|
||||
def __divmod__(self, __x: int) -> tuple[int, int]: ...
|
||||
def __radd__(self, __x: int) -> int: ...
|
||||
def __rsub__(self, __x: int) -> int: ...
|
||||
def __rmul__(self, __x: int) -> int: ...
|
||||
def __rfloordiv__(self, __x: int) -> int: ...
|
||||
def __rtruediv__(self, __x: int) -> float: ...
|
||||
def __rmod__(self, __x: int) -> int: ...
|
||||
def __rdivmod__(self, __x: int) -> tuple[int, int]: ...
|
||||
@overload
|
||||
def __pow__(self, __x: Literal[2], __modulo: int | None = ...) -> int: ...
|
||||
@overload
|
||||
def __pow__(self, __x: int, __modulo: int | None = ...) -> Any: ... # Return type can be int or float, depending on x.
|
||||
def __rpow__(self, x: int, mod: int | None = ...) -> Any: ...
|
||||
def __and__(self, n: int) -> int: ...
|
||||
def __or__(self, n: int) -> int: ...
|
||||
def __xor__(self, n: int) -> int: ...
|
||||
def __lshift__(self, n: int) -> int: ...
|
||||
def __rshift__(self, n: int) -> int: ...
|
||||
def __rand__(self, n: int) -> int: ...
|
||||
def __ror__(self, n: int) -> int: ...
|
||||
def __rxor__(self, n: int) -> int: ...
|
||||
def __rlshift__(self, n: int) -> int: ...
|
||||
def __rrshift__(self, n: int) -> int: ...
|
||||
def __rpow__(self, __x: int, __mod: int | None = ...) -> Any: ...
|
||||
def __and__(self, __n: int) -> int: ...
|
||||
def __or__(self, __n: int) -> int: ...
|
||||
def __xor__(self, __n: int) -> int: ...
|
||||
def __lshift__(self, __n: int) -> int: ...
|
||||
def __rshift__(self, __n: int) -> int: ...
|
||||
def __rand__(self, __n: int) -> int: ...
|
||||
def __ror__(self, __n: int) -> int: ...
|
||||
def __rxor__(self, __n: int) -> int: ...
|
||||
def __rlshift__(self, __n: int) -> int: ...
|
||||
def __rrshift__(self, __n: int) -> int: ...
|
||||
def __neg__(self) -> int: ...
|
||||
def __pos__(self) -> int: ...
|
||||
def __invert__(self) -> int: ...
|
||||
@@ -233,12 +233,12 @@ class int:
|
||||
def __floor__(self) -> int: ...
|
||||
def __round__(self, __ndigits: SupportsIndex = ...) -> int: ...
|
||||
def __getnewargs__(self) -> tuple[int]: ...
|
||||
def __eq__(self, x: object) -> bool: ...
|
||||
def __ne__(self, x: object) -> bool: ...
|
||||
def __lt__(self, x: int) -> bool: ...
|
||||
def __le__(self, x: int) -> bool: ...
|
||||
def __gt__(self, x: int) -> bool: ...
|
||||
def __ge__(self, x: int) -> bool: ...
|
||||
def __eq__(self, __x: object) -> bool: ...
|
||||
def __ne__(self, __x: object) -> bool: ...
|
||||
def __lt__(self, __x: int) -> bool: ...
|
||||
def __le__(self, __x: int) -> bool: ...
|
||||
def __gt__(self, __x: int) -> bool: ...
|
||||
def __ge__(self, __x: int) -> bool: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __float__(self) -> float: ...
|
||||
def __int__(self) -> int: ...
|
||||
@@ -644,20 +644,20 @@ class memoryview(Sized, Sequence[int]):
|
||||
def __init__(self, obj: ReadableBuffer) -> None: ...
|
||||
def __enter__(self: Self) -> Self: ...
|
||||
def __exit__(
|
||||
self, exc_type: Type[BaseException] | None, exc_val: BaseException | None, exc_tb: TracebackType | None
|
||||
self, __exc_type: Type[BaseException] | None, __exc_val: BaseException | None, __exc_tb: TracebackType | None
|
||||
) -> None: ...
|
||||
def cast(self, format: str, shape: list[int] | Tuple[int, ...] = ...) -> memoryview: ...
|
||||
@overload
|
||||
def __getitem__(self, i: SupportsIndex) -> int: ...
|
||||
def __getitem__(self, __i: SupportsIndex) -> int: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> memoryview: ...
|
||||
def __contains__(self, x: object) -> bool: ...
|
||||
def __getitem__(self, __s: slice) -> memoryview: ...
|
||||
def __contains__(self, __x: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[int]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: bytes) -> None: ...
|
||||
def __setitem__(self, __s: slice, __o: bytes) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, i: SupportsIndex, o: SupportsIndex) -> None: ...
|
||||
def __setitem__(self, __i: SupportsIndex, __o: SupportsIndex) -> None: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ...
|
||||
else:
|
||||
@@ -1422,7 +1422,7 @@ class BaseException(object):
|
||||
def __init__(self, *args: object) -> None: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def with_traceback(self: _TBE, tb: TracebackType | None) -> _TBE: ...
|
||||
def with_traceback(self: _TBE, __tb: TracebackType | None) -> _TBE: ...
|
||||
|
||||
class GeneratorExit(BaseException): ...
|
||||
class KeyboardInterrupt(BaseException): ...
|
||||
|
||||
Reference in New Issue
Block a user