Python: Replace more lists with generators (#23116)

* Replace lists with generators v2

* Replace set with {}

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>

* Replace more set() with {}

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 6951b3271d
This commit is contained in:
grekiki
2021-12-04 07:57:19 +01:00
committed by GitHub
parent 21bad1adc6
commit 9e4cc1f7ff
17 changed files with 23 additions and 23 deletions
+1 -1
View File
@@ -4,7 +4,7 @@ import ast
import stat
import subprocess
fouts = set([x.decode('utf-8') for x in subprocess.check_output(['git', 'ls-files']).strip().split()])
fouts = {x.decode('utf-8') for x in subprocess.check_output(['git', 'ls-files']).strip().split()}
pyf = []
for d in ["cereal", "common", "scripts", "selfdrive", "tools"]:
+1 -1
View File
@@ -10,6 +10,6 @@ with open(os.path.join(BASEDIR, "docs/CARS.md")) as f:
cars = [l for l in lines if l.strip().startswith("|") and l.strip().endswith("|") and
"Make" not in l and any(c.isalpha() for c in l)]
make_count = Counter([l.split('|')[1].split('|')[0].strip() for l in cars])
make_count = Counter(l.split('|')[1].split('|')[0].strip() for l in cars)
print("\n", "*"*20, len(cars), "total", "*"*20, "\n")
pprint(make_count)