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

Method __getitem__

python/bplustree/bplus_tree.py:211–219  ·  view source on GitHub ↗

Get value for a key (dict-like API)

(self, key: Any)

Source from the content-addressed store, hash-verified

209 )
210
211 def __getitem__(self, key: Any) -> Any:
212 """Get value for a key (dict-like API)"""
213 value = self.get(key)
214 if value is None:
215 # Check if key actually exists but has None value
216 if key in self:
217 return None
218 raise KeyError(key)
219 return value
220
221 def get(self, key: Any, default: Any = None) -> Any:
222 """Get value for a key with optional default.

Callers

nothing calls this directly

Calls 1

getMethod · 0.95

Tested by

no test coverage detected