trilium_alchemy.core.note.branches

Class index

Canonical

Branches

Interface to a note’s parent and child branches.

ParentBranches

Interface to a note’s parent branches.

ChildBranches

Interface to a note’s child branches.

ParentNotes

Interface to a note’s parent notes.

ChildNotes

Interface to a note’s child notes.

Symbols

class trilium_alchemy.core.note.branches.Branches(note)

Bases:

trilium_alchemy.core.note.extension.NoteExtension
trilium_alchemy.core.note.branches.BranchLookupMixin

Interface to a note’s parent and child branches.

This object is stateless; Note.branches.parents and Note.branches.children are the sources of truth for parent and child branches respectively.

property parents: ParentBranches

Getter/setter for parent branches, modeled as a set.

property children: ChildBranches

Getter/setter for child branches, modeled as a list.

lookup_branch(note: Note) Branch | None

Inherited from: trilium_alchemy.core.note.branches.BranchLookupMixin

Lookup a branch given a related Note, either parent or child.

class trilium_alchemy.core.note.branches.ParentBranches(entity: BaseEntity)

Bases:

trilium_alchemy.core.note.extension.BaseEntitySet
trilium_alchemy.core.note.branches.BranchLookupMixin

Interface to a note’s parent branches.

add(value: EntityT)

Inherited from: trilium_alchemy.core.note.extension.BaseEntitySet

Add an element.

discard(value: EntityT)

Inherited from: trilium_alchemy.core.note.extension.BaseEntitySet

Remove an element. Do not raise an exception if absent.

remove(value)

Inherited from: collections.abc.MutableSet

Remove an element. If not a member, raise a KeyError.

pop()

Inherited from: collections.abc.MutableSet

Return the popped value. Raise KeyError if empty.

clear()

Inherited from: collections.abc.MutableSet

This is slow (creates N new iterators!) but effective.

isdisjoint(other)

Inherited from: collections.abc.Set

Return True if two sets have a null intersection.

lookup_branch(note: Note) Branch | None

Inherited from: trilium_alchemy.core.note.branches.BranchLookupMixin

Lookup a branch given a related Note, either parent or child.

class trilium_alchemy.core.note.branches.ChildBranches(entity: BaseEntity)

Bases:

trilium_alchemy.core.note.extension.BaseEntityList
trilium_alchemy.core.note.branches.BranchLookupMixin

Interface to a note’s child branches.

insert(i: int, value: EntityT)

Inherited from: trilium_alchemy.core.note.extension.BaseEntityList

S.insert(index, value) – insert value before index

append(value)

Inherited from: collections.abc.MutableSequence

S.append(value) – append value to the end of the sequence

clear()

Inherited from: collections.abc.MutableSequence

S.clear() -> None – remove all items from S

reverse()

Inherited from: collections.abc.MutableSequence

S.reverse() – reverse IN PLACE

extend(values)

Inherited from: collections.abc.MutableSequence

S.extend(iterable) – extend sequence by appending elements from the iterable

pop(index=-1)

Inherited from: collections.abc.MutableSequence

S.pop([index]) -> item – remove and return item at index (default last). Raise IndexError if list is empty or index is out of range.

remove(value)

Inherited from: collections.abc.MutableSequence

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

index(value, start=0, stop=None)

Inherited from: collections.abc.Sequence

S.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

count(value)

Inherited from: collections.abc.Sequence

S.count(value) -> integer – return number of occurrences of value

lookup_branch(note: Note) Branch | None

Inherited from: trilium_alchemy.core.note.branches.BranchLookupMixin

Lookup a branch given a related Note, either parent or child.

class trilium_alchemy.core.note.branches.ParentNotes(entity: BaseEntity)

Bases:

trilium_alchemy.core.note.extension.NoteExtension
collections.abc.MutableSet
trilium_alchemy.core.note.branches.NoteLookupMixin

Interface to a note’s parent notes.

This object is stateless; Note.branches.parents is the source of truth for parent branches.

add(value: Note)

Add an element.

discard(value: Note)

Remove an element. Do not raise an exception if absent.

remove(value)

Inherited from: collections.abc.MutableSet

Remove an element. If not a member, raise a KeyError.

pop()

Inherited from: collections.abc.MutableSet

Return the popped value. Raise KeyError if empty.

clear()

Inherited from: collections.abc.MutableSet

This is slow (creates N new iterators!) but effective.

isdisjoint(other)

Inherited from: collections.abc.Set

Return True if two sets have a null intersection.

lookup_note(title: str) Note | None

Inherited from: trilium_alchemy.core.note.branches.NoteLookupMixin

Lookup a parent or child note given a title, or None if no such note exists.

class trilium_alchemy.core.note.branches.ChildNotes(entity: BaseEntity)

Bases:

trilium_alchemy.core.note.extension.NoteExtension
collections.abc.MutableSequence
trilium_alchemy.core.note.branches.NoteLookupMixin

Interface to a note’s child notes.

This object is stateless; Note.branches.children is the source of truth for child branches.

insert(i: int, val: Note)

S.insert(index, value) – insert value before index

append(value)

Inherited from: collections.abc.MutableSequence

S.append(value) – append value to the end of the sequence

clear()

Inherited from: collections.abc.MutableSequence

S.clear() -> None – remove all items from S

reverse()

Inherited from: collections.abc.MutableSequence

S.reverse() – reverse IN PLACE

extend(values)

Inherited from: collections.abc.MutableSequence

S.extend(iterable) – extend sequence by appending elements from the iterable

pop(index=-1)

Inherited from: collections.abc.MutableSequence

S.pop([index]) -> item – remove and return item at index (default last). Raise IndexError if list is empty or index is out of range.

remove(value)

Inherited from: collections.abc.MutableSequence

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

index(value, start=0, stop=None)

Inherited from: collections.abc.Sequence

S.index(value, [start, [stop]]) -> integer – return first index of value. Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

count(value)

Inherited from: collections.abc.Sequence

S.count(value) -> integer – return number of occurrences of value

lookup_note(title: str) Note | None

Inherited from: trilium_alchemy.core.note.branches.NoteLookupMixin

Lookup a parent or child note given a title, or None if no such note exists.