TagTree

class mnemosyne.libmnemosyne.tag_tree.TagTree(component_manager)

Organises the tags in a hierarchical tree. By convention, hierarchical levels in tags are denoted by a :: separator.

This class is not meant to be instantiated at run time, but rather only when it is needed.

The internal tree datastructure for e.g. the two tags A::B::C and A::B::D looks as follows:

self[_(“__ALL__”)] = [“A”] self[“A”] = [“A::B”] self[“A::B”] = [“A::B::C”, “A::B::D”]

Each tree level stores the entire partial tag (i.e. A::B instead of B) to guarantee uniqueness.

Apart from the dictionary in self, this class also contains self.display_name_for_node and self.card_count_for_node, with node being the index field for the main dictionary self.

delete_subtree(node)
rename_node(old_node_label, new_node_label)

Previous topic

Tag

Next topic

CardType

This Page