Skip to content

Commit

Permalink
final commit
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinBelthle committed Sep 20, 2024
1 parent beee396 commit c1c8f24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 2 additions & 3 deletions src/antares/service/api_services/link_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#
# This file is part of the Antares project.

import json
from types import MappingProxyType
from typing import Optional

Expand Down Expand Up @@ -113,7 +112,7 @@ def update_link_properties(self, link: Link, properties: LinkProperties) -> Link
area1_id, area2_id = sorted([link.area_from.id, link.area_to.id])
raw_url = f"{self._base_url}/studies/{self.study_id}/raw?path=input/links/{area1_id}/properties/{area2_id}"
try:
new_properties = json.loads(properties.model_dump_json(by_alias=True, exclude_none=True))
new_properties = properties.model_dump(mode="json", by_alias=True, exclude_none=True)
if not new_properties:
return link.properties

Expand Down Expand Up @@ -145,7 +144,7 @@ def update_link_ui(self, link: Link, ui: LinkUi) -> LinkUi:
area1_id, area2_id = sorted([link.area_from.id, link.area_to.id])
raw_url = f"{self._base_url}/studies/{self.study_id}/raw?path=input/links/{area1_id}/properties/{area2_id}"
try:
new_ui = json.loads(ui.model_dump_json(by_alias=True, exclude_none=True))
new_ui = ui.model_dump(mode="json", by_alias=True, exclude_none=True)
if not new_ui:
return link.ui

Expand Down
3 changes: 1 addition & 2 deletions src/antares/service/api_services/study_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#
# This file is part of the Antares project.

import json
from typing import Optional

from antares.api_conf.api_conf import APIconf
Expand Down Expand Up @@ -48,7 +47,7 @@ def _returns_study_settings(
"playlist": ("playlist", None),
}
if settings:
json_settings = json.loads(settings.model_dump_json(by_alias=True, exclude_none=True))
json_settings = settings.model_dump(mode="json", by_alias=True, exclude_none=True)
if not json_settings and update:
return None

Expand Down

0 comments on commit c1c8f24

Please sign in to comment.