Skip to content

Commit

Permalink
Linting after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Sigurd-Borge committed Nov 29, 2024
1 parent 1d02e06 commit e7ab127
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/antares/model/area.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,4 +378,4 @@ def read_thermal_clusters(
def read_hydro(
self,
) -> Hydro:
return self._area_service.read_hydro(self.id)
return self._area_service.read_hydro(self.id)
1 change: 1 addition & 0 deletions src/antares/service/base_services.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ def read_areas(self) -> list[Area]:
"""
pass


class BaseLinkService(ABC):
@abstractmethod
def create_link(
Expand Down
15 changes: 10 additions & 5 deletions src/antares/service/local_services/area_local.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,14 @@ def delete_renewable_clusters(self, area: Area, renewable_clusters: List[Renewab

def delete_st_storages(self, area: Area, storages: List[STStorage]) -> None:
raise NotImplementedError

def _read_timeseries(self, ts_file_type: TimeSeriesFileType, study_path: Path, area_id: Optional[str] = None, constraint_id: Optional[str] = None) -> pd.DataFrame:

def _read_timeseries(
self,
ts_file_type: TimeSeriesFileType,
study_path: Path,
area_id: Optional[str] = None,
constraint_id: Optional[str] = None,
) -> pd.DataFrame:
file_path = study_path / (
ts_file_type.value
if not (area_id or constraint_id)
Expand All @@ -330,10 +336,10 @@ def _read_timeseries(self, ts_file_type: TimeSeriesFileType, study_path: Path, a
_time_series = pd.DataFrame()

return _time_series

def get_load_matrix(self, area: Area) -> pd.DataFrame:
return self._read_timeseries(TimeSeriesFileType.LOAD, self.config.study_path, area_id=area.id)

def get_solar_matrix(self, area: Area) -> pd.DataFrame:
raise NotImplementedError

Expand Down Expand Up @@ -362,4 +368,3 @@ def read_areas(self) -> List[Area]:
)
)
return areas

16 changes: 8 additions & 8 deletions tests/antares/services/local_services/test_area.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@

import typing as t

import pytest

from configparser import ConfigParser
from io import StringIO
from pathlib import Path
Expand Down Expand Up @@ -1106,6 +1104,7 @@ def test_k_and_translation_txt_is_empty_by_default(self, local_study, fr_load):
actual_file_path = study_path.joinpath(Path("input") / "load" / "prepro" / "fr" / f"{file}.txt")
assert actual_file_path.read_text() == ""


class TestReadArea:
def test_read_areas_local(self, local_study_w_areas):
study_path = local_study_w_areas.service.config.study_path
Expand All @@ -1130,12 +1129,13 @@ def _write_file(_file_path, _time_series) -> None:

for area in areas:
expected_time_serie = pd.DataFrame(
[
[-9999999980506447872, 0, 9999999980506447872],
[0, area.id, 0],
]
, dtype="object")

[
[-9999999980506447872, 0, 9999999980506447872],
[0, area.id, 0],
],
dtype="object",
)

file_path = study_path / "input" / "load" / "series" / f"load_{area.id}.txt"
_write_file(file_path, expected_time_serie)

Expand Down
2 changes: 1 addition & 1 deletion tests/antares/services/local_services/test_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import logging
import os
import time
import typing as t

from configparser import ConfigParser
from pathlib import Path
Expand Down Expand Up @@ -88,7 +89,6 @@
from antares.service.local_services.st_storage_local import ShortTermStorageLocalService
from antares.service.local_services.thermal_local import ThermalLocalService
from antares.tools.ini_tool import IniFileTypes
from antares.tools.time_series_tool import TimeSeriesFileType


class TestCreateStudy:
Expand Down

0 comments on commit e7ab127

Please sign in to comment.