Pass a list iterator directly to "any" or "all" functions

This commit is contained in:
Ivan Kravets committed 2018-01-18 22:04:43 +02:00
1 parent 3caa2a9e8d
commit 2b4b2eb571
8 files changed
+14 -15

No files matched your search

+3 -4
View File
@@ -57,10 +57,9 @@ class LibBuilderFactory(object):
@staticmethod
def get_used_frameworks(env, path):
if any([
if any(
isfile(join(path, fname))
for fname in ("library.properties", "keywords.txt")
]):
for fname in ("library.properties", "keywords.txt")):
return ["arduino"]
if isfile(join(path, "module.json")):
@@ -156,7 +155,7 @@ class LibBuilderBase(object):
@property
def include_dir(self):
if not all([isdir(join(self.path, d)) for d in ("include", "src")]):
if not all(isdir(join(self.path, d)) for d in ("include", "src")):
return None
return join(self.path, "include")
+2 -2
View File
@@ -114,10 +114,10 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
mbed_pages = [
join(item['path'], n) for n in ("mbed.htm", "mbed.html")
]
if any([isfile(p) for p in mbed_pages]):
if any(isfile(p) for p in mbed_pages):
return item['path']
if item['name'] \
and any([l in item['name'].lower() for l in msdlabels]):
and any(l in item['name'].lower() for l in msdlabels):
return item['path']
return None
+1 -1
View File
@@ -68,7 +68,7 @@ def BuildProgram(env):
# append specified LD_SCRIPT
if ("LDSCRIPT_PATH" in env
and not any(["-Wl,-T" in f for f in env['LINKFLAGS']])):
and not any("-Wl,-T" in f for f in env['LINKFLAGS'])):
env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"'])
# enable "cyclic reference" for linker