Chromium Code Reviews| Index: third_party/logilab/common/cli.py |
| diff --git a/third_party/logilab/common/cli.py b/third_party/logilab/common/cli.py |
| index 0ad4e4c3f6aa5509621be12a5f0baeb5a9df4da5..cdeef974f482eb8258625ed9b82db307dc24a677 100644 |
| --- a/third_party/logilab/common/cli.py |
| +++ b/third_party/logilab/common/cli.py |
| @@ -33,15 +33,17 @@ Example:: |
| help_do_pionce = ("pionce", "pionce duree", _("met ton corps en veille")) |
| def do_pionce(self): |
| - print 'nap is good' |
| + print('nap is good') |
| help_do_ronfle = ("ronfle", "ronfle volume", _("met les autres en veille")) |
| def do_ronfle(self): |
| - print 'fuuuuuuuuuuuu rhhhhhrhrhrrh' |
| + print('fuuuuuuuuuuuu rhhhhhrhrhrrh') |
| cl = BookShell() |
| """ |
| +from __future__ import print_function |
| + |
| __docformat__ = "restructuredtext en" |
| from six.moves import builtins, input |
| @@ -66,7 +68,7 @@ def init_readline(complete_method, histfile=None): |
| import atexit |
| atexit.register(readline.write_history_file, histfile) |
| except: |
| - print 'readline is not available :-(' |
| + print('readline is not available :-(') |
| class Completer : |
| @@ -157,10 +159,10 @@ class CLIHelper: |
| return self.commands.keys() |
| def _print_help(self, cmd, syntax, explanation): |
| - print _('Command %s') % cmd |
| - print _('Syntax: %s') % syntax |
| - print '\t', explanation |
| + print(_('Command %s') % cmd) |
| + print(_('Syntax: %s') % syntax) |
| + print('\t', explanation) |
| + print() |
| # predefined commands ##################################################### |
| @@ -170,20 +172,20 @@ class CLIHelper: |
| if command in self._command_help: |
| self._print_help(*self._command_help[command]) |
| elif command is None or command not in self._topics: |
| - print _("Use help <topic> or help <command>.") |
| - print _("Available topics are:") |
| + print(_("Use help <topic> or help <command>.")) |
| + print(_("Available topics are:")) |
| topics = sorted(self._topics.keys()) |
| for topic in topics: |
| - print '\t', topic |
| - print _("Available commands are:") |
| + print('\t', topic) |
| + print() |
| + print(_("Available commands are:")) |
| commands = self.commands.keys() |
| commands.sort() |
| for command in commands: |
| - print '\t', command[len(self.CMD_PREFIX):] |
| + print('\t', command[len(self.CMD_PREFIX):]) |
| else: |
| - print _('Available commands about %s:') % command |
| + print(_('Available commands about %s:') % command) |
| for command_help_method in self._topics[command]: |
| try: |
| @@ -194,8 +196,8 @@ class CLIHelper: |
| except: |
| import traceback |
| traceback.print_exc() |
| - print 'ERROR in help method %s'% ( |
| - command_help_method.__name__) |
| + print('ERROR in help method %s'% ( |
| + command_help_method.__name__)) |
| help_do_help = ("help", "help [topic|command]", |
| _("print help message for the given topic/command or \ |