MCPcopy Index your code
hub / github.com/python/mypy / on_finish

Method on_finish

mypy/report.py:897–922  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

895 self.files.append(file_info)
896
897 def on_finish(self) -> None:
898 if not self.files:
899 # Nothing to do.
900 return
901 output_files = sorted(self.files, key=lambda x: x.module)
902 report_file = os.path.join(self.output_dir, "lineprecision.txt")
903 width = max(4, max(len(info.module) for info in output_files))
904 titles = ("Lines", "Precise", "Imprecise", "Any", "Empty", "Unanalyzed")
905 widths = (width,) + tuple(len(t) for t in titles)
906 fmt = "{:%d} {:%d} {:%d} {:%d} {:%d} {:%d} {:%d}\n" % widths
907 with open(report_file, "w") as f:
908 f.write(fmt.format("Name", *titles))
909 f.write("-" * (width + 51) + "\n")
910 for file_info in output_files:
911 counts = file_info.counts
912 f.write(
913 fmt.format(
914 file_info.module.ljust(width),
915 file_info.total(),
916 counts[stats.TYPE_PRECISE],
917 counts[stats.TYPE_IMPRECISE],
918 counts[stats.TYPE_ANY],
919 counts[stats.TYPE_EMPTY],
920 counts[stats.TYPE_UNANALYZED],
921 )
922 )
923
924
925register_reporter("lineprecision", LinePrecisionReporter)

Callers

nothing calls this directly

Calls 8

sortedFunction · 0.85
maxFunction · 0.85
lenFunction · 0.85
tupleClass · 0.85
totalMethod · 0.80
joinMethod · 0.45
writeMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected