remove unnecessary brackets

This commit is contained in:
Christophe Benz 2010-12-08 16:41:08 +01:00 committed by Romain Bignon
commit 3dd50f363d
11 changed files with 13 additions and 12 deletions

View file

@ -149,7 +149,7 @@ class BoobankMuninPlugin(object):
except KeyError: except KeyError:
pass pass
else: else:
accounts = reversed([a for b, a in self.weboob.do('iter_accounts')]) accounts = reversed(a for b, a in self.weboob.do('iter_accounts'))
first = True first = True
for account in accounts: for account in accounts:

View file

@ -75,7 +75,7 @@ class ManpageHelpFormatter(optparse.HelpFormatter):
def format_option_strings(self, option): def format_option_strings(self, option):
opts = optparse.HelpFormatter.format_option_strings(self, option).split(", ") opts = optparse.HelpFormatter.format_option_strings(self, option).split(", ")
return ".TP\n"+", ".join(["\\fB%s\\fR" % opt for opt in opts]) return ".TP\n"+", ".join("\\fB%s\\fR" % opt for opt in opts)
def main(): def main():

View file

@ -40,7 +40,7 @@ class ProfileFormatter(IFormatter):
result += self.print_node(sub, level+1) result += self.print_node(sub, level+1)
else: else:
if isinstance(node.value, (tuple,list)): if isinstance(node.value, (tuple,list)):
value = ','.join([unicode(v) for v in node.value]) value = ','.join(unicode(v) for v in node.value)
else: else:
value = node.value value = node.value
result += u'\t' * level + u'%-20s %s\n' % (node.label + ':', value) result += u'\t' * level + u'%-20s %s\n' % (node.label + ':', value)

View file

@ -266,10 +266,10 @@ class ContactProfile(QWidget):
for sub in node.value: for sub in node.value:
self.process_node(sub, value) self.process_node(sub, value)
elif isinstance(node.value, list): elif isinstance(node.value, list):
value = QLabel('<br />'.join([unicode(s) for s in node.value])) value = QLabel('<br />'.join(unicode(s) for s in node.value))
value.setWordWrap(True) value.setWordWrap(True)
elif isinstance(node.value, tuple): elif isinstance(node.value, tuple):
value = QLabel(', '.join([unicode(s) for s in node.value])) value = QLabel(', '.join(unicode(s) for s in node.value))
value.setWordWrap(True) value.setWordWrap(True)
elif isinstance(node.value, (basestring,int,long,float)): elif isinstance(node.value, (basestring,int,long,float)):
value = QLabel(unicode(node.value)) value = QLabel(unicode(node.value))

View file

@ -88,7 +88,7 @@ class WebContentEdit(ReplApplication):
print 'No changes. Abort.' print 'No changes. Abort.'
return return
print 'Contents changed:\n%s' % ('\n'.join([' * %s' % content.id for content in contents])) print 'Contents changed:\n%s' % ('\n'.join(' * %s' % content.id for content in contents))
message = self.ask('Enter a commit message', default='') message = self.ask('Enter a commit message', default='')

View file

@ -433,7 +433,7 @@ class ProfilePage(PageBase):
for key, value in d.items(): for key, value in d.items():
key = '%s:' % key key = '%s:' % key
if isinstance(value, list): if isinstance(value, list):
body += u'\t\t%-15s %s\n' % (key, u', '.join([unicode(s) for s in value])) body += u'\t\t%-15s %s\n' % (key, u', '.join(unicode(s) for s in value))
elif isinstance(value, float): elif isinstance(value, float):
body += u'\t\t%-15s %.2f\n' % (key, value) body += u'\t\t%-15s %.2f\n' % (key, value)
else: else:

View file

@ -36,5 +36,5 @@ class CSVFormatter(IFormatter):
if self.count == 0: if self.count == 0:
result += self.field_separator.join(item.iterkeys()) + '\n' result += self.field_separator.join(item.iterkeys()) + '\n'
self.count += 1 self.count += 1
result += self.field_separator.join([unicode(v) for v in item.itervalues()]) result += self.field_separator.join(unicode(v) for v in item.itervalues())
return result return result

View file

@ -287,7 +287,7 @@ class BackendCfg(QDialog):
backend.license, backend.license,
(unicode(self.tr('<b>Website</b>: %s<br />')) % backend.website) if backend.website else '', (unicode(self.tr('<b>Website</b>: %s<br />')) % backend.website) if backend.website else '',
backend.description, backend.description,
', '.join(sorted([cap.__name__.replace('ICap', '') for cap in backend.iter_caps()])))) ', '.join(sorted(cap.__name__.replace('ICap', '') for cap in backend.iter_caps()))))
if backend.has_caps(ICapAccount) and self.ui.nameEdit.isEnabled() and backend.klass.ACCOUNT_REGISTER_PROPERTIES is not None: if backend.has_caps(ICapAccount) and self.ui.nameEdit.isEnabled() and backend.klass.ACCOUNT_REGISTER_PROPERTIES is not None:
self.ui.registerButton.show() self.ui.registerButton.show()

View file

@ -353,7 +353,7 @@ class ReplApplication(Cmd, BaseApplication):
raise NotEnoughArguments('Command needs %d arguments' % req_n) raise NotEnoughArguments('Command needs %d arguments' % req_n)
if len(args) < nb: if len(args) < nb:
args += tuple([None for i in xrange(nb - len(args))]) args += tuple(None for i in xrange(nb - len(args)))
return args return args
def postcmd(self, stop, line): def postcmd(self, stop, line):

View file

@ -106,7 +106,7 @@ class BaseBackend(object):
self.lock = RLock() self.lock = RLock()
# Private fields (which start with '_') # Private fields (which start with '_')
self._private_config = dict([(key, value) for key, value in config.iteritems() if key.startswith('_')]) self._private_config = dict((key, value) for key, value in config.iteritems() if key.startswith('_'))
# Configuration of backend # Configuration of backend
self.config = {} self.config = {}

View file

@ -52,7 +52,8 @@ class Value(object):
if self.regexp is not None and not re.match(self.regexp, unicode(v)): if self.regexp is not None and not re.match(self.regexp, unicode(v)):
raise ValueError('Value "%s" does not match regexp "%s"' % (v, self.regexp)) raise ValueError('Value "%s" does not match regexp "%s"' % (v, self.regexp))
if self.choices is not None and not v in self.choices.iterkeys(): if self.choices is not None and not v in self.choices.iterkeys():
raise ValueError('Value "%s" is not in list: %s' % (v, ', '.join([unicode(s) for s in self.choices.iterkeys()]))) raise ValueError('Value "%s" is not in list: %s' % (
v, ', '.join(unicode(s) for s in self.choices.iterkeys())))
def set_value(self, v): def set_value(self, v):
self.check_valid(v) self.check_valid(v)