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=())
| 61 | |
| 62 | |
| 63 | def 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 | |
| 85 | def get_jupyter_code(path, get_bash, which_cells: list[int] | None = None) -> str: |
no test coverage detected