MCPcopy
hub / github.com/PyGithub/PyGithub / index_file

Method index_file

scripts/openapi.py:1896–1916  ·  view source on GitHub ↗
(self, filename: str)

Source from the content-addressed store, hash-verified

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
1919class HandleNewSchemas(Enum):

Callers

nothing calls this directly

Calls 7

packageMethod · 0.95
moduleMethod · 0.95
filenameMethod · 0.95
test_filenameMethod · 0.95
PathClass · 0.85
getMethod · 0.80

Tested by

no test coverage detected