()
| 69 | |
| 70 | |
| 71 | def main() -> None: |
| 72 | filename, start_line_str, start_col_str, end_line_str, end_col_str, *mypy_and_args = sys.argv[ |
| 73 | 1: |
| 74 | ] |
| 75 | start_line = int(start_line_str) |
| 76 | start_col = int(start_col_str) |
| 77 | end_line = int(end_line_str) |
| 78 | end_col = int(end_col_str) |
| 79 | with open(filename) as f: |
| 80 | lines = f.readlines() |
| 81 | lines[end_line - 1] = update_line( |
| 82 | lines[end_line - 1], REVEAL_TYPE_END, end_col |
| 83 | ) # insert after end_col |
| 84 | lines[start_line - 1] = update_line(lines[start_line - 1], REVEAL_TYPE_START, start_col) |
| 85 | with tempfile.NamedTemporaryFile(mode="w", prefix="mypy") as tmp_f: |
| 86 | tmp_f.writelines(lines) |
| 87 | tmp_f.flush() |
| 88 | |
| 89 | output = run_mypy(mypy_and_args, filename, tmp_f.name) |
| 90 | revealed_type, error = process_output(output, filename, start_line) |
| 91 | if revealed_type: |
| 92 | print(revealed_type) |
| 93 | if error: |
| 94 | print(output) |
| 95 | exit(int(error)) |
| 96 | |
| 97 | |
| 98 | if __name__ == "__main__": |
no test coverage detected
searching dependent graphs…