Skip to content

Commit

Permalink
Iterate dictionary directly
Browse files Browse the repository at this point in the history
Iterate the dictionary directly instead of calling .keys(). Using for key in dictionary would always iterate the dictionary keys.
  • Loading branch information
deepsource-autofix[bot] authored and EwoutH committed May 3, 2022
1 parent 1a590e9 commit 25529b8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ema_workbench/em_framework/outcomes.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ def __eq__(self, other):
all(
hasattr(self, key) == hasattr(other, key)
and getattr(self, key) == getattr(other, key)
for key in self.__dict__.keys()
for key in self.__dict__
),
self.__class__ == other.__class__,
]
Expand Down
2 changes: 1 addition & 1 deletion ema_workbench/examples/eijgenraam_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
52: (49.2200, 1.6075, 0.0047, 0.036173, 0.304, 0.001716, 4025.6, 0.00171, 1 / 1250),
53: (69.4565, 1.1625, 0.0028, 0.031651, 0.336, 0.002700, 9819.5, 0.00171, 1 / 1250),
}
data = {i: dict(zip(params, raw_data[i])) for i in raw_data.keys()}
data = {i: dict(zip(params, raw_data[i])) for i in raw_data}

# Set the ring we are analyzing
ring = 15
Expand Down
2 changes: 1 addition & 1 deletion test/test_em_framework/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_namedict(self):
self.assertEqual(2, len(nd), "length not correct")

# test in
for entry in kwargs.keys():
for entry in kwargs:
self.assertIn(entry, nd, f"{entry} not in NamedDict")

# test addition
Expand Down

0 comments on commit 25529b8

Please sign in to comment.