Add __class_getitem__ to builtins generified in PEP 585 (#4184)

* Add __class_getitem__ to builtins generified in PEP 585

* Declare types.GenericAlias and use it in __class_getitem__
This commit is contained in:
Mikhail Golubev
2020-06-10 06:10:07 +03:00
committed by GitHub
parent afe1e543b3
commit 85281b636e
3 changed files with 38 additions and 0 deletions

View File

@@ -286,3 +286,11 @@ def prepare_class(name: str, bases: Tuple[type, ...] = ..., kwds: Dict[str, Any]
DynamicClassAttribute = property
def coroutine(f: Callable[..., Any]) -> CoroutineType: ...
if sys.version_info >= (3, 9):
class GenericAlias:
__origin__: type
__args__: Tuple[Any, ...]
__parameters__: Tuple[Any, ...]
def __init__(self, origin: type, args: Any): ...
def __getattr__(self, name: str) -> Any: ... # incomplete