stubber.codemod.enrich

Enrich firmware stubs by copying docstrings and parameter information from doc-stubs or python source code. Both (.py or .pyi) files are supported.

Module Contents

Functions

enrich_file(→ Optional[str])

Enrich a firmware stubs using the doc-stubs in another folder.

enrich_folder(→ int)

Enrich a folder with containing firmware stubs using the doc-stubs in another folder.

stubber.codemod.enrich.enrich_file(target_path: pathlib.Path, docstub_path: pathlib.Path, diff: bool = False, write_back: bool = False, package_name='') str | None

Enrich a firmware stubs using the doc-stubs in another folder. Both (.py or .pyi) files are supported.

Parameters:
  • source_path – the path to the firmware stub to enrich

  • docstub_path (pathlib.Path) – the path to the folder containing the doc-stubs

  • diff (bool) – if True, return the diff between the original and the enriched source file

  • write_back (bool) – if True, write the enriched source file back to the source_path

  • target_path (pathlib.Path) –

Return type:

Optional[str]

Returns: - None or a string containing the diff between the original and the enriched source file

stubber.codemod.enrich.enrich_folder(source_path: pathlib.Path, docstub_path: pathlib.Path, show_diff: bool = False, write_back: bool = False, require_docstub: bool = False, package_name: str = '') int

Enrich a folder with containing firmware stubs using the doc-stubs in another folder.

Returns the number of files enriched.

Parameters:
Return type:

int