mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +08:00
Fix non-subscriptable type aliases (#993)
This commit is contained in:
committed by
Guido van Rossum
parent
52da2a176b
commit
b430318ac0
@@ -1,6 +1,6 @@
|
||||
from typing import Any, IO, Sequence, Tuple, Union
|
||||
from typing import Any, IO, Sequence, Tuple, Union, List, Dict
|
||||
|
||||
__all__ = ... # type: list[str]
|
||||
__all__ = ... # type: List[str]
|
||||
DEFAULTSECT = ... # type: str
|
||||
MAX_INTERPOLATION_DEPTH = ... # type: int
|
||||
|
||||
@@ -42,7 +42,7 @@ class InterpolationDepthError(InterpolationError):
|
||||
|
||||
class ParsingError(Error):
|
||||
filename = ... # type: str
|
||||
errors = ... # type: list[Tuple[Any, Any]]
|
||||
errors = ... # type: List[Tuple[Any, Any]]
|
||||
def __init__(self, filename: str) -> None: ...
|
||||
def append(self, lineno: Any, line: Any) -> None: ...
|
||||
|
||||
@@ -60,20 +60,20 @@ class RawConfigParser:
|
||||
SECTCRE = ... # type: Any
|
||||
OPTCRE = ... # type: Any
|
||||
OPTCRE_NV = ... # type: Any
|
||||
def __init__(self, defaults: dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ...
|
||||
def defaults(self) -> dict[Any, Any]: ...
|
||||
def sections(self) -> list[str]: ...
|
||||
def __init__(self, defaults: Dict[Any, Any] = ..., dict_type: Any = ..., allow_no_value: bool = ...) -> None: ...
|
||||
def defaults(self) -> Dict[Any, Any]: ...
|
||||
def sections(self) -> List[str]: ...
|
||||
def add_section(self, section: str) -> None: ...
|
||||
def has_section(self, section: str) -> bool: ...
|
||||
def options(self, section: str) -> list[str]: ...
|
||||
def read(self, filenames: Union[str, Sequence[str]]) -> list[str]: ...
|
||||
def options(self, section: str) -> List[str]: ...
|
||||
def read(self, filenames: Union[str, Sequence[str]]) -> List[str]: ...
|
||||
def readfp(self, fp: IO[str], filename: str = ...) -> None: ...
|
||||
def get(self, section: str, option: str) -> str: ...
|
||||
def items(self, section: str) -> list[Tuple[Any, Any]]: ...
|
||||
def items(self, section: str) -> List[Tuple[Any, Any]]: ...
|
||||
def _get(self, section: str, conv: type, option: str) -> Any: ...
|
||||
def getint(self, section: str, option: str) -> int: ...
|
||||
def getfloat(self, section: str, option: str) -> float: ...
|
||||
_boolean_states = ... # type: dict[str, bool]
|
||||
_boolean_states = ... # type: Dict[str, bool]
|
||||
def getboolean(self, section: str, option: str) -> bool: ...
|
||||
def optionxform(self, optionstr: str) -> str: ...
|
||||
def has_option(self, section: str, option: str) -> bool: ...
|
||||
@@ -86,7 +86,7 @@ class RawConfigParser:
|
||||
class ConfigParser(RawConfigParser):
|
||||
_KEYCRE = ... # type: Any
|
||||
def get(self, section: str, option: str, raw: bool = ..., vars: dict = ...) -> Any: ...
|
||||
def items(self, section: str, raw: bool = ..., vars: dict = ...) -> list[Tuple[str, Any]]: ...
|
||||
def items(self, section: str, raw: bool = ..., vars: dict = ...) -> List[Tuple[str, Any]]: ...
|
||||
def _interpolate(self, section: str, option: str, rawval: Any, vars: Any) -> str: ...
|
||||
def _interpolation_replace(self, match: Any) -> str: ...
|
||||
|
||||
|
||||
@@ -586,33 +586,33 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
def add(self, element: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> set[_T]: ...
|
||||
def difference(self, *s: Iterable[Any]) -> set[_T]: ...
|
||||
def copy(self) -> Set[_T]: ...
|
||||
def difference(self, *s: Iterable[Any]) -> Set[_T]: ...
|
||||
def difference_update(self, *s: Iterable[Any]) -> None: ...
|
||||
def discard(self, element: _T) -> None: ...
|
||||
def intersection(self, *s: Iterable[Any]) -> set[_T]: ...
|
||||
def intersection(self, *s: Iterable[Any]) -> Set[_T]: ...
|
||||
def intersection_update(self, *s: Iterable[Any]) -> None: ...
|
||||
def isdisjoint(self, s: Iterable[Any]) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[Any]) -> bool: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...
|
||||
def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
|
||||
def union(self, *s: Iterable[_T]) -> set[_T]: ...
|
||||
def union(self, *s: Iterable[_T]) -> Set[_T]: ...
|
||||
def update(self, *s: Iterable[_T]) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __and__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __iand__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __or__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __ior__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __and__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __iand__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __le__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
|
||||
@@ -636,33 +636,33 @@ class set(MutableSet[_T], Generic[_T]):
|
||||
def __init__(self, iterable: Iterable[_T] = ...) -> None: ...
|
||||
def add(self, element: _T) -> None: ...
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> set[_T]: ...
|
||||
def difference(self, *s: Iterable[Any]) -> set[_T]: ...
|
||||
def copy(self) -> Set[_T]: ...
|
||||
def difference(self, *s: Iterable[Any]) -> Set[_T]: ...
|
||||
def difference_update(self, *s: Iterable[Any]) -> None: ...
|
||||
def discard(self, element: _T) -> None: ...
|
||||
def intersection(self, *s: Iterable[Any]) -> set[_T]: ...
|
||||
def intersection(self, *s: Iterable[Any]) -> Set[_T]: ...
|
||||
def intersection_update(self, *s: Iterable[Any]) -> None: ...
|
||||
def isdisjoint(self, s: Iterable[Any]) -> bool: ...
|
||||
def issubset(self, s: Iterable[Any]) -> bool: ...
|
||||
def issuperset(self, s: Iterable[Any]) -> bool: ...
|
||||
def pop(self) -> _T: ...
|
||||
def remove(self, element: _T) -> None: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> set[_T]: ...
|
||||
def symmetric_difference(self, s: Iterable[_T]) -> Set[_T]: ...
|
||||
def symmetric_difference_update(self, s: Iterable[_T]) -> None: ...
|
||||
def union(self, *s: Iterable[_T]) -> set[_T]: ...
|
||||
def union(self, *s: Iterable[_T]) -> Set[_T]: ...
|
||||
def update(self, *s: Iterable[_T]) -> None: ...
|
||||
def __len__(self) -> int: ...
|
||||
def __contains__(self, o: object) -> bool: ...
|
||||
def __iter__(self) -> Iterator[_T]: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __and__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __iand__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __or__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __ior__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> set[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> set[Union[_T, _S]]: ...
|
||||
def __and__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __iand__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __or__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __ior__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __sub__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __isub__(self, s: AbstractSet[Any]) -> Set[_T]: ...
|
||||
def __xor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __ixor__(self, s: AbstractSet[_S]) -> Set[Union[_T, _S]]: ...
|
||||
def __le__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __lt__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
def __ge__(self, s: AbstractSet[Any]) -> bool: ...
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
# These are not exported.
|
||||
import sys
|
||||
import typing
|
||||
from typing import (
|
||||
TypeVar, Generic, Dict, overload, List, Tuple,
|
||||
Callable, Any, Type, Optional, Union
|
||||
@@ -128,16 +129,16 @@ class Counter(Dict[_T, int], Generic[_T]):
|
||||
@overload
|
||||
def update(self, m: Union[Iterable[_T], Iterable[Tuple[_T, int]]]) -> None: ...
|
||||
|
||||
def __add__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __sub__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __and__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __or__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __pos__(self) -> Counter[_T]: ...
|
||||
def __neg__(self) -> Counter[_T]: ...
|
||||
def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __isub__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __iand__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __ior__(self, other: Counter[_T]) -> Counter[_T]: ...
|
||||
def __add__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
def __sub__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
def __and__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
def __or__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
def __pos__(self) -> typing.Counter[_T]: ...
|
||||
def __neg__(self) -> typing.Counter[_T]: ...
|
||||
def __iadd__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
def __isub__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
def __iand__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
def __ior__(self, other: typing.Counter[_T]) -> typing.Counter[_T]: ...
|
||||
|
||||
class OrderedDict(Dict[_KT, _VT], Reversible[_KT], Generic[_KT, _VT]):
|
||||
def popitem(self, last: bool = ...) -> Tuple[_KT, _VT]: ...
|
||||
@@ -176,10 +177,10 @@ if sys.version_info >= (3, 3):
|
||||
@property
|
||||
def maps(self) -> List[Mapping[_KT, _VT]]: ...
|
||||
|
||||
def new_child(self, m: Mapping[_KT, _VT] = ...) -> ChainMap[_KT, _VT]: ...
|
||||
def new_child(self, m: Mapping[_KT, _VT] = ...) -> typing.ChainMap[_KT, _VT]: ...
|
||||
|
||||
@property
|
||||
def parents(self) -> ChainMap[_KT, _VT]: ...
|
||||
def parents(self) -> typing.ChainMap[_KT, _VT]: ...
|
||||
|
||||
def __setitem__(self, k: _KT, v: _VT) -> None: ...
|
||||
def __delitem__(self, v: _KT) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user