From f44e461d198f09a9c2ba5d364df040ae480ef725 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 4 Apr 2017 23:48:19 -0700 Subject: [PATCH] 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 --- stdlib/3.4/enum.pyi | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stdlib/3.4/enum.pyi b/stdlib/3.4/enum.pyi index 4f27d33f2..96a3a0a18 100644 --- a/stdlib/3.4/enum.pyi +++ b/stdlib/3.4/enum.pyi @@ -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