trilium_alchemy.core.note.branches
#
Class index#
Canonical
Interface to a note’s parent and child branches. |
|
Interface to a note’s parent branches. Modeled as a |
|
Interface to a note’s child branches. Modeled as a |
|
Interface to a note’s parent notes. When adding a parent,
is an alias of |
|
Interface to a note’s child notes. For adding a child,
is an alias of |
Symbols#
- class trilium_alchemy.core.note.branches.Branches(note)#
Bases:
trilium_alchemy.core.note.extension.NoteExtension
trilium_alchemy.core.note.branches.BranchLookup
Interface to a note’s parent and child branches.
Access as
Note.branches
, a descriptor mapping to an instance of this class.When iterated, yields from parent branches (sorted by
id()
) and then child branches.# add root as parent of note note ^= session.root # create child note note += Note() # iterate over branches for branch in note.branches: print(branch)
Branch(parent=Note(title=root, note_id=root), child=Note(title=new note, note_id=None), prefix=, expanded=False, position=1000000009, branch_id=None) Branch(parent=Note(title=new note, note_id=None), child=Note(title=new note, note_id=None), prefix=, expanded=False, position=10, branch_id=None)
This object is stateless;
Note.branches.parents
andNote.branches.children
are the sources of truth for parent and child branches respectively.- parents: ParentBranches#
- children: ChildBranches#
- class trilium_alchemy.core.note.branches.ParentBranches(entity: Entity)#
Bases:
trilium_alchemy.core.note.extension.Set
trilium_alchemy.core.note.branches.BranchLookup
Interface to a note’s parent branches. Modeled as a
set
as parent branches are not inherently ordered, but serialized byid()
when iterated.Access as
Note.branches.parents
, a descriptor mapping to an instance of this class.When a
Note
is added, a parentBranch
is automatically created.- discard(value: Any)#
Inherited from:
trilium_alchemy.core.note.extension.Set
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.
- class trilium_alchemy.core.note.branches.ChildBranches(entity: Entity)#
Bases:
trilium_alchemy.core.note.extension.List
trilium_alchemy.core.note.branches.BranchLookup
Interface to a note’s child branches. Modeled as a
list
.Access as
Note.branches.children
, a descriptor mapping to an instance of this class.When a
Note
is added, a childBranch
is automatically created.- insert(i: int, value: Any)#
Inherited from:
trilium_alchemy.core.note.extension.List
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
- class trilium_alchemy.core.note.branches.Parents(entity: Entity)#
Bases:
trilium_alchemy.core.note.extension.NoteExtension
collections.abc.MutableSet
Interface to a note’s parent notes. When adding a parent, is an alias of
Note.branches.parents
.Access as
Note.parents
, a descriptor mapping to an instance of this class.This object is stateless;
Note.branches.parents
is the source of truth for parent branches.- 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.
- class trilium_alchemy.core.note.branches.Children(entity: Entity)#
Bases:
trilium_alchemy.core.note.extension.NoteExtension
collections.abc.MutableSequence
Interface to a note’s child notes. For adding a child, is an alias of
Note.branches.children
.Access as
Note.parents
, a descriptor mapping to an instance of this class.This object is stateless;
Note.branches.children
is the source of truth for child branches.- 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