| Conditions | 1 |
| Total Lines | 10 |
| Code Lines | 3 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import typing |
||
| 7 | @lru_cache() |
||
| 8 | def get_alias(cls: T) -> typing.Optional[T]: |
||
| 9 | """ |
||
| 10 | Return the alias from the ``typing`` module for ``cls``. For example, for |
||
| 11 | ``cls=list``, the result would be ``typing.List``. If no alias exists for |
||
| 12 | ``cls``, then ``None`` is returned. |
||
| 13 | :param cls: the type for which the ``typing`` equivalent is to be found. |
||
| 14 | :return: the alias from ``typing``. |
||
| 15 | """ |
||
| 16 | return _alias_per_type.get(cls.__name__, None) |
||
| 17 | |||
| 30 |