Skip to content

Commit b6439a2

Browse files
committed
fix: flake8 warnings
Signed-off-by: laurensmiers <[email protected]>
1 parent 76cad7e commit b6439a2

File tree

3 files changed

+23
-8
lines changed

3 files changed

+23
-8
lines changed

invoke/parser/parser.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ def complete_context(self) -> None:
345345
return
346346

347347
# Ensure all of context's positional args have been given
348-
if not self.context.skip_checks and self.context.missing_positional_args:
348+
if not self.context.skip_checks \
349+
and self.context.missing_positional_args:
349350
err = "'{}' did not receive required positional arguments: {}"
350351
names = ", ".join(
351352
"'{}'".format(x.name)

tests/parser_parser.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -502,17 +502,31 @@ def core_bool_but_per_task_string(self):
502502
assert result[1].args.hide.value == "both"
503503

504504
def help_passed_when_task_expects_one_positional_arg(self):
505-
init = Context(args=[Argument(names=("help", "h"), optional=True)])
506-
task1 = Context("mytask", args=[Argument(names=("name", "n"), kind=str, positional=True)])
505+
init = Context(args=[Argument(names=("help", "h"), optional=True)]) # noqa
506+
task1 = Context("mytask",
507+
args=[
508+
Argument(
509+
names=("name", "n"),
510+
kind=str,
511+
positional=True)
512+
])
507513
parser = Parser(initial=init, contexts=[task1])
508514
result = parser.parse_argv(["mytask", "--help"])
509515
assert result[0].flags['--help'].value == "mytask"
510516

511517
def help_passed_when_task_expects_multiple_positional_arg(self):
512-
init = Context(args=[Argument(names=("help", "h"), optional=True)])
513-
task1 = Context("mytask", args=[Argument(names=("pos_arg_one", "o"), kind=str, positional=True),
514-
Argument(names=("pos_arg_two", "t"), kind=str, positional=True)
515-
])
518+
init = Context(args=[Argument(names=("help", "h"), optional=True)]) # noqa
519+
task1 = Context("mytask",
520+
args=[
521+
Argument(
522+
names=("pos_arg_one", "o"),
523+
kind=str,
524+
positional=True),
525+
Argument(
526+
names=("pos_arg_two", "t"),
527+
kind=str,
528+
positional=True)
529+
])
516530
parser = Parser(initial=init, contexts=[task1])
517531
result = parser.parse_argv(["mytask", "--help"])
518532
assert result[0].flags['--help'].value == "mytask"

tests/program.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ def prints_help_if_no_mandatory_arg(self):
665665
-w STRING, --who=STRING Who to punch
666666
667667
""".lstrip()
668-
expected_error= """
668+
expected_error = """
669669
'punch' did not receive required positional arguments: 'who', 'why'
670670
""".lstrip()
671671
expect("-c decorators punch", out=expected, err=expected_error)

0 commit comments

Comments
 (0)