Skip to content

Commit

Permalink
Improve static retriever class name
Browse files Browse the repository at this point in the history
  • Loading branch information
CBonnell committed Apr 11, 2024
1 parent 4da6cec commit 0f32e3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions pkilint/document.py
Original file line number Diff line number Diff line change
Expand Up @@ -382,9 +382,9 @@ def __call__(self, *args, **kwargs) -> datetime.datetime:
pass


class StaticValidityPeriodRetriever(ValidityPeriodStartRetriever):
class StaticValidityPeriodStartRetriever(ValidityPeriodStartRetriever):
def __init__(self, validity_period_start: datetime.datetime):
# require aware datetime values
# require timezone-aware datetime values
if validity_period_start.tzinfo is None or validity_period_start.tzinfo.utcoffset(None) is None:
raise ValueError('Validity period start value must be timezone-aware')

Expand Down
4 changes: 2 additions & 2 deletions pkilint/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ def __call__(self, parser, namespace, values, option_string=None):
if value_casefolded == 'document'.casefold():
retriever_instance = self.get_retriever_class()()
elif value_casefolded == 'now'.casefold():
retriever_instance = document.StaticValidityPeriodRetriever(datetime.datetime.now(tz=datetime.timezone.utc))
retriever_instance = document.StaticValidityPeriodStartRetriever(datetime.datetime.now(tz=datetime.timezone.utc))
else:
try:
dt = dateutil.parser.isoparse(values)

retriever_instance = document.StaticValidityPeriodRetriever(dt)
retriever_instance = document.StaticValidityPeriodStartRetriever(dt)
except ValueError as e:
raise argparse.ArgumentError(self, f'Invalid value for validity period start: "{values}"')

Expand Down

0 comments on commit 0f32e3c

Please sign in to comment.