Completed
Push — master ( a0c5cf...fb555e )
by Ramon
19s queued 11s
created

default_timedelta_serializer()   A

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nop 2
1
from datetime import timedelta
2
3
4
def default_timedelta_serializer(obj: timedelta, **kwargs) -> float:
5
    """
6
    Serialize the given timedelta instance to a float holding the total
7
    seconds.
8
    :param obj: the timedelta instance that is to be serialized.
9
    :param kwargs: not used.
10
    :return: ``timedelta`` as a float.
11
    """
12
    return obj.total_seconds()
13