Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions stdlib/2/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ _promote = object()
class _SpecialForm(object):
def __getitem__(self, typeargs: Any) -> object: ...

Union: _SpecialForm = ...
Optional: _SpecialForm = ...
Tuple: _SpecialForm = ...
Generic: _SpecialForm = ...
Protocol: _SpecialForm = ...
Expand Down Expand Up @@ -53,20 +55,17 @@ def no_type_check_decorator(decorator: _C) -> _C: ...

# Type aliases and type constructors

class TypeAlias:
class _Alias:
# Class for defining generic aliases for library types.
def __init__(self, target_type: type) -> None: ...
def __getitem__(self, typeargs: Any) -> Any: ...

Union = TypeAlias(object)
Optional = TypeAlias(object)
List = TypeAlias(object)
Dict = TypeAlias(object)
DefaultDict = TypeAlias(object)
Set = TypeAlias(object)
FrozenSet = TypeAlias(object)
Counter = TypeAlias(object)
Deque = TypeAlias(object)
List = _Alias()
Dict = _Alias()
DefaultDict = _Alias()
Set = _Alias()
FrozenSet = _Alias()
Counter = _Alias()
Deque = _Alias()

# Predefined type variables.
AnyStr = TypeVar('AnyStr', str, unicode)
Expand Down
6 changes: 3 additions & 3 deletions stdlib/3/typing.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@ TypeVar = object()
_promote = object()

class _SpecialForm:
def __getitem__(self, typeargs: Any) -> Any: ...
def __getitem__(self, typeargs: Any) -> object: ...

Union: _SpecialForm = ...
Optional: _SpecialForm = ...
Tuple: _SpecialForm = ...
Generic: _SpecialForm = ...
# Protocol is only present in 3.8 and later, but mypy needs it unconditionally
Expand Down Expand Up @@ -61,8 +63,6 @@ class _Alias:
# Class for defining generic aliases for library types.
def __getitem__(self, typeargs: Any) -> Any: ...

Union = _Alias()
Optional = _Alias()
List = _Alias()
Dict = _Alias()
DefaultDict = _Alias()
Expand Down