Skip to content

Commit

Permalink
Fixup revert autoformat
Browse files Browse the repository at this point in the history
  • Loading branch information
Yngve S. Kristiansen committed Sep 5, 2024
1 parent 47d6810 commit 0f63679
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 25 deletions.
6 changes: 2 additions & 4 deletions src/ert/config/ensemble_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,12 @@ def addNode(self, config_node: Union[ParameterConfig, ResponseConfig]) -> None:
assert config_node is not None
if config_node.name in self:
raise ConfigValidationError(
f"Config node with key {config_node.name!r} already present in "
f"ensemble config"
f"Config node with key {config_node.name!r} already present in ensemble config"
)

if isinstance(config_node, ParameterConfig):
logger.info(
f"Adding {type(config_node).__name__} config (of size "
f"{len(config_node)}) to parameter_configs"
f"Adding {type(config_node).__name__} config (of size {len(config_node)}) to parameter_configs"
)
self.parameter_configs[config_node.name] = config_node
else:
Expand Down
12 changes: 4 additions & 8 deletions src/ert/config/ert_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -459,8 +459,7 @@ def _create_list_of_forward_model_steps_to_run(
errors.append(
ConfigValidationError.with_context(
f"Could not find forward model step {fm_step_name!r} in list"
f" of installed forward model steps: "
f"{list(installed_steps.keys())!r}",
f" of installed forward model steps: {list(installed_steps.keys())!r}",
fm_step_name,
)
)
Expand All @@ -476,8 +475,7 @@ def _create_list_of_forward_model_steps_to_run(
if req not in fm_step.private_args:
errors.append(
ConfigValidationError.with_context(
f"Required keyword {req} not found for forward model "
f"step {fm_step_name}",
f"Required keyword {req} not found for forward model step {fm_step_name}",
fm_step_name,
)
)
Expand Down Expand Up @@ -515,8 +513,7 @@ def _create_list_of_forward_model_steps_to_run(
except ForwardModelStepValidationError as err:
errors.append(
ConfigValidationError.with_context(
f"Forward model step pre-experiment validation failed: "
f"{str(err)}",
f"Forward model step pre-experiment validation failed: {str(err)}",
context=fm_step.name,
),
)
Expand Down Expand Up @@ -593,8 +590,7 @@ def __init__(self, fm_step):
)
fm_step_description = f"{fm_step.name}({fm_step_args})"
self.substitution_context_hint = (
f"parsing forward model step `FORWARD_MODEL "
f"{fm_step_description}` - "
f"parsing forward model step `FORWARD_MODEL {fm_step_description}` - "
"reconstructed, with defines applied during parsing"
)
self.copy_private_args = SubstitutionList()
Expand Down
4 changes: 1 addition & 3 deletions src/ert/storage/local_ensemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -633,9 +633,7 @@ def load_responses(self, key: str, realizations: Tuple[int]) -> xr.Dataset:
for realization in realizations:
input_path = self._realization_dir(realization) / f"{response_type}.nc"
if not input_path.exists():
raise KeyError(
f"No response for key {response_type}, realization: {realization}"
)
raise KeyError(f"No response for key {key}, realization: {realization}")
ds = xr.open_dataset(input_path, engine="scipy")

if select_key:
Expand Down
14 changes: 4 additions & 10 deletions src/ert/storage/local_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,11 @@ def __init__(
elif (version := _storage_version(self.path)) is not None:
if version < _LOCAL_STORAGE_VERSION:
raise RuntimeError(
f"Cannot open storage '{self.path}' in read-only mode: Storage "
f"version {version} is too old. Run ert to initiate migration."
f"Cannot open storage '{self.path}' in read-only mode: Storage version {version} is too old. Run ert to initiate migration."
)
if version > _LOCAL_STORAGE_VERSION:
raise RuntimeError(
f"Cannot open storage '{self.path}' in read-only mode: Storage "
f"version {version} is newer than the current version "
f"{_LOCAL_STORAGE_VERSION}, upgrade ert to continue, or run with "
f"a different ENSPATH"
f"Cannot open storage '{self.path}' in read-only mode: Storage version {version} is newer than the current version {_LOCAL_STORAGE_VERSION}, upgrade ert to continue, or run with a different ENSPATH"
)

self.refresh()
Expand Down Expand Up @@ -482,14 +478,12 @@ def _migrate(self) -> None:
self._add_migration_information(0, _LOCAL_STORAGE_VERSION, "block_fs")
elif version > _LOCAL_STORAGE_VERSION:
raise RuntimeError(
f"Cannot migrate storage '{self.path}'. Storage version {version} "
f"is newer than the current version {_LOCAL_STORAGE_VERSION}, "
f"upgrade ert to continue, or run with a different ENSPATH"
f"Cannot migrate storage '{self.path}'. Storage version {version} is newer than the current version {_LOCAL_STORAGE_VERSION}, upgrade ert to continue, or run with a different ENSPATH"
)
elif version < _LOCAL_STORAGE_VERSION:
migrations = list(enumerate([to2, to3, to4, to5, to6, to7], start=1))
for from_version, migration in migrations[version - 1 :]:
print(f"* Updating storage to version: {from_version + 1}")
print(f"* Updating storage to version: {from_version+1}")
migration.migrate(self.path)
self._add_migration_information(
from_version, from_version + 1, migration.info
Expand Down

0 comments on commit 0f63679

Please sign in to comment.