NameIndex

class NameIndex

Description

Elements by name, built once by build_name_index().

Given a model that declares part def Car; and part car : Car; in package P:

index = build_name_index(model)
index.by_qualified_name["P::Car"]  # P::Car
index.by_simple_name["car"]        # [P::car]
  • by_qualified_name maps a qualified name to the first element in scan order that has it. Elements share a qualified name only when several documents declare a root package of the same name; the members of each keep their own qualified names and are all indexed. Alias memberships are left out, so an alias name is not a key; get_by_path() follows aliases.

  • by_simple_name maps a simple name to every element that has it, in scan order, memberships included.

Inheritance:

Members defined in NameIndex (5 members)

by_qualified_name

RW

by_simple_name

RW

library_elements

RW

The deprecated library_elements the index was built with, else None.

qualified_name_claimants

RW

Derived from the scan and left out of equality. Every element rendering each qualified name, in scan order; empty for a deprecated library_elements build and for a hand-built index, whose lookups read by_qualified_name. by_qualified_name keeps only the first, which a lookup that excludes library elements cannot use: the first claimant may be a library element shadowing a namesake that is not.

tiers

RW

The tiers the index was built over; None when it was built over the model’s own documents (the default build, a deprecated library_elements build, or a hand-built index).

Attributes

by_qualified_name: dict[str, syside.Element] = None
by_simple_name: dict[str, list[syside.Element]] = None
library_elements: syside.query.LibraryElements | None = None

The deprecated library_elements the index was built with, else None.

qualified_name_claimants: dict[str, list[syside.Element]] = 'field(...)'

Derived from the scan and left out of equality. Every element rendering each qualified name, in scan order; empty for a deprecated library_elements build and for a hand-built index, whose lookups read by_qualified_name. by_qualified_name keeps only the first, which a lookup that excludes library elements cannot use: the first claimant may be a library element shadowing a namesake that is not.

tiers: frozenset[syside.DocumentTier] | None = None

The tiers the index was built over; None when it was built over the model’s own documents (the default build, a deprecated library_elements build, or a hand-built index).

Used by