coco_pipe.report.Section#

class coco_pipe.report.Section(title, icon=None, tags=None, status='OK', code=None, description=None, metadata=None)#

Bases: ContainerElement

A logical section of the report.

Parameters:
  • title (str) – The section title.

  • icon (str, optional) – Short label or SVG markup displayed next to the title.

  • tags (List[str], optional) – Tags for filtering.

  • status (str, optional) – Status string (“OK”, “WARN”, “FAIL”). Default “OK”.

  • code (str, optional) – Source code snippet to reproduce this section.

  • description (str, optional) – Short secondary text shown under the section title.

  • metadata (dict, optional) – Compact key/value facts rendered above the section body, such as method, inputs, or outputs.

Examples

>>> sec = Section("Results", status="OK")
>>> sec.add_element(plotly_element)
>>> rep.add_section(sec)
add_finding(result)#

Add a quality finding and automatically update status.

Parameters:

result (CheckResult)

Return type:

None

add_columns(elements, cols=None, gap='gap-4')#

Add multiple elements side by side in a CSS grid row.

Parameters:
  • elements (list of Element) – Child elements to place in columns.

  • cols (int, optional) – Number of columns. Inferred from len(elements) when omitted.

  • gap (str, optional) – Tailwind gap class. Default "gap-4".

Returns:

The section instance for fluent chaining.

Return type:

Section

render()#

Render the element to HTML.

Return type:

str

add_element(element)#

Add a child element.

Parameters:

element (Element or str) – The element to add. specific strings are converted to HtmlElement.

Returns:

Fluent interface.

Return type:

self

add_markdown(text)#

Add a markdown block.

Parameters:

text (str)

Return type:

ContainerElement

collect_payload(registry)#

Recursively collect payload from children.

Parameters:

registry (dict[str, Any])

Return type:

None

render_children()#

Render all child elements concatenated.

Return type:

str