Skip to content

Commit

Permalink
reformatting files and correcting minor errors
Browse files Browse the repository at this point in the history
  • Loading branch information
mehdiwahada committed Nov 8, 2024
1 parent 085af9b commit dd6d686
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/antares/model/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,4 @@ def create_hydro(
# todo: is it necessary to create allocation or correlation ?
hydro = self._area_service.create_hydro(self.id, properties, matrices)
self._hydro = hydro
return hydro
return hydro
11 changes: 6 additions & 5 deletions src/antares/service/api_services/area_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
# This file is part of the Antares project.

from pathlib import PurePosixPath
from typing import Dict, List, Optional, Union, Any
from typing import Dict, List, Optional, Union

import pandas as pd

Expand Down Expand Up @@ -565,7 +565,7 @@ def read_areas(self) -> List[Area]:
json_st_storage = self._wrapper.get(area_url + url_st_storage).json()
json_properties = self._wrapper.get(area_url + url_properties_form).json()

ui_response = craft_ui(self,f"{base_api_url}?type=AREA&{ui_url}",area)
ui_response = craft_ui(self, f"{base_api_url}?type=AREA&{ui_url}", area)

for thermal in json_thermal:
id_therm = thermal.pop("id")
Expand Down Expand Up @@ -601,18 +601,19 @@ def read_areas(self) -> List[Area]:
thermals=thermals,
st_storages=st_storage,
properties=json_properties,
ui=ui_response
ui=ui_response,
)

area_list.append(area_obj)

return area_list

def craft_ui(self, url_str:str, area_id) -> AreaUi:

def craft_ui(self, url_str: str, area_id) -> AreaUi:
response = self._wrapper.get(url_str)
json_ui = response.json()[area_id]

ui_response = AreaUiResponse.model_validate(json_ui)
current_ui = AreaUi.model_validate(ui_response.to_craft())

return current_ui
return current_ui
7 changes: 1 addition & 6 deletions src/antares/service/api_services/study_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# SPDX-License-Identifier: MPL-2.0
#
# This file is part of the Antares project.
from typing import List, Optional
from typing import Optional

from antares.api_conf.api_conf import APIconf
from antares.api_conf.request_wrapper import RequestWrapper
Expand All @@ -19,9 +19,7 @@
StudyDeletionError,
StudySettingsUpdateError,
)
from antares.model.area import Area
from antares.model.binding_constraint import BindingConstraint
from antares.model.renewable import RenewableCluster, RenewableClusterProperties
from antares.model.settings.adequacy_patch import AdequacyPatchParameters
from antares.model.settings.advanced_parameters import AdvancedParameters
from antares.model.settings.general import GeneralParameters
Expand All @@ -30,8 +28,6 @@
from antares.model.settings.study_settings import StudySettings
from antares.model.settings.thematic_trimming import ThematicTrimmingParameters
from antares.model.settings.time_series import TimeSeriesParameters
from antares.model.st_storage import STStorage, STStorageProperties
from antares.model.thermal import ThermalCluster, ThermalClusterProperties
from antares.service.base_services import BaseStudyService


Expand Down Expand Up @@ -108,4 +104,3 @@ def delete(self, children: bool) -> None:
self._wrapper.delete(url)
except APIError as e:
raise StudyDeletionError(self.study_id, e.message) from e

2 changes: 1 addition & 1 deletion src/antares/service/local_services/study_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# This file is part of the Antares project.

from typing import Any, List, Optional
from typing import Any, Optional

from antares.config.local_configuration import LocalConfiguration
from antares.model.binding_constraint import BindingConstraint
Expand Down
2 changes: 1 addition & 1 deletion tests/antares/services/api_services/test_study_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,4 @@ def test_create_binding_constraint_fails(self):
BindingConstraintCreationError,
match=f"Could not create the binding constraint {constraint_name}: {self.antares_web_description_msg}",
):
self.study.create_binding_constraint(name=constraint_name)
self.study.create_binding_constraint(name=constraint_name)

0 comments on commit dd6d686

Please sign in to comment.