rebuild_qmd.parse_formatted_blocks

convert.rebuild_qmd.parse_formatted_blocks(py_lines)

Parse formatter output into per-block Python snippets.

The formatted Python file consists of one or more blocks separated by marker lines of the form f"{FORMAT_SEPARATOR_PREFIX}{index}", where index is an integer block index. Each separator starts a new block; all following lines up to the next separator (or end of file) belong to that block. Trailing blank lines within each block are stripped.

Parameters

Name Type Description Default
py_lines list[str] Lines read from the temporary formatted Python file. required

Returns

Name Type Description
blocks dict[int, list[str]] Mapping from block index to the list of formatted Python source lines for that block (without trailing blank lines).