Skip to content

Commit

Permalink
style: Code style fixes.
Browse files Browse the repository at this point in the history
Signed-off-by: Egor Dmitriev <[email protected]>
  • Loading branch information
egordm committed Oct 4, 2024
1 parent 20fd99c commit 094391a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 20 deletions.
6 changes: 2 additions & 4 deletions openstef/model/regressors/custom_regressor.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,11 @@ class CustomOpenstfRegressor(OpenstfRegressor):

@staticmethod
@abstractmethod
def valid_kwargs() -> list[str]:
...
def valid_kwargs() -> list[str]: ...

@classmethod
@abstractmethod
def objective(self) -> Type[RegressorObjective]:
...
def objective(self) -> Type[RegressorObjective]: ...


def load_custom_model(custom_model_path) -> CustomOpenstfRegressor:
Expand Down
6 changes: 3 additions & 3 deletions openstef/model/standard_deviation_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def generate_standard_deviation_data(self, model: RegressorMixin) -> RegressorMi
confidence_interval_horizon = self._calculate_standard_deviation(
sub_val.iloc[:, 0], predicted
)
confidence_interval_horizon[
"horizon"
] = horizon # Label with respective horizon
confidence_interval_horizon["horizon"] = (
horizon # Label with respective horizon
)
self.standard_deviation = pd.concat(
[self.standard_deviation, confidence_interval_horizon]
)
Expand Down
6 changes: 3 additions & 3 deletions test/unit/data_classes/test_split_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,9 @@ def test_load(self):

# Non Callable object
split_func_dc = copy.deepcopy(self.split_func_with_strings)
split_func_dc[
"function"
] = "test.unit.data_classes.test_split_function.dummy_not_func"
split_func_dc["function"] = (
"test.unit.data_classes.test_split_function.dummy_not_func"
)
with self.assertRaises(ValueError):
_ = split_func_dc.load()

Expand Down
3 changes: 1 addition & 2 deletions test/unit/model/test_custom_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
)


class DummyObjective(RegressorObjective):
...
class DummyObjective(RegressorObjective): ...


class DummyRegressor(CustomOpenstfRegressor):
Expand Down
12 changes: 6 additions & 6 deletions test/unit/pipeline/test_create_basecase.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ def setUp(self) -> None:
self.PJ = TestData.get_prediction_job(pid=307)
forecast_input = TestData.load("reference_sets/307-test-data.csv")
# Set last 7 days to nan, just like operationally
forecast_input.loc[
forecast_input.index.max() - timedelta(days=7) :, "load"
] = np.nan
forecast_input.loc[forecast_input.index.max() - timedelta(days=7) :, "load"] = (
np.nan
)
# Shift so the input matches 'now'
offset_seconds = (
pd.to_datetime(datetime.utcnow(), utc=True)
Expand Down Expand Up @@ -80,9 +80,9 @@ def test_create_basecase_forecast_pipeline_constant_load(self):
forecast_input.loc[
forecast_input.index.max() - timedelta(days=21) :, "load"
] = forecast_input.loc[forecast_input.index.max() - timedelta(days=14), "load"]
forecast_input.loc[
forecast_input.index.max() - timedelta(days=7) :, "load"
] = np.nan
forecast_input.loc[forecast_input.index.max() - timedelta(days=7) :, "load"] = (
np.nan
)

base_case_forecast = create_basecase_forecast_pipeline(self.PJ, forecast_input)

Expand Down
3 changes: 1 addition & 2 deletions test/unit/pipeline/test_pipeline_train_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@
from openstef.validation import validation


class DummyObjective(RegressorObjective):
...
class DummyObjective(RegressorObjective): ...


class DummyRegressor(CustomOpenstfRegressor):
Expand Down

0 comments on commit 094391a

Please sign in to comment.