Skip to content

Commit

Permalink
feat(api): method skeletons
Browse files Browse the repository at this point in the history
  • Loading branch information
salemsd committed Jan 9, 2025
1 parent 622c193 commit 5679a88
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 8 deletions.
31 changes: 23 additions & 8 deletions src/antares/craft/model/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -299,23 +299,23 @@ 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)

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)

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)
Expand Down Expand Up @@ -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()
15 changes: 15 additions & 0 deletions src/antares/craft/service/api_services/area_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions src/antares/craft/service/base_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions src/antares/craft/service/local_services/area_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 5679a88

Please sign in to comment.