From 56fb99cf7a34e96db17533a48591c6ba220fe8c6 Mon Sep 17 00:00:00 2001 From: Rachel Cooper Date: Thu, 9 Jan 2025 14:23:27 -0500 Subject: [PATCH 1/2] replace / separator with - for correct pedigree format check --- jwst_reffiles/utils/crds_checks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jwst_reffiles/utils/crds_checks.py b/jwst_reffiles/utils/crds_checks.py index ea7aa39..0ae10b3 100644 --- a/jwst_reffiles/utils/crds_checks.py +++ b/jwst_reffiles/utils/crds_checks.py @@ -24,7 +24,7 @@ def validate_pedigree(value): # strip off the dates and just check the text if len(value) > 8: value, start_date, end_date = value.split(' ') - if start_date[2] != '/' or start_date[5] != '/' or end_date[2] != '/' or end_date[5] != '/': + if start_date[2] != '-' or start_date[5] != '-' or end_date[2] != '-' or end_date[5] != '-': raise ValueError(("ERROR, starting and ending dates in pedigree keyword must have format: mm/dd/yyyy")) if value not in allowed_values: From d549680d695cd79c39268156b76e871de3f48d0e Mon Sep 17 00:00:00 2001 From: Rachel Cooper Date: Thu, 9 Jan 2025 14:40:57 -0500 Subject: [PATCH 2/2] actually fixed format check --- jwst_reffiles/utils/crds_checks.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jwst_reffiles/utils/crds_checks.py b/jwst_reffiles/utils/crds_checks.py index 0ae10b3..669fa36 100644 --- a/jwst_reffiles/utils/crds_checks.py +++ b/jwst_reffiles/utils/crds_checks.py @@ -24,8 +24,8 @@ def validate_pedigree(value): # strip off the dates and just check the text if len(value) > 8: value, start_date, end_date = value.split(' ') - if start_date[2] != '-' or start_date[5] != '-' or end_date[2] != '-' or end_date[5] != '-': - raise ValueError(("ERROR, starting and ending dates in pedigree keyword must have format: mm/dd/yyyy")) + if start_date[4] != '-' or start_date[7] != '-' or end_date[4] != '-' or end_date[7] != '-': + raise ValueError(("ERROR, starting and ending dates in pedigree keyword must have format: yyyy-mm-dd")) if value not in allowed_values: raise ValueError(("ERROR: pedigree value {} is not valid. Must be one of: {}"