| Conditions | 1 |
| Total Lines | 13 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | from datetime import timezone |
||
| 6 | def default_timezone_serializer(obj: timezone, **kwargs) -> dict: |
||
| 7 | """ |
||
| 8 | Serialize the given timezone instance to a dict holding the total |
||
| 9 | seconds. |
||
| 10 | :param obj: the timezone instance that is to be serialized. |
||
| 11 | :param kwargs: not used. |
||
| 12 | :return: ``timezone`` as a dict. |
||
| 13 | """ |
||
| 14 | name = obj.tzname(None) |
||
| 15 | offset = dump(obj.utcoffset(None), **kwargs) |
||
| 16 | return { |
||
| 17 | 'name': name, |
||
| 18 | 'offset': offset |
||
| 19 | } |
||
| 20 |