Files
sentinel/tools/mypy_helpers/find_easiest_modules.py
2024-02-15 17:01:50 +00:00

29 lines
718 B
Python

from __future__ import annotations
import collections
import subprocess
import sys
def main() -> int:
out = subprocess.run(
(sys.executable, "-m", "tools.mypy_helpers.mypy_without_ignores", *sys.argv[1:]),
capture_output=True,
)
counts: collections.Counter[str] = collections.Counter()
for line in out.stdout.decode().splitlines():
filename, _, _ = line.partition(":")
if filename.endswith(".py"):
counts[filename] += 1
vals = [(count, fname) for fname, count in counts.most_common()]
vals.sort(reverse=True)
for count, fname in vals:
print(f"{count}\t{fname}")
return 0
if __name__ == "__main__":
raise SystemExit(main())