Skip to content

Commit

Permalink
refactor: use ternary if/else assignment for n_storage
Browse files Browse the repository at this point in the history
  • Loading branch information
danielolsen committed Dec 21, 2020
1 parent 6665b69 commit e46b821
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions powersimdata/input/scenario_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,7 @@ def _read_network(self):
try:
# The next line will fail if no iess attribute (index energy storage system)
# Since we use the 'squeeze_me' param, 1 storage -> an int, not an array
if isinstance(mpc.iess, int):
n_storage = 1
else:
n_storage = mpc.iess.shape[0]
n_storage = 1 if isinstance(mpc.iess, int) else mpc.iess.shape[0]
except AttributeError:
n_storage = 0

Expand Down

0 comments on commit e46b821

Please sign in to comment.