mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-28 14:46:55 +08:00
Remove third_party/3/enum.py (#2563)
All Python 3 versions supported by typeshed (3.4+) have enum as part of the standard library. Make the third-party Python 2 version consistent with the Python 3 version.
This commit is contained in:
committed by
Jelle Zijlstra
parent
07bc1c9997
commit
e3a79d0ce6
31
third_party/2/enum.pyi
vendored
31
third_party/2/enum.pyi
vendored
@@ -1,4 +1,6 @@
|
||||
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type, Sized, Reversible, Container, Mapping
|
||||
# NB: third_party/2/enum.pyi and stdlib/3.4/enum.pyi must remain consistent!
|
||||
import sys
|
||||
from typing import Any, Iterator, List, Mapping, Type, TypeVar, Union
|
||||
from abc import ABCMeta
|
||||
|
||||
_T = TypeVar('_T')
|
||||
@@ -34,3 +36,30 @@ class IntEnum(int, Enum):
|
||||
value = ... # type: int
|
||||
|
||||
def unique(enumeration: _S) -> _S: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_auto_null = ... # type: Any
|
||||
|
||||
# subclassing IntFlag so it picks up all implemented base functions, best modeling behavior of enum.auto()
|
||||
class auto(IntFlag):
|
||||
value = ... # type: Any
|
||||
|
||||
class Flag(Enum):
|
||||
def __contains__(self: _T, other: _T) -> bool: ...
|
||||
def __repr__(self) -> str: ...
|
||||
def __str__(self) -> str: ...
|
||||
def __bool__(self) -> bool: ...
|
||||
def __or__(self: _T, other: _T) -> _T: ...
|
||||
def __and__(self: _T, other: _T) -> _T: ...
|
||||
def __xor__(self: _T, other: _T) -> _T: ...
|
||||
def __invert__(self: _T) -> _T: ...
|
||||
|
||||
# The `type: ignore` comment is needed because mypy considers the type
|
||||
# signatures of several methods defined in int and Flag to be incompatible.
|
||||
class IntFlag(int, Flag): # type: ignore
|
||||
def __or__(self: _T, other: Union[int, _T]) -> _T: ...
|
||||
def __and__(self: _T, other: Union[int, _T]) -> _T: ...
|
||||
def __xor__(self: _T, other: Union[int, _T]) -> _T: ...
|
||||
__ror__ = __or__
|
||||
__rand__ = __and__
|
||||
__rxor__ = __xor__
|
||||
|
||||
Reference in New Issue
Block a user