MCPcopy Create free account
hub / github.com/python/mypy / on_file

Method on_file

mypy/report.py:866–895  ·  view source on GitHub ↗
(
        self,
        tree: MypyFile,
        modules: dict[str, MypyFile],
        type_map: dict[Expression, Type],
        options: Options,
    )

Source from the content-addressed store, hash-verified

864 self.files: list[FileInfo] = []
865
866 def on_file(
867 self,
868 tree: MypyFile,
869 modules: dict[str, MypyFile],
870 type_map: dict[Expression, Type],
871 options: Options,
872 ) -> None:
873 try:
874 path = os.path.relpath(tree.path)
875 except ValueError:
876 return
877
878 if should_skip_path(path):
879 return
880
881 visitor = stats.StatisticsVisitor(
882 inferred=True,
883 filename=tree.fullname,
884 modules=modules,
885 typemap=type_map,
886 all_nodes=True,
887 )
888 tree.accept(visitor)
889
890 file_info = FileInfo(path, tree._fullname)
891 for lineno, _ in iterate_python_lines(path):
892 status = visitor.line_map.get(lineno, stats.TYPE_EMPTY)
893 file_info.counts[status] += 1
894
895 self.files.append(file_info)
896
897 def on_finish(self) -> None:
898 if not self.files:

Callers

nothing calls this directly

Calls 6

should_skip_pathFunction · 0.85
FileInfoClass · 0.85
iterate_python_linesFunction · 0.85
appendMethod · 0.80
acceptMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected