Passed
Pull Request — master (#2)
by manny
01:42
created

helpers.timer_to_str()   A

Complexity

Conditions 2

Size

Total Lines 5
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 4
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
from datetime import timedelta
2
3
4
def timer_to_str(timer: timedelta) -> str:
5
    if timer.total_seconds() < 0.0:
6
        return "-0:00:{:04.1f}".format(timer.total_seconds() * -1.0)
7
    else:
8
        return str(timer)[:9]
9