forked from platformio/platformio-core
Pass a list iterator directly to "any" or "all" functions
This commit is contained in:
@ -57,10 +57,9 @@ class LibBuilderFactory(object):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_used_frameworks(env, path):
|
def get_used_frameworks(env, path):
|
||||||
if any([
|
if any(
|
||||||
isfile(join(path, fname))
|
isfile(join(path, fname))
|
||||||
for fname in ("library.properties", "keywords.txt")
|
for fname in ("library.properties", "keywords.txt")):
|
||||||
]):
|
|
||||||
return ["arduino"]
|
return ["arduino"]
|
||||||
|
|
||||||
if isfile(join(path, "module.json")):
|
if isfile(join(path, "module.json")):
|
||||||
@ -156,7 +155,7 @@ class LibBuilderBase(object):
|
|||||||
|
|
||||||
@property
|
@property
|
||||||
def include_dir(self):
|
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 None
|
||||||
return join(self.path, "include")
|
return join(self.path, "include")
|
||||||
|
|
||||||
|
@ -114,10 +114,10 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
|||||||
mbed_pages = [
|
mbed_pages = [
|
||||||
join(item['path'], n) for n in ("mbed.htm", "mbed.html")
|
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']
|
return item['path']
|
||||||
if item['name'] \
|
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 item['path']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ def BuildProgram(env):
|
|||||||
|
|
||||||
# append specified LD_SCRIPT
|
# append specified LD_SCRIPT
|
||||||
if ("LDSCRIPT_PATH" in env
|
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"'])
|
env.Append(LINKFLAGS=['-Wl,-T"$LDSCRIPT_PATH"'])
|
||||||
|
|
||||||
# enable "cyclic reference" for linker
|
# enable "cyclic reference" for linker
|
||||||
|
@ -111,7 +111,7 @@ def cli(ctx, environment, target, upload_port, project_dir, silent, verbose,
|
|||||||
"nobuild" not in ep.get_build_targets():
|
"nobuild" not in ep.get_build_targets():
|
||||||
ctx.invoke(cmd_device_monitor)
|
ctx.invoke(cmd_device_monitor)
|
||||||
|
|
||||||
found_error = any([status is False for (_, status) in results])
|
found_error = any(status is False for (_, status) in results)
|
||||||
|
|
||||||
if (found_error or not silent) and len(results) > 1:
|
if (found_error or not silent) and len(results) > 1:
|
||||||
click.echo()
|
click.echo()
|
||||||
@ -411,6 +411,6 @@ def calculate_project_hash():
|
|||||||
for root, _, files in walk(d):
|
for root, _, files in walk(d):
|
||||||
for f in files:
|
for f in files:
|
||||||
path = join(root, f)
|
path = join(root, f)
|
||||||
if not any([s in path for s in (".git", ".svn", ".pioenvs")]):
|
if not any(s in path for s in (".git", ".svn", ".pioenvs")):
|
||||||
structure.append(path)
|
structure.append(path)
|
||||||
return sha1(",".join(sorted(structure))).hexdigest() if structure else ""
|
return sha1(",".join(sorted(structure))).hexdigest() if structure else ""
|
||||||
|
@ -36,7 +36,7 @@ def cli(dev):
|
|||||||
# kill all PIO Home servers, they block `pioplus` binary
|
# kill all PIO Home servers, they block `pioplus` binary
|
||||||
shutdown_servers()
|
shutdown_servers()
|
||||||
|
|
||||||
to_develop = dev or not all([c.isdigit() for c in __version__ if c != "."])
|
to_develop = dev or not all(c.isdigit() for c in __version__ if c != ".")
|
||||||
cmds = ([
|
cmds = ([
|
||||||
"pip", "install", "--upgrade",
|
"pip", "install", "--upgrade",
|
||||||
"https://github.com/platformio/platformio-core/archive/develop.zip"
|
"https://github.com/platformio/platformio-core/archive/develop.zip"
|
||||||
@ -69,7 +69,7 @@ def cli(dev):
|
|||||||
if not r:
|
if not r:
|
||||||
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
|
raise exception.UpgradeError("\n".join([str(cmd), str(e)]))
|
||||||
permission_errors = ("permission denied", "not permitted")
|
permission_errors = ("permission denied", "not permitted")
|
||||||
if (any([m in r['err'].lower() for m in permission_errors])
|
if (any(m in r['err'].lower() for m in permission_errors)
|
||||||
and "windows" not in util.get_systype()):
|
and "windows" not in util.get_systype()):
|
||||||
click.secho(
|
click.secho(
|
||||||
"""
|
"""
|
||||||
|
@ -15,7 +15,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
% for file in src_files:
|
% for file in src_files:
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
|
% if any(file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")):
|
||||||
<ClInclude Include="{{file}}">
|
<ClInclude Include="{{file}}">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
% for file in src_files:
|
% for file in src_files:
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
% if any([file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")]):
|
% if any(file.endswith(".%s" % e) for e in ("h", "hh", "hpp", "inc")):
|
||||||
<ClInclude Include="{{file}}">
|
<ClInclude Include="{{file}}">
|
||||||
<Filter>Header Files</Filter>
|
<Filter>Header Files</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -365,7 +365,7 @@ class LibraryManager(BasePkgManager):
|
|||||||
|
|
||||||
for filters in self.normalize_dependencies(manifest['dependencies']):
|
for filters in self.normalize_dependencies(manifest['dependencies']):
|
||||||
assert "name" in filters
|
assert "name" in filters
|
||||||
if any([s in filters.get("version", "") for s in ("\\", "/")]):
|
if any(s in filters.get("version", "") for s in ("\\", "/")):
|
||||||
self.install(
|
self.install(
|
||||||
"{name}={version}".format(**filters),
|
"{name}={version}".format(**filters),
|
||||||
silent=silent,
|
silent=silent,
|
||||||
@ -420,6 +420,6 @@ def get_builtin_libs(storage_names=None):
|
|||||||
@util.memoized
|
@util.memoized
|
||||||
def is_builtin_lib(name):
|
def is_builtin_lib(name):
|
||||||
for storage in get_builtin_libs():
|
for storage in get_builtin_libs():
|
||||||
if any([l.get("name") == name for l in storage['items']]):
|
if any(l.get("name") == name for l in storage['items']):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
Reference in New Issue
Block a user