MCPcopy Index your code
hub / github.com/RustPython/RustPython / __getitem__

Method __getitem__

Lib/dbm/dumb.py:146–154  ·  view source on GitHub ↗
(self, key)

Source from the content-addressed store, hash-verified

144 raise error('DBM object has already been closed')
145
146 def __getitem__(self, key):
147 if isinstance(key, str):
148 key = key.encode('utf-8')
149 self._verify_open()
150 pos, siz = self._index[key] # may raise KeyError
151 with _io.open(self._datfile, 'rb') as f:
152 f.seek(pos)
153 dat = f.read(siz)
154 return dat
155
156 # Append val to the data file, starting at a _BLOCKSIZE-aligned
157 # offset. The data file is first padded with NUL bytes (if needed)

Callers

nothing calls this directly

Calls 6

_verify_openMethod · 0.95
isinstanceFunction · 0.85
encodeMethod · 0.45
openMethod · 0.45
seekMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected