INNER CODE UNIT · Python

render_entries

lean-dojo/TorchLean · scripts/generate_unicode_table.py:103

def render_entries(entries: list[str]) -> str:
    """Render list entries, packing as many per line as fit."""
    lines: list[str] = []
    current = "  "
    for index, entry in enumerate(entries):
        piece = entry + ("," if index + 1 < len(entries) else "")
        candidate = current + (" " if current.strip() else "") + piece
        if len(candidate) > LINE_WIDTH:
            lines.append(current)
            current = "  " + piece
        else:
            current = candidate
    lines.append(current)
    return "\n".join(lines)


def render_table(intervals: list[tuple[int, int, int]]) -> str:
    """Render the interval table as a few list literals joined into one array.

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…