mbdlyb.fqn
Fully Qualified Name (FQN) class for hierarchical element naming.
FQN provides a dot-separated string representation of elements’ positions in hierarchical structures, enabling efficient lookup and navigation.
Classes
Represents a fully qualified name for hierarchical elements. |
Module Contents
- class mbdlyb.fqn.FQN(fqn: str)
Represents a fully qualified name for hierarchical elements.
FQN uses dot-separated components to represent the path through a hierarchy. For example, ‘system.subsystem.component’ represents an element ‘component’ within ‘subsystem’ within ‘system’.
- Variables:
_s (str) – The string representation of the FQN.
_l (Optional[list[str]]) – Cached list of components, lazily computed.
- aslist() list[str]
Get the FQN as a list of components.
- Returns:
List of dot-separated components (cached for efficiency).
- Return type:
list[str]
- element_count() int
Get the number of components in this FQN.
- Returns:
The number of dot-separated components.
- Return type:
int
- classmethod fromlist(l: list[str]) FQN
Create an FQN from a list of components.
- Parameters:
l (list[str]) – List of components to join.
- Returns:
A new FQN with components joined by dots.
- Return type:
- static longest_common_fqn(*fqns: FQN) FQN | None
Find the longest common FQN prefix among multiple FQNs.