MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / get_ast_tree

Function get_ast_tree

tools/boilerplate.py:400–408  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

398### Methods for retrieving signatures from pyi stub files
399
400def get_ast_tree(cls):
401 path = Path(inspect.getfile(cls))
402 stubpath = path.with_suffix(".pyi")
403 path = stubpath if stubpath.exists() else path
404 tree = ast.parse(path.read_text())
405 for item in tree.body:
406 if isinstance(item, ast.ClassDef) and item.name == cls.__name__:
407 return item
408 raise ValueError(f"Cannot find {cls.__name__} in ast")
409
410
411@functools.lru_cache

Callers 1

get_ast_mro_treesFunction · 0.85

Calls 2

PathClass · 0.85
parseMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…