mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 20:54:28 +08:00
Organize special forms in typing (#3966)
This is an accompanying PR for https://github.com/python/mypy/pull/8779, see https://github.com/python/mypy/pull/8779#issuecomment-624001349 I also noticed that Python 2 and Python 3 versions are a bit out of sync, so I also put them back in sync.
This commit is contained in:
@@ -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
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user