Skip to content

context

Builds and manages the rendering context.

Classes

Functions

build_context

build_context(
    composition: Composition,
    ui: Callable,
    initial_context: Optional[dict] = None,
) -> dict

Build the context for the composition.

  • set running_context to starting_context (the default from project forge)
  • render composition’s extra_context using running_context
  • update running_context with composition’s extra_context
  • for each overlay - process_overlay - update running_context with the result of process_overlay
PARAMETER DESCRIPTION
composition

The composition configuration.

TYPE: Composition

ui

A callable that takes question information and returns the result from the user interface.

TYPE: Callable

initial_context

The initial context to add to the context.

TYPE: Optional[dict] DEFAULT: None

RETURNS DESCRIPTION
dict

A dictionary

get_starting_context

get_starting_context() -> dict

The starting context for all configurations.

update_context

update_context(
    merge_keys: Mapping[str, MergeMethods],
    left: dict,
    right: dict,
) -> dict

Return a dict where the left is updated with the right according to the composition rules.