Skip to content

Commit

Permalink
refactor SOURCE constant
Browse files Browse the repository at this point in the history
  • Loading branch information
msaipraneeth committed Dec 2, 2024
1 parent ae0bf0d commit 6a67723
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions cmem_plugin_validation/validate_entities/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def get_task_metadata(project: str, task: str, context: UserContext) -> dict:

SOURCE = SimpleNamespace()
SOURCE.entities = "entities"
SOURCE.file = "dataset"
SOURCE.dataset = "dataset"
SOURCE.options = OrderedDict(
{
SOURCE.entities: f"{SOURCE.entities}: "
"Validate entities received from the input port in the workflow.",
SOURCE.file: f"{SOURCE.file}: "
SOURCE.dataset: f"{SOURCE.dataset}: "
"Validate a JSON Dataset from a project (see advanced options).",
}
)
Expand Down Expand Up @@ -173,9 +173,9 @@ def _raise_error(self, message: str) -> None:

def _validate_config(self) -> None:
"""Raise value errors on bad configurations"""
if self.source_mode == SOURCE.file and self.source_dataset == "":
if self.source_mode == SOURCE.dataset and self.source_dataset == "":
self._raise_error(
f"When using the source mode '{SOURCE.file}', "
f"When using the source mode '{SOURCE.dataset}', "
"you need to select a Source JSON Dataset."
)
if self.source_mode == SOURCE.entities and self.source_dataset != "":
Expand Down Expand Up @@ -207,7 +207,7 @@ def _validate_config(self) -> None:
def _set_ports(self) -> None:
"""Define input/output ports based on the configuration"""
match self.source_mode:
case SOURCE.file:
case SOURCE.dataset:
# no input port
self.input_ports = FixedNumberOfInputs([])
case SOURCE.entities:
Expand Down

0 comments on commit 6a67723

Please sign in to comment.