Skip to content

Commit

Permalink
Avoid circular import error
Browse files Browse the repository at this point in the history
  • Loading branch information
liuly12 committed Oct 2, 2024
1 parent 4f0214f commit 2a92f04
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,15 @@ def test_data_read(self):
def test_data_overrides(self):
data_path = "../docs/demo/data/processed/example_override_data.csv.gz"
input_data = pd.read_csv(data_path)
overrides = {'data_input_dict': data_path}

overrides = {"data_input_dict": data_path}
node = Node(name="")
node.apply_overrides(overrides)
node.t = list(node.data_input_dict.keys())[0][1]

self.assertEqual(
input_data.groupby("variable").get_group("temperature")["value"].iloc[0],
node.get_data_input("temperature")
node.get_data_input("temperature"),
)


Expand Down
4 changes: 2 additions & 2 deletions wsimod/nodes/nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from wsimod.core import constants
from wsimod.core.core import WSIObj
from wsimod.orchestration.model import read_csv


class Node(WSIObj):
Expand Down Expand Up @@ -89,7 +88,8 @@ def apply_overrides(self, overrides: Dict[str, Any] = {}) -> None:
overrides (dict, optional): Dictionary of overrides. Defaults to {}.
"""
# overrides data_input_dict

from wsimod.orchestration.model import read_csv

content = overrides.pop("data_input_dict", self.data_input_dict)
if isinstance(content, str):
self.data_input_dict = read_csv(content)
Expand Down

0 comments on commit 2a92f04

Please sign in to comment.