Skip to content

Commit

Permalink
remove unix_time use dbetto instead
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmarshall committed Feb 9, 2025
1 parent 3bb42f3 commit c1196d7
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 17 deletions.
5 changes: 0 additions & 5 deletions tests/test_util.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from datetime import datetime
from pathlib import Path

import yaml
Expand All @@ -16,7 +15,3 @@

def test_util():
assert utils.tier_path(setup) == str(testprod / "generated/tier")
time = datetime.now()
assert int(utils.unix_time(time.strftime("%Y%m%dT%H%M%SZ"))) == int(
time.timestamp()
)
3 changes: 2 additions & 1 deletion workflow/src/legenddataflow/FileKey.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@
from itertools import product
from pathlib import Path

from dbetto.time import unix_time

from .patterns import (
full_channel_pattern_with_extension,
get_pattern_tier,
key_pattern,
processing_pattern,
)
from .utils import unix_time

# key_pattern -> key
#
Expand Down
2 changes: 0 additions & 2 deletions workflow/src/legenddataflow/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from .utils import (
subst_vars,
subst_vars_in_snakemake_config,
unix_time,
)

__all__ = [
Expand All @@ -23,5 +22,4 @@
"execenv_pyexe",
"subst_vars",
"subst_vars_in_snakemake_config",
"unix_time",
]
9 changes: 0 additions & 9 deletions workflow/src/legenddataflow/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import os
import re
import string
from datetime import datetime
from pathlib import Path

# from dateutil import parser
Expand Down Expand Up @@ -189,14 +188,6 @@ def run_splitter(files):
return run_files


def unix_time(value):
if isinstance(value, str):
return datetime.timestamp(datetime.strptime(value, "%Y%m%dT%H%M%SZ"))
else:
msg = f"Can't convert type {type(value)} to unix time"
raise ValueError(msg)


def set_last_rule_name(workflow, new_name):
"""Sets the name of the most recently created rule to be `new_name`.
Useful when creating rules dynamically (i.e. unnamed).
Expand Down

0 comments on commit c1196d7

Please sign in to comment.