MCPcopy
hub / github.com/stanford-oval/storm / get_path_from_root

Method get_path_from_root

knowledge_storm/dataclass.py:190–204  ·  view source on GitHub ↗

Get a list of names from the root to this node. Returns: List[str]: A list of node names from the root to this node.

(self, root: Optional["KnowledgeNode"] = None)

Source from the content-addressed store, hash-verified

188 return f"KnowledgeNode(name={self.name}, content={self.content}, children={len(self.children)})"
189
190 def get_path_from_root(self, root: Optional["KnowledgeNode"] = None):
191 """
192 Get a list of names from the root to this node.
193
194 Returns:
195 List[str]: A list of node names from the root to this node.
196 """
197 path = []
198 current_node = self
199 while current_node:
200 path.append(current_node.name)
201 if root is not None and current_node.name == root.name:
202 break
203 current_node = current_node.parent
204 return path[::-1]
205
206 def insert_information(self, information_index: int):
207 if information_index not in self.content:

Callers 10

helperMethod · 0.80
insert_informationMethod · 0.80
_helperMethod · 0.80
helperMethod · 0.80
process_nodeMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected