(self, filename: str)
| 1894 | self.config = json.load(r) |
| 1895 | |
| 1896 | def index_file(self, filename: str): |
| 1897 | with open(filename) as r: |
| 1898 | code = "".join(r.readlines()) |
| 1899 | |
| 1900 | from pathlib import Path |
| 1901 | |
| 1902 | paths = {} |
| 1903 | visitor = IndexPythonClassesVisitor( |
| 1904 | self.classes, paths, self.config.get("known method verbs", {}) if self.check_verbs else None |
| 1905 | ) |
| 1906 | visitor.package("github") |
| 1907 | visitor.module(Path(filename.removesuffix(".py")).name) |
| 1908 | visitor.filename(filename) |
| 1909 | visitor.test_filename(str(self.tests_path / Path(filename).name)) |
| 1910 | try: |
| 1911 | tree = cst.parse_module(code) |
| 1912 | tree.visit(visitor) |
| 1913 | # return path dict populated by this worker through 'paths' argument |
| 1914 | self.paths.append(paths) |
| 1915 | except Exception as e: |
| 1916 | raise RuntimeError(f"Failed to parse {filename}", e) |
| 1917 | |
| 1918 | |
| 1919 | class HandleNewSchemas(Enum): |
nothing calls this directly
no test coverage detected