| Conditions | 1 |
| Total Lines | 11 |
| Code Lines | 5 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import typing |
||
| 4 | def get_args(t: type) -> typing.Tuple[type, ...]: |
||
| 5 | """ |
||
| 6 | Get the arguments from a collection type (e.g. ``typing.List[int]``) as a |
||
| 7 | ``tuple``. |
||
| 8 | :param t: the collection type. |
||
| 9 | :return: a ``tuple`` containing types. |
||
| 10 | """ |
||
| 11 | args_ = getattr(t, '__args__', tuple()) or tuple() |
||
| 12 | args = tuple([attr for attr in args_ |
||
| 13 | if type(attr) != typing.TypeVar]) |
||
| 14 | return args |
||
| 15 |