summaryrefslogtreecommitdiff
path: root/examples/help_categories.py
diff options
context:
space:
mode:
authorxNinjaKittyx <xNinjaKittyx@users.noreply.github.com>2020-12-15 17:21:33 -0800
committerxNinjaKittyx <xNinjaKittyx@users.noreply.github.com>2020-12-15 18:20:13 -0800
commit9aa54a5b27468d61337528cb1e1b5b9b11a80978 (patch)
tree567693115cc101efb9254a96d96d80e9f9ccd557 /examples/help_categories.py
parent03c65c60b39e369958b056c5c844d36d515c8a63 (diff)
downloadcmd2-git-ci_improvements.tar.gz
Adds pre-commit config to run various lintersci_improvements
This ads black, isort, pyupgrade, and flake8 to pre-commit-config.yaml There are also some small changes to travis.yml and tasks.py to reduce some repeated configurations that should be consolidated into setup.cfg. Most other changes are automated by the linter scripts.
Diffstat (limited to 'examples/help_categories.py')
-rwxr-xr-xexamples/help_categories.py22
1 files changed, 9 insertions, 13 deletions
diff --git a/examples/help_categories.py b/examples/help_categories.py
index 7401bafe..16860ec2 100755
--- a/examples/help_categories.py
+++ b/examples/help_categories.py
@@ -16,6 +16,7 @@ def my_decorator(f):
def wrapper(*args, **kwds):
print('Calling decorated function')
return f(*args, **kwds)
+
return wrapper
@@ -70,8 +71,9 @@ class HelpCategories(cmd2.Cmd):
"""Redeploy command"""
self.poutput('Redeploy')
- restart_parser = cmd2.DEFAULT_ARGUMENT_PARSER(description='Restart',
- epilog='my_decorator does not run when argparse errors')
+ restart_parser = cmd2.DEFAULT_ARGUMENT_PARSER(
+ description='Restart', epilog='my_decorator does not run when argparse errors'
+ )
restart_parser.add_argument('when', choices=START_TIMES, help='Specify when to restart')
@cmd2.with_argparser(restart_parser)
@@ -98,15 +100,10 @@ class HelpCategories(cmd2.Cmd):
self.poutput('Find Leakers')
# Tag the above command functions under the category Application Management
- cmd2.categorize((do_list,
- do_deploy,
- do_start,
- do_sessions,
- do_redeploy,
- do_expire,
- do_undeploy,
- do_stop,
- do_findleakers), CMD_CAT_APP_MGMT)
+ cmd2.categorize(
+ (do_list, do_deploy, do_start, do_sessions, do_redeploy, do_expire, do_undeploy, do_stop, do_findleakers),
+ CMD_CAT_APP_MGMT,
+ )
def do_resources(self, _):
"""Resources command"""
@@ -160,8 +157,7 @@ class HelpCategories(cmd2.Cmd):
@cmd2.with_category("Command Management")
def do_disable_commands(self, _):
"""Disable the Application Management commands"""
- message_to_print = "{} is not available while {} commands are disabled".format(COMMAND_NAME,
- self.CMD_CAT_APP_MGMT)
+ message_to_print = "{} is not available while {} commands are disabled".format(COMMAND_NAME, self.CMD_CAT_APP_MGMT)
self.disable_category(self.CMD_CAT_APP_MGMT, message_to_print)
self.poutput("The Application Management commands have been disabled")