Skip to content

Commit

Permalink
loosen xargs validation checks
Browse files Browse the repository at this point in the history
  • Loading branch information
wxtim committed Jan 31, 2024
1 parent 6fea50f commit ea50b53
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cylc/flow/xtriggers/xrandom.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def validate(f_args, f_kwargs, f_signature):
if n_args + n_kwargs > 3:
raise WorkflowConfigError(f"Too many args: {f_signature}")

if n_args != 1:
if n_args + n_kwargs < 1:
raise WorkflowConfigError(f"Wrong number of args: {f_signature}")

if n_kwargs:
Expand All @@ -123,16 +123,17 @@ def validate(f_args, f_kwargs, f_signature):

try:
percent = f_kwargs['percent']
percent = float(percent)
assert isinstance(percent, (float, int))
assert percent >= 0
assert percent <= 100
except AssertionError:
except (AssertionError, ValueError):
raise WorkflowConfigError(
f"'percent' should be a float between 0 and 100: {f_signature}")

try:
secs = f_kwargs['secs']
secs = f_kwargs.get('secs', 0)
assert isinstance(secs, int)
except AssertionError:
except (AssertionError, ValueError):
raise WorkflowConfigError(
f"'secs' should be an integer: {f_signature}")

0 comments on commit ea50b53

Please sign in to comment.