Heritage
- class Heritage
An accessor for type specializations and conjugations
Members defined in
Heritage(7 members)
A depth-first recursive tree iterator to all (in)direct heritage relationships.
Append a new owned or referenced element, inferred from the relationship type and this container. Returns a pair of (relationship, element), only the relationship is newly constructed.
Append a relationship with an owned chaining. Raises
TypeErrorif the relationship type cannot have owned chaining in the textual syntax.
Insert a relationship and a related element at the specified index. The related element may be owned or referenced depending on the relationship type and this container, see
appendfor more details.
Insert a relationship with an owned chaining at the specified index. Raises
TypeErrorif the relationship type cannot have owned chaining in the textual syntax.
Replace the relationship and its related element at the specified index. The relationship may be reused if its type matches the current relationship at that index. The related element may be owned or referenced depending on the relationship type and this container, see
appendfor more details.
Replace the relationship and its related element at the specified index with an owned chaining. The relationship may be reused if its type matches the current relationship at that index. Raises
TypeErrorif the relationship type cannot have owned chaining in the textual syntax.Members inherited from
ChainedChildrenNodes(0 members)Members inherited from
ChildrenNodes(8 members)
Clear all nodes from this container. Size is reset to 0 afterwards.
Extracts and returns the element from this container at the specified index without clearing its subtree. The relationship may be reused internally when constructing a new relationship of the same type, while the related element will not.
Extracts a related element from this container without clearing its subtree.
Removes a relationship and extracts its related element from this container without clearing its subtree.
Removes and returns a pair (relationship, element) from this container at the specified index. The relationship may be reused internally when constructing a new relationship of the same type, while the related element will only be reused if it was and owned related element. In this case, the related element may be assigned to a new owner in the same document. Note that removed owned related elements will have all the elements in the subtree removed as well.
Removes a related element from this container. Returns
Trueif the related element was removed, andFalseotherwise. Note that removed owned related elements will have all the elements in the subtree removed as well.
Removes a relationship and its related element from this container. Returns
Trueif the relationship was removed, andFalseotherwise. Note that removed owned related elements will have all the elements in the subtree removed as well.
Increase the capacity of the container. Size is not changed.
Members inherited from
ChildrenNodesView(6 members)
RThe related elements in this container.
RThe relationships in this container.
Get tuple of
(relationship, element)atindex. Methods
- all(include_implicit: bool = True, unwrap_chaining: bool = True, unique: bool = True) syside.HeritageStream
A depth-first recursive tree iterator to all (in)direct heritage relationships.
Traversal has options:
include_implicit- whether to include implicitly constructed relationships in the traversal. This isTruefor name and inherited member resolution but can be used to quickly discard entire swaths of implicit standard library types and their members. This will also affect other implicit specializations, such as those toendfeatures and parameters.unwrap_chaining- whether to unwrap feature chain targets, i.e.Feature.feature_target. This is what is used internally for name and inherited member resolution.unique- whether to prune already visited supertypes (not relationships). Note that cycles are explicitly permitted by the specification thus this will likely require manualiterator.prune()calls orbreaksto avoid infinite loops.
Note that this does not include the root
Typeitself.
- append(relationship: type[syside.Heritage.append.R], element: syside.Heritage.append.M, name: syside.NameID = ...) tuple[syside.Heritage.append.R, syside.Heritage.append.M]
Append a new owned or referenced element, inferred from the relationship type and this container. Returns a pair of (relationship, element), only the relationship is newly constructed.
- append_chain(relationship: type[syside.Heritage.append_chain.R], features: Sequence[syside.Feature]) tuple[syside.Heritage.append_chain.R, syside.Feature]
Append a relationship with an owned chaining. Raises
TypeErrorif the relationship type cannot have owned chaining in the textual syntax.
- insert(index: int, relationship: type[syside.Heritage.insert.R], element: syside.Heritage.insert.M, name: syside.NameID = ...) tuple[syside.Heritage.insert.R, syside.Heritage.insert.M]
Insert a relationship and a related element at the specified index. The related element may be owned or referenced depending on the relationship type and this container, see
appendfor more details.
- insert_chain(index: int, relationship: type[syside.Heritage.insert_chain.R], features: Sequence[syside.Feature]) tuple[syside.Heritage.insert_chain.R, syside.Feature]
Insert a relationship with an owned chaining at the specified index. Raises
TypeErrorif the relationship type cannot have owned chaining in the textual syntax.
- replace(index: int, relationship: type[syside.Heritage.replace.R], element: syside.Heritage.replace.M, name: syside.NameID = ...) tuple[syside.Heritage.replace.R, syside.Heritage.replace.M]
Replace the relationship and its related element at the specified index. The relationship may be reused if its type matches the current relationship at that index. The related element may be owned or referenced depending on the relationship type and this container, see
appendfor more details.
- replace_chain_at(index: int, relationship: type[syside.Heritage.replace_chain_at.R], features: Sequence[syside.Feature]) tuple[syside.Heritage.replace_chain_at.R, syside.Feature]
Replace the relationship and its related element at the specified index with an owned chaining. The relationship may be reused if its type matches the current relationship at that index. Raises
TypeErrorif the relationship type cannot have owned chaining in the textual syntax.