Conditions | 1 |
Total Lines | 11 |
Code Lines | 4 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | from datetime import timezone, timedelta |
||
5 | def default_timezone_deserializer(obj: dict, |
||
6 | cls: type = timezone, |
||
7 | **kwargs) -> timezone: |
||
8 | """ |
||
9 | Deserialize a dict to a timezone instance. |
||
10 | :param obj: the dict that is to be deserialized. |
||
11 | :param cls: not used. |
||
12 | :param kwargs: not used. |
||
13 | :return: a ``datetime.timezone`` instance. |
||
14 | """ |
||
15 | return timezone(load(obj['offset'], timedelta), obj['name']) |
||
16 |