handle_via_global_registry

handle_via_global_registry#

treescope.handlers.handle_via_global_registry(node: Any, path: str | None, subtree_renderer: renderers.TreescopeSubtreeRenderer)[source]#

Renders a type by looking it up in the global handler registry.

If it is not feasible to define __treescope_repr__ for a type, it can instead be registered in the global handler registry. This is a dictionary mapping types to functions that render a node of that type.

The exact structure of the intermediate representation is an implementation detail and may change in future releases. Users should instead build a rendering using the high-level helpers in treescope.repr_lib, or the lower-level definitions in treescope.rendering_parts.

Parameters:
  • node – The node to render.

  • path – An optional path to this node from the root.

  • subtree_renderer – The renderer for sutrees of this node.

Returns:

A rendering of this node, if it was found in the global registry.