Skip to content

Commit c1196d7

Browse files
committed
remove unix_time use dbetto instead
1 parent 3bb42f3 commit c1196d7

File tree

4 files changed

+2
-17
lines changed

4 files changed

+2
-17
lines changed

tests/test_util.py

-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
from datetime import datetime
21
from pathlib import Path
32

43
import yaml
@@ -16,7 +15,3 @@
1615

1716
def test_util():
1817
assert utils.tier_path(setup) == str(testprod / "generated/tier")
19-
time = datetime.now()
20-
assert int(utils.unix_time(time.strftime("%Y%m%dT%H%M%SZ"))) == int(
21-
time.timestamp()
22-
)

workflow/src/legenddataflow/FileKey.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88
from itertools import product
99
from pathlib import Path
1010

11+
from dbetto.time import unix_time
12+
1113
from .patterns import (
1214
full_channel_pattern_with_extension,
1315
get_pattern_tier,
1416
key_pattern,
1517
processing_pattern,
1618
)
17-
from .utils import unix_time
1819

1920
# key_pattern -> key
2021
#

workflow/src/legenddataflow/__init__.py

-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
from .utils import (
1010
subst_vars,
1111
subst_vars_in_snakemake_config,
12-
unix_time,
1312
)
1413

1514
__all__ = [
@@ -23,5 +22,4 @@
2322
"execenv_pyexe",
2423
"subst_vars",
2524
"subst_vars_in_snakemake_config",
26-
"unix_time",
2725
]

workflow/src/legenddataflow/utils.py

-9
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import os
1010
import re
1111
import string
12-
from datetime import datetime
1312
from pathlib import Path
1413

1514
# from dateutil import parser
@@ -189,14 +188,6 @@ def run_splitter(files):
189188
return run_files
190189

191190

192-
def unix_time(value):
193-
if isinstance(value, str):
194-
return datetime.timestamp(datetime.strptime(value, "%Y%m%dT%H%M%SZ"))
195-
else:
196-
msg = f"Can't convert type {type(value)} to unix time"
197-
raise ValueError(msg)
198-
199-
200191
def set_last_rule_name(workflow, new_name):
201192
"""Sets the name of the most recently created rule to be `new_name`.
202193
Useful when creating rules dynamically (i.e. unnamed).

0 commit comments

Comments
 (0)