mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Use lowercase type everywhere (#6853)
This commit is contained in:
@@ -49,7 +49,6 @@ from typing import (
|
||||
SupportsFloat,
|
||||
SupportsInt,
|
||||
SupportsRound,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
overload,
|
||||
@@ -89,12 +88,12 @@ class object:
|
||||
__module__: str
|
||||
__annotations__: dict[str, Any]
|
||||
@property
|
||||
def __class__(self: _T) -> Type[_T]: ...
|
||||
def __class__(self: _T) -> type[_T]: ...
|
||||
# Ignore errors about type mismatch between property getter and setter
|
||||
@__class__.setter
|
||||
def __class__(self, __type: Type[object]) -> None: ... # type: ignore # noqa: F811
|
||||
def __class__(self, __type: type[object]) -> None: ... # type: ignore # noqa: F811
|
||||
def __init__(self) -> None: ...
|
||||
def __new__(cls: Type[_T]) -> _T: ...
|
||||
def __new__(cls: type[_T]) -> _T: ...
|
||||
def __setattr__(self, __name: str, __value: Any) -> None: ...
|
||||
def __eq__(self, __o: object) -> bool: ...
|
||||
def __ne__(self, __o: object) -> bool: ...
|
||||
@@ -119,8 +118,8 @@ class staticmethod(Generic[_R]): # Special, only valid as a decorator.
|
||||
__func__: Callable[..., _R]
|
||||
__isabstractmethod__: bool
|
||||
def __init__(self: staticmethod[_R], __f: Callable[..., _R]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: Type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
@@ -131,8 +130,8 @@ class classmethod(Generic[_R]): # Special, only valid as a decorator.
|
||||
__func__: Callable[..., _R]
|
||||
__isabstractmethod__: bool
|
||||
def __init__(self: classmethod[_R], __f: Callable[..., _R]) -> None: ...
|
||||
def __new__(cls: Type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: Type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
def __new__(cls: type[_T], *args: Any, **kwargs: Any) -> _T: ...
|
||||
def __get__(self, __obj: _T, __type: type[_T] | None = ...) -> Callable[..., _R]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
__name__: str
|
||||
__qualname__: str
|
||||
@@ -159,7 +158,7 @@ class type:
|
||||
@overload
|
||||
def __new__(cls, __o: object) -> type: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_TT], __name: str, __bases: tuple[type, ...], __namespace: dict[str, Any], **kwds: Any) -> _TT: ...
|
||||
def __new__(cls: type[_TT], __name: str, __bases: tuple[type, ...], __namespace: dict[str, Any], **kwds: Any) -> _TT: ...
|
||||
def __call__(self, *args: Any, **kwds: Any) -> Any: ...
|
||||
def __subclasses__(self: _TT) -> list[_TT]: ...
|
||||
# Note: the documentation doesn't specify what the return type is, the standard
|
||||
@@ -186,9 +185,9 @@ _NegativeInteger = Literal[-1, -2, -3, -4, -5, -6, -7, -8, -9, -10, -11, -12, -1
|
||||
|
||||
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
|
||||
@@ -206,7 +205,7 @@ class int:
|
||||
def to_bytes(self, length: SupportsIndex, byteorder: Literal["little", "big"], *, signed: bool = ...) -> bytes: ...
|
||||
@classmethod
|
||||
def from_bytes(
|
||||
cls: Type[Self],
|
||||
cls: type[Self],
|
||||
bytes: Iterable[SupportsIndex] | SupportsBytes, # TODO buffer object argument
|
||||
byteorder: Literal["little", "big"],
|
||||
*,
|
||||
@@ -272,12 +271,12 @@ class int:
|
||||
def __index__(self) -> int: ...
|
||||
|
||||
class float:
|
||||
def __new__(cls: Type[_T], x: SupportsFloat | SupportsIndex | str | bytes | bytearray = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], x: SupportsFloat | SupportsIndex | str | bytes | bytearray = ...) -> _T: ...
|
||||
def as_integer_ratio(self) -> tuple[int, int]: ...
|
||||
def hex(self) -> str: ...
|
||||
def is_integer(self) -> bool: ...
|
||||
@classmethod
|
||||
def fromhex(cls: Type[Self], __s: str) -> Self: ...
|
||||
def fromhex(cls: type[Self], __s: str) -> Self: ...
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
@@ -330,9 +329,9 @@ class float:
|
||||
|
||||
class complex:
|
||||
@overload
|
||||
def __new__(cls: Type[_T], real: float = ..., imag: float = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], real: float = ..., imag: float = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], real: str | SupportsComplex | SupportsIndex | complex) -> _T: ...
|
||||
def __new__(cls: type[_T], real: str | SupportsComplex | SupportsIndex | complex) -> _T: ...
|
||||
@property
|
||||
def real(self) -> float: ...
|
||||
@property
|
||||
@@ -364,9 +363,9 @@ class _FormatMapMapping(Protocol):
|
||||
|
||||
class str(Sequence[str]):
|
||||
@overload
|
||||
def __new__(cls: Type[_T], object: object = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], object: object = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], o: bytes, encoding: str = ..., errors: str = ...) -> _T: ...
|
||||
def capitalize(self) -> str: ...
|
||||
def casefold(self) -> str: ...
|
||||
def center(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
|
||||
@@ -450,15 +449,15 @@ class str(Sequence[str]):
|
||||
|
||||
class bytes(ByteString):
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __ints: Iterable[SupportsIndex]) -> _T: ...
|
||||
def __new__(cls: type[_T], __ints: Iterable[SupportsIndex]) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __string: str, encoding: str, errors: str = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __string: str, encoding: str, errors: str = ...) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __length: SupportsIndex) -> _T: ...
|
||||
def __new__(cls: type[_T], __length: SupportsIndex) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T]) -> _T: ...
|
||||
def __new__(cls: type[_T]) -> _T: ...
|
||||
@overload
|
||||
def __new__(cls: Type[_T], __o: SupportsBytes) -> _T: ...
|
||||
def __new__(cls: type[_T], __o: SupportsBytes) -> _T: ...
|
||||
def capitalize(self) -> bytes: ...
|
||||
def center(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
|
||||
def count(
|
||||
@@ -522,7 +521,7 @@ class bytes(ByteString):
|
||||
def upper(self) -> bytes: ...
|
||||
def zfill(self, __width: SupportsIndex) -> bytes: ...
|
||||
@classmethod
|
||||
def fromhex(cls: Type[Self], __s: str) -> Self: ...
|
||||
def fromhex(cls: type[Self], __s: str) -> Self: ...
|
||||
@staticmethod
|
||||
def maketrans(__frm: bytes, __to: bytes) -> bytes: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -626,7 +625,7 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
def upper(self) -> bytearray: ...
|
||||
def zfill(self, __width: SupportsIndex) -> bytearray: ...
|
||||
@classmethod
|
||||
def fromhex(cls: Type[Self], __string: str) -> Self: ...
|
||||
def fromhex(cls: type[Self], __string: str) -> Self: ...
|
||||
@staticmethod
|
||||
def maketrans(__frm: bytes, __to: bytes) -> bytes: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -676,7 +675,7 @@ 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
|
||||
@@ -705,7 +704,7 @@ class memoryview(Sized, Sequence[int]):
|
||||
|
||||
@final
|
||||
class bool(int):
|
||||
def __new__(cls: Type[_T], __o: object = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __o: object = ...) -> _T: ...
|
||||
@overload
|
||||
def __and__(self, __x: bool) -> bool: ...
|
||||
@overload
|
||||
@@ -748,7 +747,7 @@ class slice:
|
||||
def indices(self, __len: SupportsIndex) -> tuple[int, int, int]: ...
|
||||
|
||||
class tuple(Sequence[_T_co], Generic[_T_co]):
|
||||
def __new__(cls: Type[_T], __iterable: Iterable[_T_co] = ...) -> _T: ...
|
||||
def __new__(cls: type[_T], __iterable: Iterable[_T_co] = ...) -> _T: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, __x: object) -> bool: ...
|
||||
@overload
|
||||
@@ -848,7 +847,7 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
# Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error
|
||||
@overload
|
||||
def __init__(self: dict[str, str], __iterable: Iterable[list[str]]) -> None: ...
|
||||
def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
|
||||
def __new__(cls: type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
|
||||
def copy(self) -> dict[_KT, _VT]: ...
|
||||
def keys(self) -> dict_keys[_KT, _VT]: ...
|
||||
def values(self) -> dict_values[_KT, _VT]: ...
|
||||
|
||||
Reference in New Issue
Block a user