From 5679a88f5c1377fd8358b1a9979dbb78e79ab770 Mon Sep 17 00:00:00 2001 From: salemsd Date: Thu, 9 Jan 2025 10:43:25 +0100 Subject: [PATCH] feat(api): method skeletons --- src/antares/craft/model/area.py | 31 ++++++++++++++----- .../craft/service/api_services/area_api.py | 15 +++++++++ src/antares/craft/service/base_services.py | 20 ++++++++++++ .../service/local_services/area_local.py | 15 +++++++++ 4 files changed, 73 insertions(+), 8 deletions(-) diff --git a/src/antares/craft/model/area.py b/src/antares/craft/model/area.py index b4ab30eb..1f242d07 100644 --- a/src/antares/craft/model/area.py +++ b/src/antares/craft/model/area.py @@ -17,7 +17,7 @@ """ from types import MappingProxyType -from typing import Any, Dict, List, Mapping, Optional, Set +from typing import Any, Dict, list, Mapping, Optional, Set import pandas as pd @@ -123,7 +123,7 @@ class AreaUi(BaseModel, extra="forbid", populate_by_name=True, alias_generator=t layer: Optional[int] = None x: Optional[int] = None y: Optional[int] = None - color_rgb: Optional[List[int]] = None + color_rgb: Optional[list[int]] = None layer_x: Optional[Dict[int, int]] = None layer_y: Optional[Dict[int, int]] = None @@ -299,7 +299,7 @@ def get_reserves_matrix(self) -> pd.DataFrame: def get_misc_gen_matrix(self) -> pd.DataFrame: return self._area_service.get_misc_gen_matrix(self.id) - def delete_thermal_clusters(self, thermal_clusters: List[ThermalCluster]) -> None: + def delete_thermal_clusters(self, thermal_clusters: list[ThermalCluster]) -> None: self._area_service.delete_thermal_clusters(self.id, thermal_clusters) for cluster in thermal_clusters: self._thermals.pop(cluster.id) @@ -307,7 +307,7 @@ def delete_thermal_clusters(self, thermal_clusters: List[ThermalCluster]) -> Non def delete_thermal_cluster(self, thermal_cluster: ThermalCluster) -> None: self.delete_thermal_clusters([thermal_cluster]) - def delete_renewable_clusters(self, renewable_clusters: List[RenewableCluster]) -> None: + def delete_renewable_clusters(self, renewable_clusters: list[RenewableCluster]) -> None: self._area_service.delete_renewable_clusters(self.id, renewable_clusters) for cluster in renewable_clusters: self._renewables.pop(cluster.id) @@ -315,7 +315,7 @@ def delete_renewable_clusters(self, renewable_clusters: List[RenewableCluster]) def delete_renewable_cluster(self, renewable_cluster: RenewableCluster) -> None: self.delete_renewable_clusters([renewable_cluster]) - def delete_st_storages(self, storages: List[STStorage]) -> None: + def delete_st_storages(self, storages: list[STStorage]) -> None: self._area_service.delete_st_storages(self.id, storages) for storage in storages: self._st_storages.pop(storage.id) @@ -358,20 +358,35 @@ def create_hydro( def read_st_storages( self, - ) -> List[STStorage]: + ) -> list[STStorage]: return self._storage_service.read_st_storages(self.id) def read_renewables( self, - ) -> List[RenewableCluster]: + ) -> list[RenewableCluster]: return self._renewable_service.read_renewables(self.id) def read_thermal_clusters( self, - ) -> List[ThermalCluster]: + ) -> list[ThermalCluster]: return self._thermal_service.read_thermal_clusters(self.id) def read_hydro( self, ) -> Hydro: return self._area_service.read_hydro(self.id) + + def get_maxpower(self) -> pd.DataFrame: + return self._area_service.get_maxpower() + + def get_reservoir(self) -> pd.DataFrame: + return self._area_service.get_reservoir() + + def get_inflow_pattern(self) -> pd.DataFrame: + return self._area_service.get_inflow_pattern() + + def get_credit_modulations(self) -> pd.DataFrame: + return self._area_service.get_credit_modulations() + + def get_water_values(self) -> pd.DataFrame: + return self._area_service.get_water_values() diff --git a/src/antares/craft/service/api_services/area_api.py b/src/antares/craft/service/api_services/area_api.py index 98edf210..0a7805f7 100644 --- a/src/antares/craft/service/api_services/area_api.py +++ b/src/antares/craft/service/api_services/area_api.py @@ -605,3 +605,18 @@ def read_areas(self) -> List[Area]: # sort area list to ensure reproducibility area_list.sort(key=lambda area: area.id) return area_list + + def get_maxpower(self) -> pd.DataFrame: + pass + + def get_reservoir(self) -> pd.DataFrame: + pass + + def get_inflow_pattern(self) -> pd.DataFrame: + pass + + def get_credit_modulations(self) -> pd.DataFrame: + pass + + def get_water_values(self) -> pd.DataFrame: + pass \ No newline at end of file diff --git a/src/antares/craft/service/base_services.py b/src/antares/craft/service/base_services.py index 187d1803..261bc47b 100644 --- a/src/antares/craft/service/base_services.py +++ b/src/antares/craft/service/base_services.py @@ -314,6 +314,26 @@ def read_areas(self) -> list[Area]: """ pass + @abstractmethod + def get_maxpower(self) -> pd.DataFrame: + pass + + @abstractmethod + def get_reservoir(self) -> pd.DataFrame: + pass + + @abstractmethod + def get_inflow_pattern(self) -> pd.DataFrame: + pass + + @abstractmethod + def get_credit_modulations(self) -> pd.DataFrame: + pass + + @abstractmethod + def get_water_values(self) -> pd.DataFrame: + pass + class BaseLinkService(ABC): @abstractmethod diff --git a/src/antares/craft/service/local_services/area_local.py b/src/antares/craft/service/local_services/area_local.py index 3181a657..4f0c98fd 100644 --- a/src/antares/craft/service/local_services/area_local.py +++ b/src/antares/craft/service/local_services/area_local.py @@ -388,3 +388,18 @@ def read_areas(self) -> List[Area]: ) ) return areas + + def get_maxpower(self) -> pd.DataFrame: + pass + + def get_reservoir(self) -> pd.DataFrame: + pass + + def get_inflow_pattern(self) -> pd.DataFrame: + pass + + def get_credit_modulations(self) -> pd.DataFrame: + pass + + def get_water_values(self) -> pd.DataFrame: + pass \ No newline at end of file