Total Complexity | 2 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | from typing import Optional |
||
2 | |||
3 | from jsons.exceptions import DeserializationError |
||
4 | |||
5 | |||
6 | def default_nonetype_deserializer(obj: object, |
||
7 | cls: Optional[type] = None, |
||
8 | **kwargs) -> object: |
||
9 | """ |
||
10 | Deserialize a ``NoneType``. |
||
11 | :param obj: the value that is to be deserialized. |
||
12 | :param cls: not used. |
||
13 | :param kwargs: not used. |
||
14 | :return: ``obj``. |
||
15 | """ |
||
16 | if obj is not None: |
||
17 | raise DeserializationError('Cannot deserialize {} as NoneType' |
||
18 | .format(obj), source=obj, target=cls) |
||
19 | return obj |
||
20 |