Skip to content

Commit

Permalink
refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
TheoPascoli committed Sep 19, 2024
1 parent d9716e3 commit 0a540b1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions antarest/study/business/link_management.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ def _check_version_coherence(version: int, **kwargs) -> None:
)

@staticmethod
def create_parameters(study_version: int, link_creation_info: LinkInfoDTOType) -> t.Dict[str, t.Union[str, bool, float]]:
def create_parameters(
study_version: int, link_creation_info: LinkInfoDTOType
) -> t.Dict[str, t.Union[str, bool, float]]:
"""
Creates the parameters for the link creation command, handling version differences.
Expand Down Expand Up @@ -160,7 +162,6 @@ def create_parameters(study_version: int, link_creation_info: LinkInfoDTOType) -
return parameters



@all_optional_model
@camel_case_model
class LinkOutput(LinkProperties):
Expand Down Expand Up @@ -206,7 +207,7 @@ def get_all_links(self, study: RawStudy, with_ui: bool = False) -> t.List[LinkIn
)
link_creation_data.update(ui_parameters)
else:
link_creation_data.update(
link_creation_data.update(
{"colorr": None, "colorb": None, "colorg": None, "link_width": None, "link_style": None}
)
link_info_dto = LinkInfoFactory.create_link_info(**link_creation_data)
Expand Down Expand Up @@ -302,7 +303,9 @@ def update_links_props(
for (area1, area2), update_link_dto in update_links_by_ids.items():
# Update the link properties.
old_link_dto = old_links_by_ids[(area1, area2)]
updated_link_properties = old_link_dto.copy(update=update_link_dto.model_dump(by_alias=False, exclude_none=True))
updated_link_properties = old_link_dto.copy(
update=update_link_dto.model_dump(by_alias=False, exclude_none=True)
)
new_links_by_ids[(area1, area2)] = updated_link_properties

# Convert the DTO to a configuration object and update the configuration file.
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def test_area_management(client: TestClient, admin_access_token: str) -> None:
"link_width": 1.0,
"loop_flow": False,
"transmission_capacities": "enabled",
"use_phase_shifter": False
"use_phase_shifter": False,
}
]

Expand Down

0 comments on commit 0a540b1

Please sign in to comment.