Space after usage text block and pep8 compliance

This commit is contained in:
Kovid Goyal 2013-04-09 13:14:01 +05:30
parent d9acb3091b
commit c6a529613b

View File

@ -88,7 +88,7 @@ class OptionParser(_OptionParser):
if epilog is None: if epilog is None:
epilog = _('Created by ')+colored(__author__, fg='cyan') epilog = _('Created by ')+colored(__author__, fg='cyan')
usage += '\n\n'+_('''Whenever you pass arguments to %prog that have spaces in them, ''' usage += '\n\n'+_('''Whenever you pass arguments to %prog that have spaces in them, '''
'''enclose the arguments in quotation marks.''') '''enclose the arguments in quotation marks.''')+'\n'
_OptionParser.__init__(self, usage=usage, version=version, epilog=epilog, _OptionParser.__init__(self, usage=usage, version=version, epilog=epilog,
formatter=CustomHelpFormatter(), formatter=CustomHelpFormatter(),
conflict_handler=conflict_handler, **kwds) conflict_handler=conflict_handler, **kwds)
@ -171,7 +171,7 @@ class OptionParser(_OptionParser):
non default values in lower. non default values in lower.
''' '''
for dest in lower.__dict__.keys(): for dest in lower.__dict__.keys():
if not upper.__dict__.has_key(dest): if not dest in upper.__dict__:
continue continue
opt = self.option_by_dest(dest) opt = self.option_by_dest(dest)
if lower.__dict__[dest] != opt.default and \ if lower.__dict__[dest] != opt.default and \
@ -319,12 +319,16 @@ class XMLConfig(dict):
self.__setitem__(key, val) self.__setitem__(key, val)
def __delitem__(self, key): def __delitem__(self, key):
if dict.has_key(self, key): try:
dict.__delitem__(self, key) dict.__delitem__(self, key)
except KeyError:
pass # ignore missing keys
else:
self.commit() self.commit()
def commit(self): def commit(self):
if self.no_commit: return if self.no_commit:
return
if hasattr(self, 'file_path') and self.file_path: if hasattr(self, 'file_path') and self.file_path:
dpath = os.path.dirname(self.file_path) dpath = os.path.dirname(self.file_path)
if not os.path.exists(dpath): if not os.path.exists(dpath):