Skip to content

Commit 590897d

Browse files
authored
Merge pull request #14 from airallergy/i13
API: Rename public model_file arguments
2 parents 7605534 + 24b745b commit 590897d

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

sober/_io_managers.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,10 @@ def _has_real_noises(self) -> bool:
134134
)
135135

136136
def _prepare(self, model_file: Path) -> None:
137+
# TODO: model_file here is not renamed to model in airallergy/sober#13,
138+
# because this function and the _tagged function below are EP-specific
139+
# they will be moved out of io managers during the actual decoupling
140+
137141
# check model type
138142
suffix = model_file.suffix
139143
if suffix not in self._MODEL_TYPES:

sober/problem.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ class Problem:
3434
3535
Parameters
3636
----------
37-
model_file : str or path-like object
37+
model : str or path-like object
3838
Model file path.
3939
weather_input : WeatherModifier
4040
Weather input variable.
@@ -82,7 +82,7 @@ class Problem:
8282
"""
8383

8484
__slots__ = (
85-
"_model_file",
85+
"_model",
8686
"_input_manager",
8787
"_output_manager",
8888
"_evaluation_dir",
@@ -92,7 +92,7 @@ class Problem:
9292
"_pymoo",
9393
)
9494

95-
_model_file: Path
95+
_model: Path
9696
_input_manager: _InputManager
9797
_output_manager: _OutputManager
9898
_evaluation_dir: Path
@@ -103,7 +103,7 @@ class Problem:
103103

104104
def __init__(
105105
self,
106-
model_file: AnyStrPath,
106+
model: AnyStrPath,
107107
weather_input: WeatherModifier,
108108
/,
109109
model_inputs: Iterable[AnyModelModifier] = (),
@@ -115,13 +115,13 @@ def __init__(
115115
clean_patterns: str | Iterable[str] = _OutputManager._DEFAULT_CLEAN_PATTERNS,
116116
removes_subdirs: bool = False,
117117
) -> None:
118-
self._model_file = _parsed_path(model_file, "model file")
118+
self._model = _parsed_path(model, "model file")
119119
self._input_manager = _InputManager(
120120
weather_input, model_inputs, has_templates, noise_sample_kwargs
121121
)
122122
self._output_manager = _OutputManager(outputs, clean_patterns, removes_subdirs)
123123
self._evaluation_dir = (
124-
self._model_file.parent / "evaluation"
124+
self._model.parent / "evaluation"
125125
if evaluation_dir is None
126126
else _parsed_path(evaluation_dir)
127127
)
@@ -172,7 +172,7 @@ def _prepare(self) -> None:
172172
self._config_dir.mkdir(exist_ok=True)
173173

174174
# prepare io managers
175-
self._input_manager._prepare(self._model_file)
175+
self._input_manager._prepare(self._model)
176176
self._output_manager._prepare(self._config_dir, self._input_manager._has_noises)
177177

178178
def run_random(

0 commit comments

Comments
 (0)