summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAngelos Evripiotis <jevripiotis@bloomberg.net>2018-01-24 08:47:23 +0000
committerAngelos Evripiotis <jevripiotis@bloomberg.net>2018-01-24 09:06:24 +0000
commitd7d2d53337e02f123a63d2c846aefa183e79e742 (patch)
treec88ad90ca8c2686e572ac2e7e88558a2d11abba0
parent9215eb03f33b6812fb940b1ad14333bba690c025 (diff)
downloadbuildstream-unused_complete_var.tar.gz
_frontend: remove unused 'ctx' param from overrideunused_complete_var
The 'ctx' parameter is carefully threaded through to 'complete_target', but it doesn't actually use it. Remove the parameter from unused places.
-rw-r--r--buildstream/_frontend/complete.py12
-rw-r--r--buildstream/_frontend/main.py9
2 files changed, 8 insertions, 13 deletions
diff --git a/buildstream/_frontend/complete.py b/buildstream/_frontend/complete.py
index c3e371cac..fa986ee6b 100644
--- a/buildstream/_frontend/complete.py
+++ b/buildstream/_frontend/complete.py
@@ -209,13 +209,12 @@ def is_incomplete_argument(current_params, cmd_param):
return False
-def get_user_autocompletions(ctx, args, incomplete, cmd_param, override):
+def get_user_autocompletions(args, incomplete, cmd_param, override):
"""
- :param ctx: context associated with the parsed command
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text of the arg to autocomplete
:param cmd_param: command definition
- :param override: a callable (cmd_param, ctx, args, incomplete) that will be
+ :param override: a callable (cmd_param, args, incomplete) that will be
called to override default completion based on parameter type. Should raise
'CompleteUnhandled' if it could not find a completion.
:return: all the possible user-specified completions for the param
@@ -224,7 +223,6 @@ def get_user_autocompletions(ctx, args, incomplete, cmd_param, override):
# Use the type specific default completions unless it was overridden
try:
return override(cmd_param=cmd_param,
- ctx=ctx,
args=args,
incomplete=incomplete)
except CompleteUnhandled:
@@ -237,7 +235,7 @@ def get_choices(cli, prog_name, args, incomplete, override):
:param prog_name: the program that is running
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text of the arg to autocomplete
- :param override: a callable (cmd_param, ctx, args, incomplete) that will be
+ :param override: a callable (cmd_param, args, incomplete) that will be
called to override default completion based on parameter type. Should raise
'CompleteUnhandled' if it could not find a completion.
:return: all the possible completions for the incomplete
@@ -270,14 +268,14 @@ def get_choices(cli, prog_name, args, incomplete, override):
# completion for option values by choices
for cmd_param in ctx.command.params:
if isinstance(cmd_param, Option) and is_incomplete_option(all_args, cmd_param):
- choices.extend(get_user_autocompletions(ctx, all_args, incomplete, cmd_param, override))
+ choices.extend(get_user_autocompletions(all_args, incomplete, cmd_param, override))
found_param = True
break
if not found_param:
# completion for argument values by choices
for cmd_param in ctx.command.params:
if isinstance(cmd_param, Argument) and is_incomplete_argument(ctx.params, cmd_param):
- choices.extend(get_user_autocompletions(ctx, all_args, incomplete, cmd_param, override))
+ choices.extend(get_user_autocompletions(all_args, incomplete, cmd_param, override))
found_param = True
break
diff --git a/buildstream/_frontend/main.py b/buildstream/_frontend/main.py
index 679ff37e5..d894280e0 100644
--- a/buildstream/_frontend/main.py
+++ b/buildstream/_frontend/main.py
@@ -54,14 +54,12 @@ INDENT = 4
##################################################################
# Special completion for completing the bst elements in a project dir
-def complete_target(ctx, args, incomplete):
+def complete_target(args, incomplete):
"""
- :param ctx: context associated with the parsed command
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text to autocomplete
:return: all the possible user-specified completions for the param
"""
- app = ctx.obj
# First resolve the directory, in case there is an
# active --directory/-C option
@@ -100,10 +98,9 @@ def complete_target(ctx, args, incomplete):
return complete_path("File", incomplete, base_directory=base_directory)
-def override_completions(cmd_param, ctx, args, incomplete):
+def override_completions(cmd_param, args, incomplete):
"""
:param cmd_param: command definition
- :param ctx: context associated with the parsed command
:param args: full list of args typed before the incomplete arg
:param incomplete: the incomplete text to autocomplete
:return: all the possible user-specified completions for the param
@@ -118,7 +115,7 @@ def override_completions(cmd_param, ctx, args, incomplete):
cmd_param.name == 'except_' or
cmd_param.opts == ['--track'] or
cmd_param.opts == ['--track-except']):
- return complete_target(ctx, args, incomplete)
+ return complete_target(args, incomplete)
raise CompleteUnhandled()