Skip to content

Commit 0734838

Browse files
committed
Implement suggestions
1 parent a349cc9 commit 0734838

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

plugwise/util.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,14 +235,8 @@ def power_data_energy_diff(
235235
and "phase" not in measurement
236236
and "interval" not in net_string
237237
):
238-
diff = 1
239-
if "produced" in measurement:
240-
diff = -1
241-
if net_string not in data["sensors"]:
242-
tmp_val: float | int = 0
243-
else:
244-
tmp_val = data["sensors"][net_string]
245-
238+
diff = 1 if "produced" in measurement else -1
239+
tmp_val: float | int = data["sensors"].get(net_string, 0)
246240
if isinstance(f_val, int):
247241
tmp_val += f_val * diff
248242
else:

0 commit comments

Comments
 (0)