Set a key-value pair (dict-like API). Args: key: The key to insert or update. value: The value to associate with the key.
(self, key: Any, value: Any)
| 139 | self._rightmost_leaf_cache = current |
| 140 | |
| 141 | def __setitem__(self, key: Any, value: Any) -> None: |
| 142 | """Set a key-value pair (dict-like API). |
| 143 | |
| 144 | Args: |
| 145 | key: The key to insert or update. |
| 146 | value: The value to associate with the key. |
| 147 | """ |
| 148 | result = self._insert_recursive(self.root, key, value) |
| 149 | |
| 150 | # If the root split, create a new root |
| 151 | if result is not None: |
| 152 | new_node, separator_key = result |
| 153 | new_root = BranchNode(self.capacity) |
| 154 | new_root.keys.append(separator_key) |
| 155 | new_root.children.append(self.root) |
| 156 | new_root.children.append(new_node) |
| 157 | self.root = new_root |
| 158 | |
| 159 | def _insert_recursive( |
| 160 | self, node: "Node", key: Any, value: Any |
nothing calls this directly
no test coverage detected