Skip to content

Commit

Permalink
Allow action option "active" to accept True/False conditions #914
Browse files Browse the repository at this point in the history
  • Loading branch information
Bo Peng committed Mar 7, 2018
1 parent cd86e00 commit 6e52a1d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/sos/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,11 @@ def action_wrapper(*args, **kwargs):
env.logger.warning(
f'Passing runtime option "{k}" to action is deprecated. Please use "task: {k}={v}" before action instead.')
if 'active' in kwargs:
if isinstance(kwargs['active'], int):
if kwargs['active'] is False:
return None
elif kwargs['active'] is True:
pass
elif isinstance(kwargs['active'], int):
if kwargs['active'] >= 0 and env.sos_dict['_index'] != kwargs['active']:
return None
if kwargs['active'] < 0 and env.sos_dict['_index'] != kwargs['active'] + env.sos_dict['__num_groups__']:
Expand Down

0 comments on commit 6e52a1d

Please sign in to comment.