expand_to_depth

expand_to_depth#

penzai.treescope.foldable_representation.layout_algorithms.expand_to_depth(tree: RenderableTreePart, depth: int) None[source]#

Expands a tree up to a given depth.

This function ignores the existing expand state, and instead rewrites it to expand up to the given depth.

Parameters:
  • tree – Tree to expand.

  • depth – Depth to expand to. At depth 0, all foldables will be collapsed.