default_date_deserializer()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 11
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 11
rs 10
c 0
b 0
f 0
cc 1
nop 3
1
from datetime import date
2
3
from jsons._datetime_impl import get_datetime_inst, RFC3339_DATE_PATTERN
4
5
6
def default_date_deserializer(obj: str,
7
                              cls: type = date,
8
                              **kwargs) -> date:
9
    """
10
    Deserialize a string with an RFC3339 pattern to a date instance.
11
    :param obj: the string that is to be deserialized.
12
    :param cls: not used.
13
    :param kwargs: not used.
14
    :return: a ``datetime.date`` instance.
15
    """
16
    return get_datetime_inst(obj, RFC3339_DATE_PATTERN).date()
17