mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-24 20:12:08 +08:00
Big diff: use lower-case list and dict (#5888)
This commit is contained in:
@@ -29,14 +29,12 @@ from typing import (
|
||||
BinaryIO,
|
||||
ByteString,
|
||||
Callable,
|
||||
Dict,
|
||||
FrozenSet,
|
||||
Generic,
|
||||
ItemsView,
|
||||
Iterable,
|
||||
Iterator,
|
||||
KeysView,
|
||||
List,
|
||||
Mapping,
|
||||
MutableMapping,
|
||||
MutableSequence,
|
||||
@@ -84,10 +82,10 @@ _TBE = TypeVar("_TBE", bound="BaseException")
|
||||
|
||||
class object:
|
||||
__doc__: str | None
|
||||
__dict__: Dict[str, Any]
|
||||
__dict__: dict[str, Any]
|
||||
__slots__: str | Iterable[str]
|
||||
__module__: str
|
||||
__annotations__: Dict[str, Any]
|
||||
__annotations__: dict[str, Any]
|
||||
@property
|
||||
def __class__(self: _T) -> Type[_T]: ...
|
||||
# Ignore errors about type mismatch between property getter and setter
|
||||
@@ -131,7 +129,7 @@ class type(object):
|
||||
__base__: type
|
||||
__bases__: Tuple[type, ...]
|
||||
__basicsize__: int
|
||||
__dict__: Dict[str, Any]
|
||||
__dict__: dict[str, Any]
|
||||
__dictoffset__: int
|
||||
__flags__: int
|
||||
__itemsize__: int
|
||||
@@ -144,16 +142,16 @@ class type(object):
|
||||
@overload
|
||||
def __init__(self, o: object) -> None: ...
|
||||
@overload
|
||||
def __init__(self, name: str, bases: Tuple[type, ...], dict: Dict[str, Any], **kwds: Any) -> None: ...
|
||||
def __init__(self, name: str, bases: Tuple[type, ...], dict: dict[str, Any], **kwds: Any) -> None: ...
|
||||
@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]: ...
|
||||
def __subclasses__(self: _TT) -> list[_TT]: ...
|
||||
# Note: the documentation doesnt specify what the return type is, the standard
|
||||
# implementation seems to be returning a list.
|
||||
def mro(self) -> List[type]: ...
|
||||
def mro(self) -> list[type]: ...
|
||||
def __instancecheck__(self, instance: Any) -> bool: ...
|
||||
def __subclasscheck__(self, subclass: type) -> bool: ...
|
||||
@classmethod
|
||||
@@ -378,10 +376,10 @@ class str(Sequence[str]):
|
||||
def rindex(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
|
||||
def rjust(self, __width: SupportsIndex, __fillchar: str = ...) -> str: ...
|
||||
def rpartition(self, __sep: str) -> Tuple[str, str, str]: ...
|
||||
def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
|
||||
def rsplit(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ...
|
||||
def rstrip(self, __chars: str | None = ...) -> str: ...
|
||||
def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> List[str]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[str]: ...
|
||||
def split(self, sep: str | None = ..., maxsplit: SupportsIndex = ...) -> list[str]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> list[str]: ...
|
||||
def startswith(
|
||||
self, __prefix: str | Tuple[str, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
|
||||
) -> bool: ...
|
||||
@@ -393,10 +391,10 @@ class str(Sequence[str]):
|
||||
def zfill(self, __width: SupportsIndex) -> str: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def maketrans(__x: Dict[int, _T] | Dict[str, _T] | Dict[str | int, _T]) -> Dict[int, _T]: ...
|
||||
def maketrans(__x: dict[int, _T] | dict[str, _T] | dict[str | int, _T]) -> dict[int, _T]: ...
|
||||
@staticmethod
|
||||
@overload
|
||||
def maketrans(__x: str, __y: str, __z: str | None = ...) -> Dict[int, int | None]: ...
|
||||
def maketrans(__x: str, __y: str, __z: str | None = ...) -> dict[int, int | None]: ...
|
||||
def __add__(self, s: str) -> str: ...
|
||||
# Incompatible with Sequence.__contains__
|
||||
def __contains__(self, o: str) -> bool: ... # type: ignore
|
||||
@@ -477,10 +475,10 @@ class bytes(ByteString):
|
||||
) -> int: ...
|
||||
def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytes: ...
|
||||
def rpartition(self, __sep: bytes) -> Tuple[bytes, bytes, bytes]: ...
|
||||
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
|
||||
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ...
|
||||
def rstrip(self, __bytes: bytes | None = ...) -> bytes: ...
|
||||
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytes]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[bytes]: ...
|
||||
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytes]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> list[bytes]: ...
|
||||
def startswith(
|
||||
self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
|
||||
) -> bool: ...
|
||||
@@ -579,10 +577,10 @@ class bytearray(MutableSequence[int], ByteString):
|
||||
) -> int: ...
|
||||
def rjust(self, __width: SupportsIndex, __fillchar: bytes = ...) -> bytearray: ...
|
||||
def rpartition(self, __sep: bytes) -> Tuple[bytearray, bytearray, bytearray]: ...
|
||||
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
|
||||
def rsplit(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ...
|
||||
def rstrip(self, __bytes: bytes | None = ...) -> bytearray: ...
|
||||
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> List[bytearray]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> List[bytearray]: ...
|
||||
def split(self, sep: bytes | None = ..., maxsplit: SupportsIndex = ...) -> list[bytearray]: ...
|
||||
def splitlines(self, keepends: bool = ...) -> list[bytearray]: ...
|
||||
def startswith(
|
||||
self, __prefix: bytes | Tuple[bytes, ...], __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...
|
||||
) -> bool: ...
|
||||
@@ -644,7 +642,7 @@ class memoryview(Sized, Sequence[int]):
|
||||
def __exit__(
|
||||
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: ...
|
||||
def cast(self, format: str, shape: list[int] | Tuple[int] = ...) -> memoryview: ...
|
||||
@overload
|
||||
def __getitem__(self, i: SupportsIndex) -> int: ...
|
||||
@overload
|
||||
@@ -660,7 +658,7 @@ class memoryview(Sized, Sequence[int]):
|
||||
def tobytes(self, order: Literal["C", "F", "A"] | None = ...) -> bytes: ...
|
||||
else:
|
||||
def tobytes(self) -> bytes: ...
|
||||
def tolist(self) -> List[int]: ...
|
||||
def tolist(self) -> list[int]: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
def toreadonly(self) -> memoryview: ...
|
||||
def release(self) -> None: ...
|
||||
@@ -739,7 +737,7 @@ class function:
|
||||
__module__: str
|
||||
__code__: CodeType
|
||||
__qualname__: str
|
||||
__annotations__: Dict[str, Any]
|
||||
__annotations__: dict[str, Any]
|
||||
|
||||
class list(MutableSequence[_T], Generic[_T]):
|
||||
@overload
|
||||
@@ -747,7 +745,7 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> List[_T]: ...
|
||||
def copy(self) -> list[_T]: ...
|
||||
def append(self, __object: _T) -> None: ...
|
||||
def extend(self, __iterable: Iterable[_T]) -> None: ...
|
||||
def pop(self, __index: SupportsIndex = ...) -> _T: ...
|
||||
@@ -757,7 +755,7 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
def remove(self, __value: _T) -> None: ...
|
||||
def reverse(self) -> None: ...
|
||||
@overload
|
||||
def sort(self: List[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ...
|
||||
def sort(self: list[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> None: ...
|
||||
@overload
|
||||
def sort(self, *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
@@ -767,38 +765,38 @@ class list(MutableSequence[_T], Generic[_T]):
|
||||
@overload
|
||||
def __getitem__(self, i: SupportsIndex) -> _T: ...
|
||||
@overload
|
||||
def __getitem__(self, s: slice) -> List[_T]: ...
|
||||
def __getitem__(self, s: slice) -> list[_T]: ...
|
||||
@overload
|
||||
def __setitem__(self, i: SupportsIndex, o: _T) -> None: ...
|
||||
@overload
|
||||
def __setitem__(self, s: slice, o: Iterable[_T]) -> None: ...
|
||||
def __delitem__(self, i: SupportsIndex | slice) -> None: ...
|
||||
def __add__(self, x: List[_T]) -> List[_T]: ...
|
||||
def __add__(self, x: list[_T]) -> list[_T]: ...
|
||||
def __iadd__(self: _S, x: Iterable[_T]) -> _S: ...
|
||||
def __mul__(self, n: SupportsIndex) -> List[_T]: ...
|
||||
def __rmul__(self, n: SupportsIndex) -> List[_T]: ...
|
||||
def __mul__(self, n: SupportsIndex) -> list[_T]: ...
|
||||
def __rmul__(self, n: SupportsIndex) -> list[_T]: ...
|
||||
def __imul__(self: _S, n: SupportsIndex) -> _S: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __reversed__(self) -> Iterator[_T]: ...
|
||||
def __gt__(self, x: List[_T]) -> bool: ...
|
||||
def __ge__(self, x: List[_T]) -> bool: ...
|
||||
def __lt__(self, x: List[_T]) -> bool: ...
|
||||
def __le__(self, x: List[_T]) -> bool: ...
|
||||
def __gt__(self, x: list[_T]) -> bool: ...
|
||||
def __ge__(self, x: list[_T]) -> bool: ...
|
||||
def __lt__(self, x: list[_T]) -> bool: ...
|
||||
def __le__(self, x: list[_T]) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self: Dict[_KT, _VT]) -> None: ...
|
||||
def __init__(self: dict[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self: Dict[str, _VT], **kwargs: _VT) -> None: ...
|
||||
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def __new__(cls: Type[_T1], *args: Any, **kwargs: Any) -> _T1: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> Dict[_KT, _VT]: ...
|
||||
def copy(self) -> dict[_KT, _VT]: ...
|
||||
def popitem(self) -> Tuple[_KT, _VT]: ...
|
||||
def setdefault(self, __key: _KT, __default: _VT = ...) -> _VT: ...
|
||||
@overload
|
||||
@@ -827,9 +825,9 @@ class dict(MutableMapping[_KT, _VT], Generic[_KT, _VT]):
|
||||
__hash__: None # type: ignore
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
def __or__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ...
|
||||
def __ror__(self, __value: Mapping[_T1, _T2]) -> Dict[_KT | _T1, _VT | _T2]: ...
|
||||
def __ior__(self, __value: Mapping[_KT, _VT]) -> Dict[_KT, _VT]: ... # type: ignore
|
||||
def __or__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ...
|
||||
def __ror__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT | _T2]: ...
|
||||
def __ior__(self, __value: Mapping[_KT, _VT]) -> dict[_KT, _VT]: ... # type: ignore
|
||||
|
||||
class set(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
@@ -998,16 +996,16 @@ else:
|
||||
def copyright() -> None: ...
|
||||
def credits() -> None: ...
|
||||
def delattr(__obj: Any, __name: str) -> None: ...
|
||||
def dir(__o: object = ...) -> List[str]: ...
|
||||
def dir(__o: object = ...) -> list[str]: ...
|
||||
@overload
|
||||
def divmod(__x: SupportsDivMod[_T_contra, _T_co], __y: _T_contra) -> _T_co: ...
|
||||
@overload
|
||||
def divmod(__x: _T_contra, __y: SupportsRDivMod[_T_contra, _T_co]) -> _T_co: ...
|
||||
def eval(
|
||||
__source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
|
||||
__source: str | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
|
||||
) -> Any: ...
|
||||
def exec(
|
||||
__source: str | bytes | CodeType, __globals: Dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
|
||||
__source: str | bytes | CodeType, __globals: dict[str, Any] | None = ..., __locals: Mapping[str, Any] | None = ...
|
||||
) -> Any: ...
|
||||
def exit(code: object = ...) -> NoReturn: ...
|
||||
|
||||
@@ -1031,7 +1029,7 @@ def getattr(__o: object, name: str, __default: None) -> Any | None: ...
|
||||
def getattr(__o: object, name: str, __default: bool) -> Any | bool: ...
|
||||
@overload
|
||||
def getattr(__o: object, name: str, __default: _T) -> Any | _T: ...
|
||||
def globals() -> Dict[str, Any]: ...
|
||||
def globals() -> dict[str, Any]: ...
|
||||
def hasattr(__obj: object, __name: str) -> bool: ...
|
||||
def hash(__obj: object) -> int: ...
|
||||
def help(*args: Any, **kwds: Any) -> None: ...
|
||||
@@ -1059,7 +1057,7 @@ else:
|
||||
|
||||
def len(__obj: Sized) -> int: ...
|
||||
def license() -> None: ...
|
||||
def locals() -> Dict[str, Any]: ...
|
||||
def locals() -> dict[str, Any]: ...
|
||||
|
||||
class map(Iterator[_S], Generic[_S]):
|
||||
@overload
|
||||
@@ -1286,9 +1284,9 @@ def round(number: SupportsRound[Any], ndigits: None) -> int: ...
|
||||
def round(number: SupportsRound[_T], ndigits: SupportsIndex) -> _T: ...
|
||||
def setattr(__obj: object, __name: str, __value: Any) -> None: ...
|
||||
@overload
|
||||
def sorted(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> List[SupportsLessThanT]: ...
|
||||
def sorted(__iterable: Iterable[SupportsLessThanT], *, key: None = ..., reverse: bool = ...) -> list[SupportsLessThanT]: ...
|
||||
@overload
|
||||
def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> List[_T]: ...
|
||||
def sorted(__iterable: Iterable[_T], *, key: Callable[[_T], SupportsLessThan], reverse: bool = ...) -> list[_T]: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
@@ -1302,7 +1300,7 @@ else:
|
||||
@overload
|
||||
def sum(__iterable: Iterable[_T], __start: _S) -> _T | _S: ...
|
||||
|
||||
def vars(__object: Any = ...) -> Dict[str, Any]: ...
|
||||
def vars(__object: Any = ...) -> dict[str, Any]: ...
|
||||
|
||||
class zip(Iterator[_T_co], Generic[_T_co]):
|
||||
@overload
|
||||
|
||||
Reference in New Issue
Block a user