pep8: Use "X not in Y" instead of "not X in Y"

flake8 --select E713, semi-manual fixing
This commit is contained in:
Laurent Bachelier 2014-10-11 01:27:24 +02:00
commit 21e8f82fd7
57 changed files with 81 additions and 83 deletions

View file

@ -204,7 +204,7 @@ class Application(object):
if path is None:
path = os.path.join(self.CONFDIR, self.APPNAME + '.storage')
elif not os.path.sep in path:
elif os.path.sep not in path:
path = os.path.join(self.CONFDIR, path)
storage = klass(path)
@ -232,7 +232,7 @@ class Application(object):
if path is None:
path = os.path.join(self.CONFDIR, self.APPNAME)
elif not os.path.sep in path:
elif os.path.sep not in path:
path = os.path.join(self.CONFDIR, path)
self.config = klass(path)

View file

@ -201,7 +201,7 @@ class ConsoleApplication(Application):
sys.exit(1)
def do(self, function, *args, **kwargs):
if not 'backends' in kwargs:
if 'backends' not in kwargs:
kwargs['backends'] = self.enabled_backends
return self.weboob.do(function, *args, **kwargs)
@ -216,7 +216,7 @@ class ConsoleApplication(Application):
backend_name = backends[0][0]
else:
raise BackendNotGiven(_id, backends)
if backend_name is not None and not backend_name in dict(backends):
if backend_name is not None and backend_name not in dict(backends):
# Is the backend a short version of a real one?
found = False
for key in dict(backends):

View file

@ -149,7 +149,7 @@ class IFormatter(object):
if selected_fields: # can be an empty list (nothing to do), or None (return all fields)
obj = obj.copy()
for name, value in obj.iter_fields():
if not name in selected_fields:
if name not in selected_fields:
delattr(obj, name)
if self.MANDATORY_FIELDS:
@ -167,7 +167,7 @@ class IFormatter(object):
if selected_fields:
obj = obj.copy()
for name, value in obj.iteritems():
if not name in selected_fields:
if name not in selected_fields:
obj.pop(name)
if self.MANDATORY_FIELDS:

View file

@ -128,7 +128,7 @@ class BackendCfg(QDialog):
self.connect(self.ui.configButtonBox, SIGNAL('rejected()'), self.rejectBackend)
def get_icon_cache(self, path):
if not path in self.icon_cache:
if path not in self.icon_cache:
img = QImage(path)
self.icon_cache[path] = QIcon(QPixmap.fromImage(img))
return self.icon_cache[path]
@ -358,7 +358,7 @@ class BackendCfg(QDialog):
self.ui.moduleInfo.document().addResource(QTextDocument.ImageResource, QUrl('mydata://logo.png'),
QVariant(img))
if not module.name in [n for n, ign, ign2 in self.weboob.backends_config.iter_backends()]:
if module.name not in [n for n, ign, ign2 in self.weboob.backends_config.iter_backends()]:
self.ui.nameEdit.setText(module.name)
else:
self.ui.nameEdit.setText('')

View file

@ -207,7 +207,7 @@ class ReplApplication(Cmd, ConsoleApplication):
backend.DESCRIPTION))
i = self.ask('Select a backend to proceed with "%s"' % id)
if not i.isdigit():
if not i in dict(e.backends):
if i not in dict(e.backends):
print('Error: %s is not a valid backend' % i, file=self.stderr)
continue
backend_name = i