diff options
author | xNinjaKittyx <xNinjaKittyx@users.noreply.github.com> | 2020-12-15 17:21:33 -0800 |
---|---|---|
committer | xNinjaKittyx <xNinjaKittyx@users.noreply.github.com> | 2020-12-15 18:20:13 -0800 |
commit | 9aa54a5b27468d61337528cb1e1b5b9b11a80978 (patch) | |
tree | 567693115cc101efb9254a96d96d80e9f9ccd557 /examples/default_categories.py | |
parent | 03c65c60b39e369958b056c5c844d36d515c8a63 (diff) | |
download | cmd2-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/default_categories.py')
-rw-r--r-- | examples/default_categories.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/examples/default_categories.py b/examples/default_categories.py index 19699513..bee2b1ea 100644 --- a/examples/default_categories.py +++ b/examples/default_categories.py @@ -11,6 +11,7 @@ from cmd2 import CommandSet, with_default_category @with_default_category('Default Category') class MyBaseCommandSet(CommandSet): """Defines a default category for all sub-class CommandSets""" + pass @@ -18,6 +19,7 @@ class ChildInheritsParentCategories(MyBaseCommandSet): """ This subclass doesn't declare any categories so all commands here are also categorized under 'Default Category' """ + def do_hello(self, _: cmd2.Statement): self._cmd.poutput('Hello') @@ -31,6 +33,7 @@ class ChildOverridesParentCategoriesNonHeritable(MyBaseCommandSet): This subclass overrides the 'Default Category' from the parent, but in a non-heritable fashion. Sub-classes of this CommandSet will not inherit this category and will, instead, inherit 'Default Category' """ + def do_goodbye(self, _: cmd2.Statement): self._cmd.poutput('Goodbye') @@ -40,6 +43,7 @@ class GrandchildInheritsGrandparentCategory(ChildOverridesParentCategoriesNonHer This subclass's parent class declared its default category non-heritable. Instead, it inherits the category defined by the grandparent class. """ + def do_aloha(self, _: cmd2.Statement): self._cmd.poutput('Aloha') @@ -50,6 +54,7 @@ class ChildOverridesParentCategories(MyBaseCommandSet): This subclass is decorated with a default category that is heritable. This overrides the parent class's default category declaration. """ + def do_bonjour(self, _: cmd2.Statement): self._cmd.poutput('Bonjour') @@ -59,6 +64,7 @@ class GrandchildInheritsHeritable(ChildOverridesParentCategories): This subclass's parent declares a default category that overrides its parent. As a result, commands in this CommandSet will be categorized under 'Heritable Category' """ + def do_monde(self, _: cmd2.Statement): self._cmd.poutput('Monde') |