Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow empty string '' from Argo for start and end dates TDE-1346 #1285

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions scripts/cli/cli_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,17 @@ def is_argo() -> bool:
return bool(environ.get("ARGO_TEMPLATE"))


def valid_date(s: str) -> datetime:
def valid_date(s: str) -> datetime | None:
print("before")
print(s)
print("after")
if not s:
print("inside if statement")
return None
try:
return parse_rfc_3339_date(s)
except ValueError as e:
msg = f"not a valid date: {s}"
msg = f"valid_date: not a valid date: {s}"
raise argparse.ArgumentTypeError(msg) from e


Expand Down
2 changes: 1 addition & 1 deletion scripts/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def format_rfc_3339_nz_midnight_datetime_string(datetime_object: datetime) -> st
try:
nz_datetime = parser.parse(naive_midnight_datetime_string).replace(tzinfo=nz_tz)
except parser.ParserError as err:
raise Exception(f"Not a valid date: {err}") from err
raise Exception(f"Not a valid date FIXME: {err}") from err

utc_tz = tz.gettz("UTC")
datetime_utc = nz_datetime.astimezone(utc_tz)
Expand Down
1 change: 1 addition & 0 deletions scripts/standardise_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ def report_non_visual_qa_errors(file: FileTiff) -> None:

def main() -> None:
arguments = parse_args()
print(arguments.start_datetime, arguments.end_datetime)

standardising_config = StandardisingConfig(
gdal_preset=arguments.preset,
Expand Down
Loading