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

Method _find_position_in_leaf

python/bplustree/bplus_tree.py:484–494  ·  view source on GitHub ↗

Find the position where key is or would be in the leaf

(self, leaf: "LeafNode", key: Any)

Source from the content-addressed store, hash-verified

482 return self.root.find_leaf_for_key(key)
483
484 def _find_position_in_leaf(self, leaf: "LeafNode", key: Any) -> int:
485 """Find the position where key is or would be in the leaf"""
486 # Binary search for the position
487 left, right = 0, len(leaf.keys)
488 while left < right:
489 mid = (left + right) // 2
490 if key <= leaf.keys[mid]:
491 right = mid
492 else:
493 left = mid + 1
494 return left
495
496 def range(
497 self, start_key: Any = None, end_key: Any = None

Callers 1

itemsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected