RefResolver

Resolve references against one configuration or a whole configurable unit.

The entity index and the list of references are read from the scope once, when the resolver is built, so keep one resolver for a series of lookups, and build a new one after the scope changes.

Member Functions:

entities (read-only)

Every entity of the scope by its absolute path; of a duplicated path, the first one found.

Returns

dict[str, Entity]

duplicate_paths (read-only)

Paths that several instances of one definition hold, sorted.

Entity names share one namespace across every instance of a definition, so each of these is an error in the data, and a reference to one of them is AMBIGUOUS.

Returns

list[str]

is_external

is_external(ref: Ref[Any])

Return True when ref points into a definition outside the scope.

Parameters
Name Type Description

ref

Ref[Any]

Reference to inspect.

Returns

bool

resolve

resolve(ref: Ref[T], *, source: ConfigurationSchema | None = None)

Classify a reference into a structured outcome without raising.

Parameters
Name Type Description

ref

Ref[T]

Reference to resolve.

source

ConfigurationSchema | None

The configuration holding the reference. When given, a target in another pillar of the unit is classified CROSS_PILLAR instead of being resolved.

Returns

RefOutcome[T]

validate

validate()

Check every reference of the scope and return the broken ones.

References into other definitions are skipped; their targets cannot be checked here. For a configurable unit, a reference from one pillar into another is broken. The references are those the scope held when the resolver was built.

Returns

list[BrokenRef]