Python typing compatibility library
In Python >=3.8 the typing.get_origin
and typing.get_args
functions are
provided. This library aims to bring the identical behaviour of these functions
to other versions of Python.
pip install typing-compat
>>> from typing import List, Tuple, TypeVar
>>> from typing_compat import get_args, get_origin
>>> T = TypeVar('T')
>>> tp = List[Tuple[T, T]][int]
>>> get_args(tp)
(typing.Tuple[int, int],)
>>> get_origin(tp)
<class 'list'>
This library is licensed under either of
at your option.