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

Method get_message

Lib/mailbox.py:380–393  ·  view source on GitHub ↗

Return a Message representation or raise a KeyError.

(self, key)

Source from the content-addressed store, hash-verified

378 os.rename(tmp_path, new_path)
379
380 def get_message(self, key):
381 """Return a Message representation or raise a KeyError."""
382 subpath = self._lookup(key)
383 with open(os.path.join(self._path, subpath), 'rb') as f:
384 if self._factory:
385 msg = self._factory(f)
386 else:
387 msg = MaildirMessage(f)
388 subdir, name = os.path.split(subpath)
389 msg.set_subdir(subdir)
390 if self.colon in name:
391 msg.set_info(name.split(self.colon)[-1])
392 msg.set_date(os.path.getmtime(os.path.join(self._path, subpath)))
393 return msg
394
395 def get_bytes(self, key):
396 """Return a bytes representation or raise a KeyError."""

Callers 1

Calls 9

_lookupMethod · 0.95
set_subdirMethod · 0.95
set_infoMethod · 0.95
set_dateMethod · 0.95
MaildirMessageClass · 0.85
_factoryMethod · 0.80
openFunction · 0.70
joinMethod · 0.45
splitMethod · 0.45

Tested by 1