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

Method get

python/bplustree/bplus_tree.py:221–236  ·  view source on GitHub ↗

Get value for a key with optional default. Args: key: The key to look up. default: Value to return if key not found (default: None). Returns: The value associated with the key, or default if not found.

(self, key: Any, default: Any = None)

Source from the content-addressed store, hash-verified

219 return value
220
221 def get(self, key: Any, default: Any = None) -> Any:
222 """Get value for a key with optional default.
223
224 Args:
225 key: The key to look up.
226 default: Value to return if key not found (default: None).
227
228 Returns:
229 The value associated with the key, or default if not found.
230 """
231 node = self.root
232 while not node.is_leaf():
233 node = node.get_child(key)
234
235 value = node.get(key)
236 return value if value is not None else default
237
238 def __contains__(self, key: Any) -> bool:
239 """Check if key exists (for 'in' operator)"""

Callers 1

__getitem__Method · 0.95

Calls 3

is_leafMethod · 0.45
get_childMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected