Skip to content

Commit 39ee130

Browse files
Merge pull request #2224 from allmightyspiff/issues2223
Fixed tox errors
2 parents 85255be + 7ac285f commit 39ee130

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

SoftLayer/CLI/command.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ def get_command(self, ctx, cmd_name):
7373
else:
7474
return module
7575

76+
# # pylint: disable=unused-argument
7677
def format_usage(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None:
7778
"""Formats and colorizes the usage information."""
7879
self.ensure_env(ctx)
@@ -85,6 +86,7 @@ def format_usage(self, ctx: click.Context, formatter: click.formatting.HelpForma
8586

8687
self.console.print(f"Usage: [path]{ctx.command_path}[/] {' '.join(pieces)}")
8788

89+
# pylint: disable=unused-argument
8890
def format_help_text(self, ctx: click.Context, formatter: click.formatting.HelpFormatter) -> None:
8991
"""Writes the help text"""
9092
text = self.help if self.help is not None else ""
@@ -104,6 +106,7 @@ def format_epilog(self, ctx: click.Context, formatter: click.formatting.HelpForm
104106
self.console.print(epilog)
105107
self.format_commands(ctx, formatter)
106108

109+
# pylint: disable=unused-argument
107110
def format_options(self, ctx, formatter):
108111
"""Prints out the options in a table format"""
109112

@@ -136,7 +139,9 @@ def format_options(self, ctx, formatter):
136139

137140
self.console.print(options_table)
138141

142+
# pylint: disable=unused-argument
139143
def format_commands(self, ctx, formatter):
144+
"""Formats the command list for click"""
140145
commands = []
141146
for subcommand in self.list_commands(ctx):
142147
cmd = self.get_command(ctx, subcommand)

SoftLayer/CLI/formatting.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,10 @@ def confirm(prompt_str, default=False):
243243
default_str = 'n'
244244
prompt = '%s [y/N]' % prompt_str
245245

246-
ans = click.prompt(prompt, default=default_str, show_default=False)
246+
try:
247+
ans = click.prompt(prompt, default=default_str, show_default=False)
248+
except click.exceptions.Abort:
249+
return False
247250
if ans.lower() in ('y', 'yes', 'yeah', 'yup', 'yolo'):
248251
return True
249252

@@ -260,7 +263,10 @@ def no_going_back(confirmation):
260263

261264
prompt = f"This action cannot be undone! Type '{confirmation}' or press Enter to abort"
262265

263-
ans = click.prompt(prompt, default='', show_default=False)
266+
try:
267+
ans = click.prompt(prompt, default='', show_default=False)
268+
except click.exceptions.Abort:
269+
return False
264270
if ans.lower() == str(confirmation).lower():
265271
return True
266272

SoftLayer/CLI/object_storage/credential/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def __init__(self, **attrs):
1717
click.MultiCommand.__init__(self, **attrs)
1818
self.path = os.path.dirname(__file__)
1919

20+
# pylint: disable=unused-argument
2021
def list_commands(self, ctx):
2122
"""List all sub-commands."""
2223
commands = []
@@ -28,6 +29,7 @@ def list_commands(self, ctx):
2829
commands.sort()
2930
return commands
3031

32+
# pylint: disable=unused-argument
3133
def get_command(self, ctx, cmd_name):
3234
"""Get command for click."""
3335
path = "%s.%s" % (__name__, cmd_name)

0 commit comments

Comments
 (0)