Skip to content

Commit

Permalink
Set constraints to empty dict when it is None
Browse files Browse the repository at this point in the history
To prevent iterating over None.
  • Loading branch information
zhe-slac committed Nov 2, 2023
1 parent bd75ec5 commit 9fdd2bf
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/badger/gui/default/components/routine_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,11 @@ def get_routine_xopt(self):
objectives = {key: value for dictionary in routine['config']['objectives']
for key, value in dictionary.items()}
# TODO: consider critical ones
constraints = {key: value[:2] for dictionary in routine['config']['constraints']
for key, value in dictionary.items()}
if routine['config']['constraints'] is not None:
constraints = {key: value[:2] for dictionary in routine['config']['constraints']
for key, value in dictionary.items()}
else:
constraints = {}
states = routine['config']['states'] or []
vocs = {
'variables': variables,
Expand Down

0 comments on commit 9fdd2bf

Please sign in to comment.