Extract class docstrings and method arguments :param submodule_name: Submodule from which to extract the class :param cls_name: Class from which to extract the docstring and method arguments :param method_name: Class Method name from which to extract arguments :param boilerplate_arg
(
submodule_name: str, cls_name: str, method_name: str = "__init__", boilerplate_args: Optional[Sequence[str]] = None
)
| 151 | |
| 152 | |
| 153 | def extract_docs( |
| 154 | submodule_name: str, cls_name: str, method_name: str = "__init__", boilerplate_args: Optional[Sequence[str]] = None |
| 155 | ) -> Union["PatcherDoc", None]: |
| 156 | """Extract class docstrings and method arguments |
| 157 | |
| 158 | :param submodule_name: Submodule from which to extract the class |
| 159 | :param cls_name: Class from which to extract the docstring and method arguments |
| 160 | :param method_name: Class Method name from which to extract arguments |
| 161 | :param boilerplate_args: String iterable containing arguments that shall not be parsed |
| 162 | """ |
| 163 | spec = importlib.util.spec_from_file_location( |
| 164 | submodule_name, f"{os.path.dirname(inspect.getabsfile(inspect.currentframe()))}/recipes/{submodule_name}.py" |
| 165 | ) |
| 166 | submodule = importlib.util.module_from_spec(spec) |
| 167 | try: |
| 168 | spec.loader.exec_module(submodule) |
| 169 | try: |
| 170 | return _extract_docs(getattr(submodule, cls_name), method_name, boilerplate_args) |
| 171 | except AttributeError as e: |
| 172 | print(e) |
| 173 | except ModuleNotFoundError as e: |
| 174 | print(f"Error : IFCPatch {str(submodule)} could not load because : {str(e)}") |
| 175 | |
| 176 | |
| 177 | class PatcherDoc(TypedDict): |
nothing calls this directly
no test coverage detected