diff options
author | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-02-05 11:55:39 -0500 |
---|---|---|
committer | Todd Leonhardt <todd.leonhardt@gmail.com> | 2017-02-05 11:55:39 -0500 |
commit | ce71e89c1d01e03df7abba3396d9445657ad04d9 (patch) | |
tree | e969ca29823c4eaf9d301b8c1518d8b9e87d99aa /cmd2.py | |
parent | 59bd32f5d4d2b04522b54b0a042d2d69fc7ed710 (diff) | |
download | cmd2-git-ce71e89c1d01e03df7abba3396d9445657ad04d9.tar.gz |
Fixed how the six.moves.input function is imported and used.
Also added a unit test for the cmd2.Cmd.select() method.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -51,8 +51,8 @@ from six import next # Possible types for text data. This is basestring() in Python 2 and str in Python 3. from six import string_types -# raw_input() for Python 2 or input() for Python 3 -from six.moves import input +# Used for sm.input: raw_input() for Python 2 or input() for Python 3 +import six.moves as sm # itertools.zip() for Python 2 or zip() for Python 3 - produces an iterator in both cases from six.moves import zip @@ -1010,7 +1010,7 @@ class Cmd(cmd.Cmd): if self.use_rawinput: try: - line = input(prompt) + line = sm.input(prompt) except EOFError: line = 'EOF' else: @@ -1103,7 +1103,7 @@ class Cmd(cmd.Cmd): for (idx, (value, text)) in enumerate(fulloptions): self.poutput(' %2d. %s\n' % (idx + 1, text)) while True: - response = input(prompt) + response = sm.input(prompt) try: response = int(response) result = fulloptions[response - 1][0] @@ -1164,7 +1164,7 @@ class Cmd(cmd.Cmd): def do_pause(self, arg): 'Displays the specified text then waits for the user to press RETURN.' - input(arg + '\n') + sm.input(arg + '\n') def do_shell(self, arg): 'execute a command as if at the OS prompt.' |