Add flake8-comprehensions

This commit is contained in:
Florian Bruhin 2017-11-26 21:42:50 +01:00
parent 1981239478
commit 248a12a8b9
6 changed files with 8 additions and 6 deletions

View File

@ -2,6 +2,7 @@
flake8==3.5.0
flake8-builtins==1.0
flake8-comprehensions==1.4.1
flake8-copyright==0.2.0
flake8-debugger==3.0.0
flake8-deprecated==1.3

View File

@ -1,5 +1,6 @@
flake8
flake8-builtins
flake8-comprehensions
flake8-copyright
flake8-debugger
flake8-deprecated

View File

@ -221,7 +221,7 @@ class AbstractWebElement(collections.abc.MutableMapping):
}
relevant_classes = classes[self.tag_name()]
for klass in self.classes():
if any([klass.strip().startswith(e) for e in relevant_classes]):
if any(klass.strip().startswith(e) for e in relevant_classes):
return True
return False

View File

@ -502,8 +502,8 @@ class _Downloader:
This is needed if a download finishes before attaching its
finished signal.
"""
items = set((url, item) for url, item in self.pending_downloads
if item.done)
items = {(url, item) for url, item in self.pending_downloads
if item.done}
log.downloads.debug("Zombie downloads: {}".format(items))
for url, item in items:
self._finished(url, item)

View File

@ -102,8 +102,8 @@ class NeighborList(collections.abc.Sequence):
if items:
item = min(items, key=lambda tpl: abs(self.fuzzyval - tpl[1]))
else:
sorted_items = sorted([(idx, e) for (idx, e) in
enumerate(self.items)], key=lambda e: e[1])
sorted_items = sorted(((idx, e) for (idx, e) in
enumerate(self.items)), key=lambda e: e[1])
idx = 0 if offset < 0 else -1
item = sorted_items[idx]
self._idx = item[0]

View File

@ -61,7 +61,7 @@ def main():
for root, _dirs, _files in os.walk(os.getcwd()):
path = os.path.basename(root)
if any([fnmatch.fnmatch(path, e) for e in recursive_lint]):
if any(fnmatch.fnmatch(path, e) for e in recursive_lint):
remove(root)