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

Method __contains__

python/bplustree/bplus_tree.py:238–245  ·  view source on GitHub ↗

Check if key exists (for 'in' operator)

(self, key: Any)

Source from the content-addressed store, hash-verified

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)"""
240 node = self.root
241 while not node.is_leaf():
242 node = node.get_child(key)
243
244 pos, exists = node.find_position(key)
245 return exists
246
247 def __len__(self) -> int:
248 """Return number of key-value pairs"""

Callers

nothing calls this directly

Calls 3

is_leafMethod · 0.45
get_childMethod · 0.45
find_positionMethod · 0.45

Tested by

no test coverage detected