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

Method _addval

Lib/dbm/dumb.py:160–168  ·  view source on GitHub ↗
(self, val)

Source from the content-addressed store, hash-verified

158 # to get to an aligned offset. Return pair
159 # (starting offset of val, len(val))
160 def _addval(self, val):
161 with _io.open(self._datfile, 'rb+') as f:
162 f.seek(0, 2)
163 pos = int(f.tell())
164 npos = ((pos + _BLOCKSIZE - 1) // _BLOCKSIZE) * _BLOCKSIZE
165 f.write(b'\0'*(npos-pos))
166 pos = npos
167 f.write(val)
168 return (pos, len(val))
169
170 # Write val to the data file, starting at offset pos. The caller
171 # is responsible for ensuring that there's enough room starting at

Callers 1

__setitem__Method · 0.95

Calls 5

lenFunction · 0.85
openMethod · 0.45
seekMethod · 0.45
tellMethod · 0.45
writeMethod · 0.45

Tested by

no test coverage detected