Skip to content

Commit 4a30de0

Browse files
fix some coding style issues
1 parent 880e722 commit 4a30de0

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

optibess_algorithm/financial_calculator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ def get_hourly_tariff(self, year):
530530
return self._hourly_tariff, self._hourly_buy_tariff
531531

532532
relative_year = year - self.output_calculator.producer.start_year
533-
self._hourly_tariff,self._hourly_buy_tariff = \
533+
self._hourly_tariff, self._hourly_buy_tariff = \
534534
get_yearly_prices(relative_year, self._hourly_sell_prices, self._hourly_buy_prices, self._tariff_table,
535535
self.output_calculator.producer.start_year, self.output_calculator.yearly_hour_num)
536536
self._hourly_matrix_year = year

optibess_algorithm/output_calculator.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212

1313
from .producers import Producer
1414
from .power_storage import PowerStorage
15-
from .utils import year_diff, month_diff, relu, clamp, is_leap_year, hour_num_in_range, tariff_table_to_hourly, \
16-
get_yearly_prices, is_real_numbers
15+
from .utils import (year_diff, month_diff, relu, clamp, is_leap_year, hour_num_in_range, get_yearly_prices,
16+
is_real_numbers)
1717
from .constants import YEAR_DAYS, YEAR_HOURS, DAY_LENGTH
1818

1919

@@ -1152,7 +1152,7 @@ def sell_prices(self):
11521152
return self._sell_prices
11531153

11541154
@sell_prices.setter
1155-
def sell_prices(self, value: np.ndarray[float]):
1155+
def sell_prices(self, value: np.ndarray[Any, float]):
11561156
if isinstance(value, np.ndarray) and is_real_numbers(value):
11571157
if value.shape != (YEAR_HOURS,) and value.shape != (self._project_hour_num,):
11581158
raise ValueError(f"Prices shape should be ({YEAR_HOURS},) or ({self._project_hour_num}, ), prices"
@@ -1172,7 +1172,7 @@ def buy_prices(self):
11721172
return self._buy_prices
11731173

11741174
@buy_prices.setter
1175-
def buy_prices(self, value: np.ndarray[float]):
1175+
def buy_prices(self, value: np.ndarray[Any, float]):
11761176
if isinstance(value, np.ndarray) and is_real_numbers(value):
11771177
if value.shape != (YEAR_HOURS,) and value.shape != (self._project_hour_num, ):
11781178
raise ValueError(f"Prices shape should be ({YEAR_HOURS},) or ({self._project_hour_num}, ), prices"
@@ -1200,7 +1200,7 @@ def tariff_table(self, value: np.ndarray[Any, np.dtype[np.float64]]):
12001200
raise ValueError("Tariff table should be of shape (7, 12, 24)")
12011201
self._tariff_table = value
12021202

1203-
def _get_action_from_obs(self, obs: np.ndarray):
1203+
def _get_action_from_obs(self, obs: np.ndarray[Any, float]):
12041204
"""
12051205
get action(s) from model given an observation
12061206

optibess_algorithm/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import itertools
2-
from typing import Union
2+
from typing import Union, Any
33

44
import numpy as np
55
import pandas as pd
@@ -141,8 +141,8 @@ def get_seasonal_hour_division(winter_low_hours: tuple[int, ...] | None = None,
141141

142142
def build_tariff_table(winter_low: float, winter_high_week: float, winter_high_weekend: float, transition_low: float,
143143
transition_high_week: float, transition_high_weekend: float, summer_low: float,
144-
summer_high_week: float, summer_high_weekend: float, week_days: tuple = (0, 1, 2, 3, 4),
145-
winter_months: tuple[int, ...] = (0, 1, 11),
144+
summer_high_week: float, summer_high_weekend: float,
145+
week_days: tuple[int, ...] = (0, 1, 2, 3, 4), winter_months: tuple[int, ...] = (0, 1, 11),
146146
transition_months: tuple[int, ...] = (2, 3, 4, 9, 10),
147147
summer_months: tuple[int, ...] = (5, 6, 7, 8),
148148
winter_low_hours: tuple[int, ...] | None = None,
@@ -206,7 +206,7 @@ def build_tariff_table(winter_low: float, winter_high_week: float, winter_high_w
206206
return tariff_table
207207

208208

209-
def tariff_table_to_hourly(tariff_table: np.ndarray, year: int):
209+
def tariff_table_to_hourly(tariff_table: np.ndarray[float], year: int):
210210
"""
211211
Create hourly prices for tariff table in the given year
212212
@@ -299,7 +299,7 @@ def get_yearly_prices(year, sell_prices, buy_prices, tariff_table, start_year, y
299299
return sell_output, buy_output
300300

301301

302-
def is_real_numbers(arr: np.ndarray):
302+
def is_real_numbers(arr: np.ndarray[Any, Any]):
303303
"""
304304
check if the dtype of the given array is a type corresponding to real numbers
305305
:param arr: the numpy array

0 commit comments

Comments
 (0)