mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-07-29 11:16:44 +08:00
Drop Python 3.8 branches (#13776)
This commit is contained in:
@@ -1,12 +1,10 @@
|
||||
import sys
|
||||
from _collections_abc import dict_items, dict_keys, dict_values
|
||||
from _typeshed import SupportsItems, SupportsKeysAndGetItem, SupportsRichComparison, SupportsRichComparisonT
|
||||
from types import GenericAlias
|
||||
from typing import Any, ClassVar, Generic, NoReturn, SupportsIndex, TypeVar, final, overload
|
||||
from typing_extensions import Self
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
from types import GenericAlias
|
||||
|
||||
if sys.version_info >= (3, 10):
|
||||
from collections.abc import (
|
||||
Callable,
|
||||
@@ -93,20 +91,19 @@ class UserDict(MutableMapping[_KT, _VT]):
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: _S) -> UserDict[_T, _S]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@overload
|
||||
def __or__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ...
|
||||
# UserDict.__ior__ should be kept roughly in line with MutableMapping.update()
|
||||
@overload # type: ignore[misc]
|
||||
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ...
|
||||
# UserDict.__ior__ should be kept roughly in line with MutableMapping.update()
|
||||
@overload # type: ignore[misc]
|
||||
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
|
||||
if sys.version_info >= (3, 12):
|
||||
@overload
|
||||
def get(self, key: _KT, default: None = None) -> _VT | None: ...
|
||||
@@ -213,10 +210,8 @@ class UserString(Sequence[UserString]):
|
||||
def lstrip(self, chars: str | None = None) -> Self: ...
|
||||
maketrans = str.maketrans
|
||||
def partition(self, sep: str) -> tuple[str, str, str]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def removeprefix(self, prefix: str | UserString, /) -> Self: ...
|
||||
def removesuffix(self, suffix: str | UserString, /) -> Self: ...
|
||||
|
||||
def removeprefix(self, prefix: str | UserString, /) -> Self: ...
|
||||
def removesuffix(self, suffix: str | UserString, /) -> Self: ...
|
||||
def replace(self, old: str | UserString, new: str | UserString, maxsplit: int = -1) -> Self: ...
|
||||
def rfind(self, sub: str | UserString, start: int = 0, end: int = sys.maxsize) -> int: ...
|
||||
def rindex(self, sub: str | UserString, start: int = 0, end: int = sys.maxsize) -> int: ...
|
||||
@@ -271,8 +266,7 @@ class deque(MutableSequence[_T]):
|
||||
def __gt__(self, value: deque[_T], /) -> bool: ...
|
||||
def __ge__(self, value: deque[_T], /) -> bool: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
|
||||
|
||||
class Counter(dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
@@ -387,15 +381,14 @@ class OrderedDict(dict[_KT, _VT]):
|
||||
@overload
|
||||
def pop(self, key: _KT, default: _T) -> _VT | _T: ...
|
||||
def __eq__(self, value: object, /) -> bool: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@overload
|
||||
def __or__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, value: dict[_T1, _T2], /) -> OrderedDict[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_T1, _T2], /) -> OrderedDict[_KT | _T1, _VT | _T2]: ... # type: ignore[misc]
|
||||
@overload
|
||||
def __or__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, value: dict[_T1, _T2], /) -> OrderedDict[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_T1, _T2], /) -> OrderedDict[_KT | _T1, _VT | _T2]: ... # type: ignore[misc]
|
||||
|
||||
class defaultdict(dict[_KT, _VT]):
|
||||
default_factory: Callable[[], _VT] | None
|
||||
@@ -435,15 +428,14 @@ class defaultdict(dict[_KT, _VT]):
|
||||
def __missing__(self, key: _KT, /) -> _VT: ...
|
||||
def __copy__(self) -> Self: ...
|
||||
def copy(self) -> Self: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@overload
|
||||
def __or__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, value: dict[_T1, _T2], /) -> defaultdict[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_T1, _T2], /) -> defaultdict[_KT | _T1, _VT | _T2]: ... # type: ignore[misc]
|
||||
@overload
|
||||
def __or__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, value: dict[_T1, _T2], /) -> defaultdict[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_KT, _VT], /) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, value: dict[_T1, _T2], /) -> defaultdict[_KT | _T1, _VT | _T2]: ... # type: ignore[misc]
|
||||
|
||||
class ChainMap(MutableMapping[_KT, _VT]):
|
||||
maps: list[MutableMapping[_KT, _VT]]
|
||||
@@ -488,17 +480,16 @@ class ChainMap(MutableMapping[_KT, _VT]):
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T], value: _S, /) -> ChainMap[_T, _S]: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
@overload
|
||||
def __or__(self, other: Mapping[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, other: Mapping[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ...
|
||||
# ChainMap.__ior__ should be kept roughly in line with MutableMapping.update()
|
||||
@overload # type: ignore[misc]
|
||||
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, other: Mapping[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ...
|
||||
@overload
|
||||
def __ror__(self, other: Mapping[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ror__(self, other: Mapping[_T1, _T2]) -> ChainMap[_KT | _T1, _VT | _T2]: ...
|
||||
# ChainMap.__ior__ should be kept roughly in line with MutableMapping.update()
|
||||
@overload # type: ignore[misc]
|
||||
def __ior__(self, other: SupportsKeysAndGetItem[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __ior__(self, other: Iterable[tuple[_KT, _VT]]) -> Self: ...
|
||||
|
||||
Reference in New Issue
Block a user