mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-20 10:51:15 +08:00
Use PEP 585 syntax in Python 2, protobuf & _ast stubs, where possible (#6949)
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import sys
|
||||
from _typeshed import Self
|
||||
from abc import ABCMeta
|
||||
from typing import Any, Dict, Iterator, List, Mapping, Type, TypeVar, Union
|
||||
from typing import Any, Iterator, Mapping, TypeVar, Union
|
||||
|
||||
_T = TypeVar("_T")
|
||||
_S = TypeVar("_S", bound=Type[Enum])
|
||||
_S = TypeVar("_S", bound=type[Enum])
|
||||
|
||||
# Note: EnumMeta actually subclasses type directly, not ABCMeta.
|
||||
# This is a temporary workaround to allow multiple creation of enums with builtins
|
||||
@@ -12,12 +12,12 @@ _S = TypeVar("_S", bound=Type[Enum])
|
||||
# spurious inconsistent metaclass structure. See #1595.
|
||||
# Structurally: Iterable[T], Reversible[T], Container[T] where T is the enum itself
|
||||
class EnumMeta(ABCMeta):
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: Type[_T]) -> Iterator[_T]: ...
|
||||
def __iter__(self: type[_T]) -> Iterator[_T]: ...
|
||||
def __reversed__(self: type[_T]) -> Iterator[_T]: ...
|
||||
def __contains__(self, member: object) -> bool: ...
|
||||
def __getitem__(self: Type[_T], name: str) -> _T: ...
|
||||
def __getitem__(self: type[_T], name: str) -> _T: ...
|
||||
@property
|
||||
def __members__(self: Type[_T]) -> Mapping[str, _T]: ...
|
||||
def __members__(self: type[_T]) -> Mapping[str, _T]: ...
|
||||
def __len__(self) -> int: ...
|
||||
|
||||
class Enum(metaclass=EnumMeta):
|
||||
@@ -25,21 +25,21 @@ class Enum(metaclass=EnumMeta):
|
||||
value: Any
|
||||
_name_: str
|
||||
_value_: Any
|
||||
_member_names_: List[str] # undocumented
|
||||
_member_map_: Dict[str, Enum] # undocumented
|
||||
_value2member_map_: Dict[int, Enum] # undocumented
|
||||
_member_names_: list[str] # undocumented
|
||||
_member_map_: dict[str, Enum] # undocumented
|
||||
_value2member_map_: dict[int, Enum] # undocumented
|
||||
if sys.version_info >= (3, 7):
|
||||
_ignore_: Union[str, List[str]]
|
||||
_ignore_: Union[str, list[str]]
|
||||
_order_: str
|
||||
__order__: str
|
||||
@classmethod
|
||||
def _missing_(cls, value: object) -> Any: ...
|
||||
@staticmethod
|
||||
def _generate_next_value_(name: str, start: int, count: int, last_values: List[Any]) -> Any: ...
|
||||
def __new__(cls: Type[_T], value: object) -> _T: ...
|
||||
def _generate_next_value_(name: str, start: int, count: int, last_values: list[Any]) -> Any: ...
|
||||
def __new__(cls: type[_T], value: object) -> _T: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __dir__(self) -> List[str]: ...
|
||||
def __dir__(self) -> list[str]: ...
|
||||
def __format__(self, format_spec: str) -> str: ...
|
||||
def __hash__(self) -> Any: ...
|
||||
def __reduce_ex__(self, proto: object) -> Any: ...
|
||||
|
||||
Reference in New Issue
Block a user