replace list comprehensions with generators (#23037)

pull/23041/head
grekiki 4 years ago committed by GitHub
parent adaffb3355
commit 68c1a666a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      selfdrive/debug/cpu_usage_stat.py
  2. 2
      selfdrive/manager/build.py

@ -66,7 +66,7 @@ if __name__ == "__main__":
for p in psutil.process_iter(): for p in psutil.process_iter():
if p == psutil.Process(): if p == psutil.Process():
continue continue
matched = any([l for l in p.cmdline() if any([pn for pn in monitored_proc_names if re.match(r'.*{}.*'.format(pn), l, re.M | re.I)])]) matched = any(l for l in p.cmdline() if any([pn for pn in monitored_proc_names if re.match(r'.*{}.*'.format(pn), l, re.M | re.I)]))
if matched: if matched:
k = ' '.join(p.cmdline()) k = ' '.join(p.cmdline())
print('Add monitored proc:', k) print('Add monitored proc:', k)

@ -69,7 +69,7 @@ def build(spinner, dirty=False):
else: else:
# Build failed log errors # Build failed log errors
errors = [line.decode('utf8', 'replace') for line in compile_output errors = [line.decode('utf8', 'replace') for line in compile_output
if any([err in line for err in [b'error: ', b'not found, needed by target']])] if any(err in line for err in [b'error: ', b'not found, needed by target'])]
error_s = "\n".join(errors) error_s = "\n".join(errors)
add_file_handler(cloudlog) add_file_handler(cloudlog)
cloudlog.error("scons build failed\n" + error_s) cloudlog.error("scons build failed\n" + error_s)

Loading…
Cancel
Save