MCPcopy Create free account
hub / github.com/pytorch/executorch / get_class_docstring

Function get_class_docstring

backends/arm/scripts/docgen/docgen.py:63–82  ·  view source on GitHub ↗

Returns a class signature and docstring, as well as documentation for all its public methods with names not matching strings listed in filter_funcs.

(cls, filter_funcs=())

Source from the content-addressed store, hash-verified

61
62
63def get_class_docstring(cls, filter_funcs=()) -> str:
64 """Returns a class signature and docstring, as well as documentation for all
65 its public methods with names not matching strings listed in
66 filter_funcs.
67 """
68 header = f"```python\nclass {cls.__name__}{inspect.signature(cls)}\n```\n{get_docstring(cls)}\n\n"
69
70 class_functions = [
71 getattr(cls, name)
72 for name in dir(cls)
73 if callable(getattr(cls, name))
74 and not name.startswith("_")
75 and not any(f in name for f in filter_funcs)
76 ]
77
78 function_docstrings = [
79 get_function_docstring(cls, func) for func in class_functions
80 ]
81
82 return header + "".join(function_docstrings)
83
84
85def get_jupyter_code(path, get_bash, which_cells: list[int] | None = None) -> str:

Callers 2

generate_ethos_u_docsFunction · 0.85
generate_vgf_docsFunction · 0.85

Calls 2

get_docstringFunction · 0.85
get_function_docstringFunction · 0.85

Tested by

no test coverage detected