Skip to content

Commit

Permalink
curate format-dates: Move --expected-date-formats to optional args
Browse files Browse the repository at this point in the history
Because of the added default values in
<#1501>, this is no longer a
required argument.

The alternative is to explicitly mark this option as `required=True`,
but that's a breaking change that can be considered later. Currently,
if `--expected-date-formats` is not provided and dates match the
defaults, then it's a no-op. If dates do not match the default formats,
it will raise a loud error so the user can add the custom formats.
  • Loading branch information
joverlee521 committed Oct 17, 2024
1 parent 7f57bd1 commit fa40bff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions augur/curate/format_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ def register_parser(parent_subparsers):
required = parser.add_argument_group(title="REQUIRED")
required.add_argument("--date-fields", nargs="+", action="extend",
help="List of date field names in the record that need to be standardized.")
required.add_argument("--expected-date-formats", nargs="+", action="extend",

optional = parser.add_argument_group(title="OPTIONAL")
optional.add_argument("--expected-date-formats", nargs="+", action="extend",
default=DEFAULT_EXPECTED_DATE_FORMATS,
help="Expected date formats that are currently in the provided date fields, " +
"defined by standard format codes as listed at " +
"https://docs.python.org/3/library/datetime.html#strftime-and-strptime-format-codes. " +
"If a date string matches multiple formats, it will be parsed as the first matched format in the provided order.")

optional = parser.add_argument_group(title="OPTIONAL")
optional.add_argument("--failure-reporting",
type=DataErrorMethod.argtype,
choices=list(DataErrorMethod),
Expand Down

0 comments on commit fa40bff

Please sign in to comment.