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

Method __getitem__

Lib/mailbox.py:78–84  ·  view source on GitHub ↗

Return the keyed message; raise KeyError if it doesn't exist.

(self, key)

Source from the content-addressed store, hash-verified

76 return default
77
78 def __getitem__(self, key):
79 """Return the keyed message; raise KeyError if it doesn't exist."""
80 if not self._factory:
81 return self.get_message(key)
82 else:
83 with contextlib.closing(self.get_file(key)) as file:
84 return self._factory(file)
85
86 def get_message(self, key):
87 """Return a Message representation or raise a KeyError."""

Callers 2

getMethod · 0.95
test_notimplementedMethod · 0.95

Calls 3

get_messageMethod · 0.95
get_fileMethod · 0.95
_factoryMethod · 0.80

Tested by 1

test_notimplementedMethod · 0.76