Skip to content

Fixed tox errors #2224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions SoftLayer/CLI/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ def get_command(self, ctx, cmd_name):
else:
return module

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

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

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

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

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

self.console.print(options_table)

# pylint: disable=unused-argument
def format_commands(self, ctx, formatter):
"""Formats the command list for click"""
commands = []
for subcommand in self.list_commands(ctx):
cmd = self.get_command(ctx, subcommand)
Expand Down
10 changes: 8 additions & 2 deletions SoftLayer/CLI/formatting.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ def confirm(prompt_str, default=False):
default_str = 'n'
prompt = '%s [y/N]' % prompt_str

ans = click.prompt(prompt, default=default_str, show_default=False)
try:
ans = click.prompt(prompt, default=default_str, show_default=False)
except click.exceptions.Abort:
return False
if ans.lower() in ('y', 'yes', 'yeah', 'yup', 'yolo'):
return True

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

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

ans = click.prompt(prompt, default='', show_default=False)
try:
ans = click.prompt(prompt, default='', show_default=False)
except click.exceptions.Abort:
return False
if ans.lower() == str(confirmation).lower():
return True

Expand Down
2 changes: 2 additions & 0 deletions SoftLayer/CLI/object_storage/credential/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, **attrs):
click.MultiCommand.__init__(self, **attrs)
self.path = os.path.dirname(__file__)

# pylint: disable=unused-argument
def list_commands(self, ctx):
"""List all sub-commands."""
commands = []
Expand All @@ -28,6 +29,7 @@ def list_commands(self, ctx):
commands.sort()
return commands

# pylint: disable=unused-argument
def get_command(self, ctx, cmd_name):
"""Get command for click."""
path = "%s.%s" % (__name__, cmd_name)
Expand Down