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

jsons.serializers.default_timedelta   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 13
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 4
dl 0
loc 13
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A default_timedelta_serializer() 0 9 1
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