Skip to content

Commit 040e04b

Browse files
committed
Remove unused datetime import and simplify interval function by eliminating redundant calculations
1 parent 74e3398 commit 040e04b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

mano/mano.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Generator
2-
from datetime import datetime, timedelta
2+
from datetime import timedelta
33
import getpass
44
import json
55
import locale
@@ -80,7 +80,6 @@ def interval(x: str) -> int:
8080
raise IntervalError(f"invalid interval '{x}': {e}")
8181

8282
# convert to seconds using datetime
83-
now = datetime.now()
8483
if units == "d":
8584
offset = timedelta(days=value)
8685
elif units == "h":
@@ -90,7 +89,7 @@ def interval(x: str) -> int:
9089
elif units == "s":
9190
offset = timedelta(seconds=value)
9291

93-
return int(((now + offset) - now).total_seconds())
92+
return int(offset.total_seconds())
9493

9594

9695
def studies(Keyring: dict[str, str]) -> Generator[tuple[str, str], None, None]:

0 commit comments

Comments
 (0)