Skip to content

Commit

Permalink
fix: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
nazarfil committed Sep 30, 2024
1 parent bfcfd5a commit 7a418c7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
6 changes: 3 additions & 3 deletions examples/pipelines/logistic_stats/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ def model(dhis2_data: dict[str, typing.Any], gadm_data, worldpop_data):
population_df = pd.Series(data=[stat["sum"] for stat in stats], index=administrative_areas.index)
population_df = pd.DataFrame({"District": administrative_areas["NAME_2"], "Population": population_df})
corrected_population_df = population_df.copy()
corrected_population_df.loc[
corrected_population_df["District"].str.startswith("Western"), "District"
] = "Western Area"
corrected_population_df.loc[corrected_population_df["District"].str.startswith("Western"), "District"] = (
"Western Area"
)

corrected_population_df = corrected_population_df.groupby("District").sum()

Expand Down
1 change: 0 additions & 1 deletion openhexa/sdk/pipelines/parameter.py
Original file line number Diff line number Diff line change
Expand Up @@ -442,7 +442,6 @@ def to_dict(self) -> dict[str, typing.Any]:
"multiple": self.multiple,
}


def _validate_single(self, value: typing.Any):
# Normalize empty values to None and handles default
normalized_value = self.type.normalize(value)
Expand Down
3 changes: 2 additions & 1 deletion openhexa/sdk/pipelines/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,8 @@ def get_pipeline(pipeline_path: Path) -> Pipeline:
help=args.get("help"),
default=args.get("default"),
required=args.get("required") if args.get("required") is not None else True,
multiple=args.get("multiple") if args.get("multiple") is not None else False,)
multiple=args.get("multiple") if args.get("multiple") is not None else False,
)
pipelines_parameters.append(parameter)

pipeline = Pipeline(parameters=pipelines_parameters, function=None, **pipeline_decorator_spec["args"])
Expand Down
28 changes: 21 additions & 7 deletions tests/test_ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,15 @@ def test_pipeline_no_parameters(self):
)
pipeline = get_pipeline(tmpdirname)
self.assertEqual(
pipeline.to_dict(), {"code": "test", "name": "Test pipeline", "function": None,
"tasks": [], "parameters": [], "timeout": None}
pipeline.to_dict(),
{
"code": "test",
"name": "Test pipeline",
"function": None,
"tasks": [],
"parameters": [],
"timeout": None,
},
)

def test_pipeline_with_args(self):
Expand All @@ -59,8 +66,15 @@ def test_pipeline_with_args(self):
)
pipeline = get_pipeline(tmpdirname)
self.assertEqual(
pipeline.to_dict(), {"code": "test", "function": None,
"tasks": [], "name": "Test pipeline", "parameters": [], "timeout": None}
pipeline.to_dict(),
{
"code": "test",
"function": None,
"tasks": [],
"name": "Test pipeline",
"parameters": [],
"timeout": None,
},
)

def test_pipeline_with_invalid_parameter_args(self):
Expand Down Expand Up @@ -291,8 +305,8 @@ def test_pipeline_with_timeout(self):
"parameters": [],
"timeout": 42,
"function": None,
"tasks": []
}
"tasks": [],
},
)

def test_pipeline_with_bool(self):
Expand Down Expand Up @@ -361,7 +375,7 @@ def test_pipeline_with_multiple_parameters(self):
"code": "test",
"name": "Test pipeline",
"function": None,
"tasks" : [],
"tasks": [],
"parameters": [
{
"choices": None,
Expand Down

0 comments on commit 7a418c7

Please sign in to comment.