mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Use a separate type variable for unique() (#1138)
* Use a separate type variable for unique() See https://github.com/python/typeshed/pull/1136#discussion_r109727053 * actually use the new typevar
This commit is contained in:
committed by
Jelle Zijlstra
parent
47c325c0ae
commit
f44e461d19
@@ -2,6 +2,7 @@ import sys
|
||||
from typing import List, Any, TypeVar, Union, Iterable, Iterator, TypeVar, Generic, Type
|
||||
|
||||
_T = TypeVar('_T', bound=Enum)
|
||||
_S = TypeVar('_S', bound=Type[Enum])
|
||||
|
||||
class EnumMeta(type, Iterable[Enum]):
|
||||
def __iter__(self: Type[_T]) -> Iterator[_T]: ... # type: ignore
|
||||
@@ -21,7 +22,7 @@ class Enum(metaclass=EnumMeta):
|
||||
class IntEnum(int, Enum):
|
||||
value = ... # type: int
|
||||
|
||||
def unique(enumeration: _T) -> _T: ...
|
||||
def unique(enumeration: _S) -> _S: ...
|
||||
|
||||
if sys.version_info >= (3, 6):
|
||||
_auto_null = ... # type: Any
|
||||
|
||||
Reference in New Issue
Block a user