diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2009-04-23 16:33:20 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2009-04-23 16:33:20 +0000 |
commit | 1a90ceb3e02e50a54bc0267571e0f4554201b579 (patch) | |
tree | edd3944fe64408295901fc8b7c340d0c659fc627 /src/lib/Options.py | |
parent | 4869aaf3a4cbf1034ff3c457c546aa82999fda65 (diff) | |
download | bcfg2-1a90ceb3e02e50a54bc0267571e0f4554201b579.tar.gz bcfg2-1a90ceb3e02e50a54bc0267571e0f4554201b579.tar.bz2 bcfg2-1a90ceb3e02e50a54bc0267571e0f4554201b579.zip |
More python 2to3 updates along with pylint/code cleanups
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5173 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Options.py')
-rw-r--r-- | src/lib/Options.py | 20 |
1 files changed, 12 insertions, 8 deletions
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='<path>', cf=('logging', 'path')) +LOGGING_FILE_PATH = Option('Set path of file log', default=None, + cmd='-o', odesc='<path>', cf=('logging', 'path')) CLIENT_SERVICE_MODE = Option('Set client service mode', default='default', cmd='-s', odesc='<default|disabled|build>') 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) |