Skip to content

Commit

Permalink
Fix for field validation
Browse files Browse the repository at this point in the history
  • Loading branch information
natelust committed Dec 7, 2023
1 parent b07d464 commit b518f0c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions python/lsst/analysis/tools/interfaces/_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,15 @@ def __init__(self, *, config: AnalysisBaseConfig = None): # type: ignore
self.outputs.add(name)


def _timestampValidator(value: str) -> bool:
if value in ("reference_package_timestamp", "run_timestamp", "current_timestamp", "dataset_timestamp"):
return True
elif 'explicit_timestamp' in value:
return True
else:
return False


class AnalysisBaseConfig(PipelineTaskConfig, pipelineConnections=AnalysisBaseConnections):
"""Base class for all configs used to define an `AnalysisPipelineTask`.
Expand Down Expand Up @@ -216,8 +225,7 @@ class AnalysisBaseConfig(PipelineTaskConfig, pipelineConnections=AnalysisBaseCon
"dataset_timestamp and explicit_timestamp:datetime where datetime is "
"given in the form %Y%m%dT%H%M%S%z",
default="run_timestamp",
check=lambda x: x
in ("reference_package_timestamp", "run_timestamp", "current_timestamp", "dataset_timestamp"),
check=_timestampValidator
)

def applyConfigOverrides(
Expand Down

0 comments on commit b518f0c

Please sign in to comment.