From 1a90ceb3e02e50a54bc0267571e0f4554201b579 Mon Sep 17 00:00:00 2001 From: Sol Jerome Date: Thu, 23 Apr 2009 16:33:20 +0000 Subject: More python 2to3 updates along with pylint/code cleanups Signed-off-by: Sol Jerome git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5173 ce84e21b-d406-0410-9b95-82705330c041 --- src/lib/Options.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src/lib/Options.py') diff --git a/src/lib/Options.py b/src/lib/Options.py index c1c6d9df8..a3bf90604 100644 --- a/src/lib/Options.py +++ b/src/lib/Options.py @@ -123,20 +123,20 @@ class OptionSet(dict): self.hm = self.buildHelpMessage() def buildGetopt(self): - return ''.join([opt.buildGetopt() for opt in self.values()]) + return ''.join([opt.buildGetopt() for opt in list(self.values())]) def buildLongGetopt(self): - return [opt.buildLongGetopt() for opt in self.values() if opt.long] + return [opt.buildLongGetopt() for opt in list(self.values()) if opt.long] def buildHelpMessage(self): if hasattr(self, 'hm'): return self.hm - return ' '.join([opt.buildHelpMessage() for opt in self.values()]) + return ' '.join([opt.buildHelpMessage() for opt in list(self.values())]) def helpExit(self, msg='', code=1): if msg: - print msg - print "Usage:\n %s" % self.buildHelpMessage() + print(msg) + print("Usage:\n %s" % self.buildHelpMessage()) raise SystemExit(code) def parse(self, argv, do_getopt=True): @@ -151,7 +151,7 @@ class OptionSet(dict): if '-h' in argv: self.helpExit('', 0) self['args'] = args - for key in self.keys(): + for key in list(self.keys()): if key == 'args': continue option = self[key] @@ -268,13 +268,17 @@ ENCODING = Option('Encoding of cfg files', default=sys.getdefaultencoding(), cmd OMIT_LOCK_CHECK = Option('Omit lock check', default=False, cmd='-O') -LOGGING_FILE_PATH = Option('Set path of file log', default=None, cmd='-o', odesc='', cf=('logging', 'path')) +LOGGING_FILE_PATH = Option('Set path of file log', default=None, + cmd='-o', odesc='', cf=('logging', 'path')) CLIENT_SERVICE_MODE = Option('Set client service mode', default='default', cmd='-s', odesc='') class OptionParser(OptionSet): - '''OptionParser bootstraps option parsing, getting the value of the config file''' + ''' + OptionParser bootstraps option parsing, + getting the value of the config file + ''' def __init__(self, args): self.Bootstrap = OptionSet([('configfile', CFILE)]) self.Bootstrap.parse(sys.argv[1:], do_getopt=False) -- cgit v1.2.3-1-g7c22