mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 05:24:52 +08:00
Switch to PEP-604 syntax in python2 stubs (#5915)
Signed-off-by: oleg.hoefling <oleg.hoefling@gmail.com>
This commit is contained in:
@@ -16,14 +16,12 @@ from typing import (
|
||||
MutableMapping as MutableMapping,
|
||||
MutableSequence as MutableSequence,
|
||||
MutableSet as MutableSet,
|
||||
Optional,
|
||||
Reversible,
|
||||
Sequence as Sequence,
|
||||
Sized as Sized,
|
||||
Tuple,
|
||||
Type,
|
||||
TypeVar,
|
||||
Union,
|
||||
ValuesView as ValuesView,
|
||||
overload,
|
||||
)
|
||||
@@ -37,16 +35,13 @@ _VT = TypeVar("_VT")
|
||||
|
||||
# namedtuple is special-cased in the type checker; the initializer is ignored.
|
||||
def namedtuple(
|
||||
typename: Union[str, unicode],
|
||||
field_names: Union[str, unicode, Iterable[Union[str, unicode]]],
|
||||
verbose: bool = ...,
|
||||
rename: bool = ...,
|
||||
typename: str | unicode, field_names: str | unicode | Iterable[str | unicode], verbose: bool = ..., rename: bool = ...
|
||||
) -> Type[Tuple[Any, ...]]: ...
|
||||
|
||||
class deque(Sized, Iterable[_T], Reversible[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ..., maxlen: int = ...) -> None: ...
|
||||
@property
|
||||
def maxlen(self) -> Optional[int]: ...
|
||||
def maxlen(self) -> int | None: ...
|
||||
def append(self, x: _T) -> None: ...
|
||||
def appendleft(self, x: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
@@ -77,7 +72,7 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T]) -> None: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
def elements(self) -> Iterator[_T]: ...
|
||||
def most_common(self, n: Optional[int] = ...) -> List[Tuple[_T, int]]: ...
|
||||
def most_common(self, n: int | None = ...) -> List[Tuple[_T, int]]: ...
|
||||
@overload
|
||||
def subtract(self, __mapping: Mapping[_T, int]) -> None: ...
|
||||
@overload
|
||||
@@ -90,7 +85,7 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
def update(self, __m: Mapping[_T, int], **kwargs: int) -> None: ...
|
||||
@overload
|
||||
def update(self, __m: Union[Iterable[_T], Iterable[Tuple[_T, int]]], **kwargs: int) -> None: ...
|
||||
def update(self, __m: Iterable[_T] | Iterable[Tuple[_T, int]], **kwargs: int) -> None: ...
|
||||
@overload
|
||||
def update(self, **kwargs: int) -> None: ...
|
||||
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
@@ -112,18 +107,16 @@ class defaultdict(Dict[_KT, _VT], Generic[_KT, _VT]):
|
||||
@overload
|
||||
def __init__(self, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]]) -> None: ...
|
||||
def __init__(self, default_factory: Callable[[], _VT] | None) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]], **kwargs: _VT) -> None: ...
|
||||
def __init__(self, default_factory: Callable[[], _VT] | None, **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT]) -> None: ...
|
||||
def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT]) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]], map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
def __init__(self, default_factory: Callable[[], _VT] | None, map: Mapping[_KT, _VT], **kwargs: _VT) -> None: ...
|
||||
@overload
|
||||
def __init__(self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]]) -> None: ...
|
||||
@overload
|
||||
def __init__(
|
||||
self, default_factory: Optional[Callable[[], _VT]], iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT
|
||||
) -> None: ...
|
||||
def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[Tuple[_KT, _VT]], **kwargs: _VT) -> None: ...
|
||||
def __missing__(self, key: _KT) -> _VT: ...
|
||||
def copy(self: _S) -> _S: ...
|
||||
|
||||
Reference in New Issue
Block a user