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

Method __delitem__

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

Source from the content-addressed store, hash-verified

224 # (so that _commit() never gets called).
225
226 def __delitem__(self, key):
227 if self._readonly:
228 raise error('The database is opened for reading only')
229 if isinstance(key, str):
230 key = key.encode('utf-8')
231 self._verify_open()
232 self._modified = True
233 # The blocks used by the associated value are lost.
234 del self._index[key]
235 # XXX It's unclear why we do a _commit() here (the code always
236 # XXX has, so I'm not changing it). __setitem__ doesn't try to
237 # XXX keep the directory file in synch. Why should we? Or
238 # XXX why shouldn't __setitem__?
239 self._commit()
240
241 def keys(self):
242 try:

Callers

nothing calls this directly

Calls 5

_verify_openMethod · 0.95
_commitMethod · 0.95
isinstanceFunction · 0.85
errorClass · 0.70
encodeMethod · 0.45

Tested by

no test coverage detected