def generate_function_doc()

in src/kernels/doc.py [0:0]


def generate_function_doc(kernel_module: ModuleType, kernel_name: str) -> None:
    print("\n## Functions")

    # Track if we found any functions
    found_functions = False

    for name, func in inspect.getmembers(kernel_module, inspect.isfunction):
        # Do not include imported functions.
        if func.__module__ != kernel_module.__name__:
            continue

        # Exclude private functions.
        if name.startswith("_"):
            continue

        found_functions = True

        try:
            sig = inspect.signature(func)
            docstring = _get_docstring(func)
        except ValueError:
            print(
                f"Warning: Could not retrieve signature for {name} in {kernel_module.__name__}",
                file=sys.stderr,
            )
            continue

        print(f"\n### Function `{name}`")
        print(f"\n`{sig}`")

        _process_and_print_docstring(
            docstring, kernel_name=kernel_name, context_name=name, header_level=3
        )

    if not found_functions:
        print("\nNo public top-level functions.")