chore(deps): update pytype and pyright (#11595)

This commit is contained in:
renovate[bot]
2024-03-14 09:28:09 +01:00
committed by GitHub
parent a1bfd65e9f
commit 48106feed7
12 changed files with 76 additions and 52 deletions

View File

@@ -137,8 +137,10 @@ class UserList(MutableSequence[_T]):
def copy(self) -> Self: ...
def __copy__(self) -> Self: ...
def count(self, item: _T) -> int: ...
# All arguments are passed to `list.index` at runtime, so the signature should be kept in line with `list.index`.
def index(self, item: _T, __start: SupportsIndex = 0, __stop: SupportsIndex = sys.maxsize) -> int: ...
# The runtime signature is "item, *args", and the arguments are then passed
# to `list.index`. In order to give more precise types, we pretend that the
# `item` argument is positional-only.
def index(self, item: _T, start: SupportsIndex = 0, stop: SupportsIndex = sys.maxsize, /) -> int: ...
# All arguments are passed to `list.sort` at runtime, so the signature should be kept in line with `list.sort`.
@overload
def sort(self: UserList[SupportsRichComparisonT], *, key: None = None, reverse: bool = False) -> None: ...
@@ -459,7 +461,11 @@ class ChainMap(MutableMapping[_KT, _VT]):
# All arguments to `fromkeys` are passed to `dict.fromkeys` at runtime, so the signature should be kept in line with `dict.fromkeys`.
@classmethod
@overload
def fromkeys(cls, iterable: Iterable[_T], __value: None = None) -> ChainMap[_T, Any | None]: ...
def fromkeys(cls, iterable: Iterable[_T]) -> ChainMap[_T, Any | None]: ...
@classmethod
@overload
# Special-case None: the user probably wants to add non-None values later.
def fromkeys(cls, iterable: Iterable[_T], value: None, /) -> ChainMap[_T, Any | None]: ...
@classmethod
@overload
def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> ChainMap[_T, _S]: ...

View File

@@ -227,16 +227,18 @@ if sys.version_info >= (3, 9):
else:
class _InitVarMeta(type):
# Not used, instead `InitVar.__class_getitem__` is called.
def __getitem__(self, params: Any) -> InitVar[Any]: ...
# pyright ignore is needed because pyright (not unreasonably) thinks this
# is an invalid use of InitVar.
def __getitem__(self, params: Any) -> InitVar[Any]: ... # pyright: ignore
class InitVar(Generic[_T], metaclass=_InitVarMeta):
type: Type[_T]
def __init__(self, type: Type[_T]) -> None: ...
if sys.version_info >= (3, 9):
@overload
def __class_getitem__(cls, type: Type[_T]) -> InitVar[_T]: ...
def __class_getitem__(cls, type: Type[_T]) -> InitVar[_T]: ... # pyright: ignore
@overload
def __class_getitem__(cls, type: Any) -> InitVar[Any]: ...
def __class_getitem__(cls, type: Any) -> InitVar[Any]: ... # pyright: ignore
if sys.version_info >= (3, 12):
def make_dataclass(