MCPcopy Index your code
hub / github.com/python/cpython / __delitem__

Method __delitem__

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected