diff options
Diffstat (limited to 'python')
| -rw-r--r-- | python/citco_ops/utils.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/python/citco_ops/utils.py b/python/citco_ops/utils.py index 0ada5f47..d139810e 100644 --- a/python/citco_ops/utils.py +++ b/python/citco_ops/utils.py @@ -27,9 +27,11 @@ def next_business_days(date, offset): def get_file_status(s): - orig_name, submit_date, status, process_date = re.match( - r"([^\d]*)(\d*)-(PROCESSED|FAILED)_([^-]*)", s - ).groups() + if m := re.match(r"([^\d]*)(\d*)-(PROCESSED|FAILED)_([^-]*)", s): + orig_name, submit_date, status, process_date = m.groups() + else: + raise ValueError(f"Can't parse status from file {s}") + zone = ZoneInfo("America/New_York") submit_date = datetime.datetime.strptime(submit_date, "%Y%m%d%H%M%S").replace( tzinfo=zone |
