Skip to content

Commit

Permalink
#165 Use merge_dicts from tum-esm-utils
Browse files Browse the repository at this point in the history
Close #165
  • Loading branch information
dostuffthatmatters committed May 3, 2023
1 parent 88c19ae commit 106989b
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 46 deletions.
6 changes: 4 additions & 2 deletions packages/cli/commands/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import tum_esm_utils
from packages.core import types
from packages.core.utils import update_dict_recursively

_dir = os.path.dirname
_PROJECT_DIR = _dir(_dir(_dir(_dir(os.path.abspath(__file__)))))
Expand Down Expand Up @@ -77,7 +76,10 @@ def _update_config(content: str) -> None:
return

# merge current config and new partial config
merged_json = update_dict_recursively(current_json, new_partial_json)
merged_json = tum_esm_utils.datastructures.merge_dicts(
current_json,
new_partial_json,
)
with open(_CONFIG_FILE_PATH, "w") as f:
json.dump(merged_json, f, indent=4)

Expand Down
4 changes: 2 additions & 2 deletions packages/core/interfaces/state_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def update(update: types.StateDictPartial) -> None:
changed in contrast to containing the whole file."""

current_state = StateInterface.read_without_filelock()
new_state = utils.update_dict_recursively(current_state, update)
new_state = tum_esm_utils.datastructures.merge_dicts(current_state, update)
with open(_STATE_FILE_PATH, "w") as f:
json.dump(new_state, f, indent=4)

Expand All @@ -195,6 +195,6 @@ def update_persistent(update: types.PersistentStateDictPartial) -> None:
changed in contrast to containing the whole file."""

current_state = StateInterface.read_persistent_without_filelock()
new_state = utils.update_dict_recursively(current_state, update)
new_state = tum_esm_utils.datastructures.merge_dicts(current_state, update)
with open(_PERSISTENT_STATE_FILE_PATH, "w") as f:
json.dump(new_state, f, indent=4)
1 change: 0 additions & 1 deletion packages/core/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .logger import Logger
from .astronomy import Astronomy
from .exception_email_client import ExceptionEmailClient
from .update_dict_recursively import update_dict_recursively
from .helios_image_processing import HeliosImageProcessing
41 changes: 0 additions & 41 deletions packages/core/utils/update_dict_recursively.py

This file was deleted.

0 comments on commit 106989b

Please sign in to comment.