helpers   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 10
dl 0
loc 12
rs 10
c 0
b 0
f 0
wmc 3

1 Function

Rating   Name   Duplication   Size   Complexity  
A timer_to_str() 0 8 3
1
from datetime import timedelta
2
3
4
def timer_to_str(timer: timedelta, decimals: bool = True) -> str:
5
    substring = 9
6
    if not decimals:
7
        substring = 7
8
    if timer.total_seconds() < 0.0:
9
        timer = timer * -1.0
10
        return "-" + str(timer)[:substring]
11
    return str(timer)[:substring]
12