Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Oliver Sanders <[email protected]>
  • Loading branch information
wxtim and oliver-sanders authored Jun 19, 2024
1 parent 7ab440a commit 5ac743a
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions cylc/flow/command_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,28 +232,27 @@ def consistency(


def is_tasks(tasks: Iterable[str]):
"""All tasks in a list of tasks are task ID's
without trailing job ID.
"""All tasks in a list of tasks are task ID's without trailing job ID.
Examples:
# All legal
>>> is_tasks(['1/foo', '1/bar', '*/baz', '*/*'])
True
# Some legal
>>> is_tasks(['1/foo/NN', '1/bar', '*/baz', '*/*/42'])
Traceback (most recent call last):
...
Exception: This command does not take job ids:
InputError: This command does not take job ids:
* 1/foo/NN
* */*/42
# None legal
>>> is_tasks(['*/baz/12'])
Traceback (most recent call last):
...
Exception: This command does not take job ids:
InputError: This command does not take job ids:
* */baz/12
"""
bad_tasks: List[str] = []
for task in tasks:
Expand All @@ -262,5 +261,4 @@ def is_tasks(tasks: Iterable[str]):
bad_tasks.append(task)
if bad_tasks:
msg = 'This command does not take job ids:\n * '
raise Exception(msg + '\n * '.join(bad_tasks))
return True
raise InputError(msg + '\n * '.join(bad_tasks))

Check warning on line 264 in cylc/flow/command_validation.py

View check run for this annotation

Codecov / codecov/patch

cylc/flow/command_validation.py#L264

Added line #L264 was not covered by tests

0 comments on commit 5ac743a

Please sign in to comment.