Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Unified Diff: third_party/logilab/common/clcommands.py

Issue 707353002: pylint: upgrade to 1.3.1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools/
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/logilab/common/clcommands.py
===================================================================
--- third_party/logilab/common/clcommands.py (revision 292986)
+++ third_party/logilab/common/clcommands.py (working copy)
@@ -22,6 +22,8 @@
command'specific
"""
+from __future__ import print_function
+
__docformat__ = "restructuredtext en"
import sys
@@ -115,7 +117,7 @@
if arg in ('-h', '--help'):
self.usage_and_exit(0)
if self.version is not None and arg in ('--version'):
- print self.version
+ print(self.version)
sys.exit(0)
rcfile = self.rcfile
if rcfile is not None and arg in ('-C', '--rc-file'):
@@ -127,21 +129,21 @@
try:
command = self.get_command(arg)
except KeyError:
- print 'ERROR: no %s command' % arg
- print
+ print('ERROR: no %s command' % arg)
+ print()
self.usage_and_exit(1)
try:
sys.exit(command.main_run(args, rcfile))
- except KeyboardInterrupt, exc:
- print 'Interrupted',
+ except KeyboardInterrupt as exc:
+ print('Interrupted', end=' ')
if str(exc):
- print ': %s' % exc,
- print
+ print(': %s' % exc, end=' ')
+ print()
sys.exit(4)
- except BadCommandUsage, err:
- print 'ERROR:', err
- print
- print command.help()
+ except BadCommandUsage as err:
+ print('ERROR:', err)
+ print()
+ print(command.help())
sys.exit(1)
def create_logger(self, handler, logthreshold=None):
@@ -164,32 +166,32 @@
"""display usage for the main program (i.e. when no command supplied)
and exit
"""
- print 'usage:', self.pgm,
+ print('usage:', self.pgm, end=' ')
if self.rcfile:
- print '[--rc-file=<configuration file>]',
- print '<command> [options] <command argument>...'
+ print('[--rc-file=<configuration file>]', end=' ')
+ print('<command> [options] <command argument>...')
if self.doc:
- print '\n%s' % self.doc
- print '''
+ print('\n%s' % self.doc)
+ print('''
Type "%(pgm)s <command> --help" for more information about a specific
-command. Available commands are :\n''' % self.__dict__
+command. Available commands are :\n''' % self.__dict__)
max_len = max([len(cmd) for cmd in self])
padding = ' ' * max_len
for cmdname, cmd in sorted(self.items()):
if not cmd.hidden:
- print ' ', (cmdname + padding)[:max_len], cmd.short_description()
+ print(' ', (cmdname + padding)[:max_len], cmd.short_description())
if self.rcfile:
- print '''
+ print('''
Use --rc-file=<configuration file> / -C <configuration file> before the command
to specify a configuration file. Default to %s.
-''' % self.rcfile
- print '''%(pgm)s -h/--help
- display this usage information and exit''' % self.__dict__
+''' % self.rcfile)
+ print('''%(pgm)s -h/--help
+ display this usage information and exit''' % self.__dict__)
if self.version:
- print '''%(pgm)s -v/--version
- display version configuration and exit''' % self.__dict__
+ print('''%(pgm)s -v/--version
+ display version configuration and exit''' % self.__dict__)
if self.copyright:
- print '\n', self.copyright
+ print('\n', self.copyright)
def usage_and_exit(self, status):
self.usage()
@@ -261,7 +263,7 @@
try:
self.check_args(args)
self.run(args)
- except CommandError, err:
+ except CommandError as err:
self.logger.error(err)
return 2
return 0
@@ -283,14 +285,14 @@
command = args.pop()
cmd = _COMMANDS[command]
for optname, optdict in cmd.options:
- print '--help'
- print '--' + optname
+ print('--help')
+ print('--' + optname)
else:
commands = sorted(_COMMANDS.keys())
for command in commands:
cmd = _COMMANDS[command]
if not cmd.hidden:
- print command
+ print(command)
# deprecated stuff #############################################################

Powered by Google App Engine
This is Rietveld 408576698