IndentedChildren#
- class penzai.treescope.foldable_representation.basic_parts.IndentedChildren[source]#
Bases:
RenderableTreePart
A sequence of children, one per line, and indented.
IndentedChildren is the primary way to lay out the content of ordinary containers across multiple lines.
- Variables:
children (Sequence[RenderableTreePart]) – Children to render on separate lines when expanded.
Inherited Attributes
collapsed_width
The length of this rendering if collapsed in one line, in characters.
newlines_in_expanded_parent
The number of newlines in this rendering if in an expanded parent.
tags_in_this_part
Returns a set of "tag" objects contained in this part.
Methods
__init__
(children)build
(children[, comma_separated, ...])Builds a IndentedChildren instance, supporting annotations and delimiters.
foldables_in_this_part
()html_setup_parts
(context)render_to_html
(stream, *[, at_beginning_of_line])render_to_text
(stream, *, expanded_parent, ...)Attributes
collapsed_width
The length of this rendering if collapsed in one line, in characters.
newlines_in_expanded_parent
The number of newlines in this rendering if in an expanded parent.
tags_in_this_part
Returns a set of "tag" objects contained in this part.
children
- classmethod build(children: Sequence[RenderableAndLineAnnotations | RenderableTreePart], comma_separated: bool = False, force_trailing_comma: bool = False) IndentedChildren [source]#
Builds a IndentedChildren instance, supporting annotations and delimiters.
This method stacks the children together, optionally inserting delimiters, and moving any comments to the end of their lines.
- Parameters:
children – Children to render.
comma_separated – Whether to automatically insert commas between children. If False, delimiters can be manually inserted into
children
first instead.force_trailing_comma – Whether to render a trailing comma in collapsed mode.
- Returns:
New IndentedChildren instance.