RelationshipBody

class RelationshipBody

Container for relationship bodies. Works similarly to ChildrenNodes except relationships are not needed and all elements are taken ownership off.

TODO: add insert and replace methods.

%3 RelationshipBody RelationshipBody syside.RelationshipBody ContainerView ContainerView syside.ContainerView ContainerView->RelationshipBody
Members defined in RelationshipBody (7 members)

append

Append an owned related element. Returns newly constructed related element.

append_annotation

Append an owned annotation to an annotating element. Returns a pair of newly constructed (annotation, annotating element).

clear

Removes and releases all elements in this container. Afterwards, len is 0.

extract

Extracts a related element at the specified index from the model tree and returns it.

extract_element

Extracts a related element from the model tree.

pop

Removes a related element at the specified index from the model tree and returns it.

remove_element

Removes a related element from the model tree. Returns True if the element was removed, otherwise False.

Members inherited from ContainerView (11 members)

__bool__

__contains__

__getitem__

__iter__

__len__

__reversed__

__str__

at

count

empty

index

Methods

append(element: type[syside.TElement]) syside.TElement

Append an owned related element. Returns newly constructed related element.

append(element: syside.TElement) syside.TElement

Append an owned existing related element. Returns the same related element.

append_annotation(element: type[syside.RelationshipBody.append_annotation.M]) tuple[syside.Annotation, syside.RelationshipBody.append_annotation.M]

Append an owned annotation to an annotating element. Returns a pair of newly constructed (annotation, annotating element).

append_annotation(element: syside.RelationshipBody.append_annotation.M) tuple[syside.Annotation, syside.RelationshipBody.append_annotation.M]

Append an owned annotation to an existing annotating element. Returns a pair of (annotation, annotating element) where only the annotation is newly constructed.

clear() None

Removes and releases all elements in this container. Afterwards, len is 0.

extract(index: int = -1) syside.Element

Extracts a related element at the specified index from the model tree and returns it.

Note that it is up to the user to ensure that the returned orphan element is not leaked.

Raises IndexError if index is out of bounds.

extract_element(arg: syside.RelationshipBody.extract_element.T, /) syside.RelationshipBody.extract_element.T

Extracts a related element from the model tree.

Note that it is up to the user to ensure that the returned orphan element is not leaked.

Raises ValueError if there is no such element.

pop(index: int = -1) syside.Element

Removes a related element at the specified index from the model tree and returns it.

remove_element(arg: syside.Element, /) bool

Removes a related element from the model tree. Returns True if the element was removed, otherwise False.

Used in