(
path: str, tree: MypyFile, ir: ModuleIR, type_map: dict[Expression, Type], mapper: Mapper
)
| 164 | |
| 165 | |
| 166 | def generate_annotations( |
| 167 | path: str, tree: MypyFile, ir: ModuleIR, type_map: dict[Expression, Type], mapper: Mapper |
| 168 | ) -> AnnotatedSource: |
| 169 | anns = {} |
| 170 | for func_ir in ir.functions: |
| 171 | anns.update(function_annotations(func_ir, tree)) |
| 172 | visitor = ASTAnnotateVisitor(type_map, mapper) |
| 173 | for defn in tree.defs: |
| 174 | defn.accept(visitor) |
| 175 | anns.update(visitor.anns) |
| 176 | for line in visitor.ignored_lines: |
| 177 | if line in anns: |
| 178 | del anns[line] |
| 179 | return AnnotatedSource(path, anns) |
| 180 | |
| 181 | |
| 182 | def function_annotations(func_ir: FuncIR, tree: MypyFile) -> dict[int, list[Annotation]]: |
searching dependent graphs…