(cls)
| 398 | ### Methods for retrieving signatures from pyi stub files |
| 399 | |
| 400 | def 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 |
no test coverage detected
searching dependent graphs…