summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-15 14:26:29 -0700
committerTodd Leonhardt <todd.leonhardt@gmail.com>2018-04-15 14:26:29 -0700
commit60dddb03d05ccf4088242a524e624f61782dd40f (patch)
tree816eb6176ea40bf9d7c6f0d15715fe0a4b813cda /examples
parent40eb6f6c9428a5a3a54cebef34da7dae173dd074 (diff)
downloadcmd2-git-60dddb03d05ccf4088242a524e624f61782dd40f.tar.gz
Started removing dependency on six
Removed all dependency on six other than for six.moves.input Also: - Started removing code branches which were for Python 2 support
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/alias_startup.py2
-rwxr-xr-xexamples/arg_print.py2
-rwxr-xr-xexamples/argparse_example.py2
-rwxr-xr-xexamples/environment.py2
-rwxr-xr-xexamples/event_loops.py2
-rwxr-xr-xexamples/example.py2
-rwxr-xr-xexamples/help_categories.py2
-rwxr-xr-xexamples/paged_output.py2
-rwxr-xr-xexamples/persistent_history.py2
-rwxr-xr-xexamples/pirate.py2
-rwxr-xr-xexamples/python_scripting.py2
-rwxr-xr-xexamples/remove_unused.py2
-rwxr-xr-xexamples/subcommands.py2
-rwxr-xr-xexamples/submenus.py2
-rwxr-xr-xexamples/tab_completion.py2
-rwxr-xr-xexamples/table_display.py2
16 files changed, 16 insertions, 16 deletions
diff --git a/examples/alias_startup.py b/examples/alias_startup.py
index 23e51048..30764c27 100755
--- a/examples/alias_startup.py
+++ b/examples/alias_startup.py
@@ -16,7 +16,7 @@ class AliasAndStartup(cmd2.Cmd):
""" Example cmd2 application where we create commands that just print the arguments they are called with."""
def __init__(self):
- cmd2.Cmd.__init__(self, startup_script='.cmd2rc')
+ super().__init__(startup_script='.cmd2rc')
if __name__ == '__main__':
diff --git a/examples/arg_print.py b/examples/arg_print.py
index 3083c0d7..18fa483f 100755
--- a/examples/arg_print.py
+++ b/examples/arg_print.py
@@ -28,7 +28,7 @@ class ArgumentAndOptionPrinter(cmd2.Cmd):
self.shortcuts.update({'$': 'aprint', '%': 'oprint'})
# Make sure to call this super class __init__ *after* setting commentGrammars and/or updating shortcuts
- cmd2.Cmd.__init__(self)
+ super().__init__()
# NOTE: It is critical that the super class __init__ method be called AFTER updating certain parameters which
# are not settable at runtime. This includes the commentGrammars, shortcuts, multilineCommands, etc.
diff --git a/examples/argparse_example.py b/examples/argparse_example.py
index ca2173e7..e9b377ba 100755
--- a/examples/argparse_example.py
+++ b/examples/argparse_example.py
@@ -28,7 +28,7 @@ class CmdLineApp(Cmd):
self.settable['maxrepeats'] = 'Max number of `--repeat`s allowed'
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
- Cmd.__init__(self, use_ipython=False, transcript_files=transcript_files)
+ super().__init__(use_ipython=False, transcript_files=transcript_files)
# Disable cmd's usage of command-line arguments as commands to be run at invocation
# self.allow_cli_args = False
diff --git a/examples/environment.py b/examples/environment.py
index ca39711e..c245f55d 100755
--- a/examples/environment.py
+++ b/examples/environment.py
@@ -16,7 +16,7 @@ class EnvironmentApp(Cmd):
def __init__(self):
self.settable.update({'degrees_c': 'Temperature in Celsius'})
self.settable.update({'sunny': 'Is it sunny outside?'})
- Cmd.__init__(self)
+ super().__init__()
def do_sunbathe(self, arg):
if self.degrees_c < 20:
diff --git a/examples/event_loops.py b/examples/event_loops.py
index 24efa830..53d3ca2b 100755
--- a/examples/event_loops.py
+++ b/examples/event_loops.py
@@ -12,7 +12,7 @@ import cmd2
class Cmd2EventBased(cmd2.Cmd):
"""Basic example of how to run cmd2 without it controlling the main loop."""
def __init__(self):
- cmd2.Cmd.__init__(self)
+ super().__init__()
# ... your class code here ...
diff --git a/examples/example.py b/examples/example.py
index 94ca7693..612d81e5 100755
--- a/examples/example.py
+++ b/examples/example.py
@@ -35,7 +35,7 @@ class CmdLineApp(Cmd):
self.shortcuts.update({'&': 'speak'})
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
- Cmd.__init__(self, use_ipython=False)
+ super().__init__(use_ipython=False)
speak_parser = argparse.ArgumentParser()
speak_parser.add_argument('-p', '--piglatin', action='store_true', help='atinLay')
diff --git a/examples/help_categories.py b/examples/help_categories.py
index e7e3373d..cfb5f253 100755
--- a/examples/help_categories.py
+++ b/examples/help_categories.py
@@ -18,7 +18,7 @@ class HelpCategories(Cmd):
def __init__(self):
# Set use_ipython to True to enable the "ipy" command which embeds and interactive IPython shell
- Cmd.__init__(self, use_ipython=False)
+ super().__init__(use_ipython=False)
def do_connect(self, _):
"""Connect command"""
diff --git a/examples/paged_output.py b/examples/paged_output.py
index cb213087..bb410af6 100755
--- a/examples/paged_output.py
+++ b/examples/paged_output.py
@@ -11,7 +11,7 @@ class PagedOutput(cmd2.Cmd):
""" Example cmd2 application where we create commands that just print the arguments they are called with."""
def __init__(self):
- cmd2.Cmd.__init__(self)
+ super().__init__()
@with_argument_list
def do_page_file(self, args):
diff --git a/examples/persistent_history.py b/examples/persistent_history.py
index e1874212..61e26b9c 100755
--- a/examples/persistent_history.py
+++ b/examples/persistent_history.py
@@ -15,7 +15,7 @@ class Cmd2PersistentHistory(cmd2.Cmd):
:param hist_file: file to load readline history from at start and write it to at end
"""
- cmd2.Cmd.__init__(self, persistent_history_file=hist_file, persistent_history_length=500)
+ super().__init__(persistent_history_file=hist_file, persistent_history_length=500)
self.allow_cli_args = False
self.prompt = 'ph> '
diff --git a/examples/pirate.py b/examples/pirate.py
index f3a8fc7a..7fe3884b 100755
--- a/examples/pirate.py
+++ b/examples/pirate.py
@@ -23,7 +23,7 @@ class Pirate(Cmd):
self.shortcuts.update({'~': 'sing'})
"""Initialize the base class as well as this one"""
- Cmd.__init__(self)
+ super().__init__()
# prompts and defaults
self.gold = 0
self.initial_gold = self.gold
diff --git a/examples/python_scripting.py b/examples/python_scripting.py
index 5f7996e2..7e2cf345 100755
--- a/examples/python_scripting.py
+++ b/examples/python_scripting.py
@@ -25,7 +25,7 @@ class CmdLineApp(cmd2.Cmd):
def __init__(self):
# Enable the optional ipy command if IPython is installed by setting use_ipython=True
- cmd2.Cmd.__init__(self, use_ipython=True)
+ super().__init__(use_ipython=True)
self._set_prompt()
self.intro = 'Happy 𝛑 Day. Note the full Unicode support: 😇 (Python 3 only) 💩'
diff --git a/examples/remove_unused.py b/examples/remove_unused.py
index cf26fcff..8a567123 100755
--- a/examples/remove_unused.py
+++ b/examples/remove_unused.py
@@ -16,7 +16,7 @@ class RemoveUnusedBuiltinCommands(cmd2.Cmd):
""" Example cmd2 application where we remove some unused built-in commands."""
def __init__(self):
- cmd2.Cmd.__init__(self)
+ super().__init__()
# To hide commands from displaying in the help menu, add them to the hidden_commands list
self.hidden_commands.append('py')
diff --git a/examples/subcommands.py b/examples/subcommands.py
index cbe4f634..031b17b2 100755
--- a/examples/subcommands.py
+++ b/examples/subcommands.py
@@ -20,7 +20,7 @@ class SubcommandsExample(cmd2.Cmd):
"""
def __init__(self):
- cmd2.Cmd.__init__(self)
+ super().__init__()
# subcommand functions for the base command
def base_foo(self, args):
diff --git a/examples/submenus.py b/examples/submenus.py
index 1e3da0da..44b17f33 100755
--- a/examples/submenus.py
+++ b/examples/submenus.py
@@ -19,7 +19,7 @@ class ThirdLevel(cmd2.Cmd):
"""To be used as a third level command class. """
def __init__(self, *args, **kwargs):
- cmd2.Cmd.__init__(self, *args, **kwargs)
+ super().__init__(*args, **kwargs)
self.prompt = '3rdLevel '
self.top_level_attr = None
self.second_level_attr = None
diff --git a/examples/tab_completion.py b/examples/tab_completion.py
index 1419b294..919e9560 100755
--- a/examples/tab_completion.py
+++ b/examples/tab_completion.py
@@ -16,7 +16,7 @@ class TabCompleteExample(cmd2.Cmd):
""" Example cmd2 application where we a base command which has a couple subcommands."""
def __init__(self):
- cmd2.Cmd.__init__(self)
+ super().__init__()
add_item_parser = argparse.ArgumentParser()
add_item_group = add_item_parser.add_mutually_exclusive_group()
diff --git a/examples/table_display.py b/examples/table_display.py
index 68b73d0f..2e6ea804 100755
--- a/examples/table_display.py
+++ b/examples/table_display.py
@@ -37,7 +37,7 @@ class TableDisplay(cmd2.Cmd):
"""Example cmd2 application showing how you can display tabular data."""
def __init__(self):
- cmd2.Cmd.__init__(self)
+ super().__init__()
def ptable(self, tabular_data, headers=()):
"""Format tabular data for pretty-printing as a fixed-width table and then display it using a pager.