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

Method discard

Lib/mailbox.py:345–351  ·  view source on GitHub ↗

If the keyed message exists, remove it.

(self, key)

Source from the content-addressed store, hash-verified

343 os.remove(os.path.join(self._path, self._lookup(key)))
344
345 def discard(self, key):
346 """If the keyed message exists, remove it."""
347 # This overrides an inapplicable implementation in the superclass.
348 try:
349 self.remove(key)
350 except (KeyError, FileNotFoundError):
351 pass
352
353 def __setitem__(self, key, message):
354 """Replace the keyed message; raise KeyError if it doesn't exist."""

Callers 1

__setitem__Method · 0.95

Calls 1

removeMethod · 0.95

Tested by

no test coverage detected