MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / get_message

Method get_message

tools/python-3.11.9-amd64/Lib/mailbox.py:1271–1297  ·  view source on GitHub ↗

Return a Message representation or raise a KeyError.

(self, key)

Source from the content-addressed store, hash-verified

1269 self._labels[key] = message.get_labels()
1270
1271 def get_message(self, key):
1272 """Return a Message representation or raise a KeyError."""
1273 start, stop = self._lookup(key)
1274 self._file.seek(start)
1275 self._file.readline() # Skip b'1,' line specifying labels.
1276 original_headers = io.BytesIO()
1277 while True:
1278 line = self._file.readline()
1279 if line == b'*** EOOH ***' + linesep or not line:
1280 break
1281 original_headers.write(line.replace(linesep, b'\n'))
1282 visible_headers = io.BytesIO()
1283 while True:
1284 line = self._file.readline()
1285 if line == linesep or not line:
1286 break
1287 visible_headers.write(line.replace(linesep, b'\n'))
1288 # Read up to the stop, or to the end
1289 n = stop - self._file.tell()
1290 assert n >= 0
1291 body = self._file.read(n)
1292 body = body.replace(linesep, b'\n')
1293 msg = BabylMessage(original_headers.getvalue() + body)
1294 msg.set_visible(visible_headers.getvalue())
1295 if key in self._labels:
1296 msg.set_labels(self._labels[key])
1297 return msg
1298
1299 def get_bytes(self, key):
1300 """Return a string representation or raise a KeyError."""

Callers

nothing calls this directly

Calls 11

writeMethod · 0.95
getvalueMethod · 0.95
set_visibleMethod · 0.95
set_labelsMethod · 0.95
BabylMessageClass · 0.85
_lookupMethod · 0.45
seekMethod · 0.45
readlineMethod · 0.45
replaceMethod · 0.45
tellMethod · 0.45
readMethod · 0.45

Tested by

no test coverage detected