| Conditions | 1 |
| Total Lines | 11 |
| Code Lines | 4 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from typing import Union |
||
| 19 | def default_namedtuple_serializer(obj: tuple, **kwargs) -> dict: |
||
| 20 | """ |
||
| 21 | Serialize the given ``obj`` to a dict of serialized objects. |
||
| 22 | :param obj: the named tuple that is to be serialized. |
||
| 23 | :param kwargs: any keyword arguments that may be given to the serialization |
||
| 24 | process. |
||
| 25 | :return: a dict of which all elements are serialized. |
||
| 26 | """ |
||
| 27 | result = {field_name: dump(getattr(obj, field_name), **kwargs) |
||
| 28 | for field_name in obj._fields} |
||
| 29 | return result |
||
| 30 |