Benjamin Peterson avatar Benjamin Peterson committed 91f0d27

use generator expressions in any()

Comments (0)

Files changed (3)

lib2to3/fixes/fix_imports.py

             # Module usage could be in the trailer of an attribute lookup, so we
             # might have nested matches when "bare_with_attr" is present.
             if "bare_with_attr" not in results and \
-                    any([match(obj) for obj in attr_chain(node, "parent")]):
+                    any(match(obj) for obj in attr_chain(node, "parent")):
                 return False
             return results
         return False

lib2to3/fixes/fix_next.py

 def is_subtree(root, node):
     if root == node:
         return True
-    return any([is_subtree(c, node) for c in root.children])
+    return any(is_subtree(c, node) for c in root.children)

lib2to3/fixes/fix_renames.py

         match = super(FixRenames, self).match
         results = match(node)
         if results:
-            if any([match(obj) for obj in attr_chain(node, "parent")]):
+            if any(match(obj) for obj in attr_chain(node, "parent")):
                 return False
             return results
         return False
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.