MCPcopy Create free account
hub / github.com/KentBeck/BPlusTree3 / get_child

Method get_child

python/bplustree/bplus_tree.py:924–933  ·  view source on GitHub ↗

Get the child node where a key would be found

(self, key: Any)

Source from the content-addressed store, hash-verified

922 return index
923
924 def get_child(self, key: Any) -> Node:
925 """Get the child node where a key would be found"""
926 if not self.children:
927 raise ValueError("BranchNode has no children - tree structure corrupted")
928 index = self.find_child_index(key)
929 if index >= len(self.children):
930 raise ValueError(
931 f"Child index {index} out of range (have {len(self.children)} children)"
932 )
933 return self.children[index]
934
935 def split(self) -> "BranchNode":
936 """Split this branch node, returning the new right node"""

Callers 3

find_leaf_for_keyMethod · 0.95
getMethod · 0.45
__contains__Method · 0.45

Calls 1

find_child_indexMethod · 0.95

Tested by

no test coverage detected