MCPcopy Index your code
hub / github.com/RustPython/RustPython / get_message

Method get_message

Lib/mailbox.py:1345–1371  ·  view source on GitHub ↗

Return a Message representation or raise a KeyError.

(self, key)

Source from the content-addressed store, hash-verified

1343 self._labels[key] = message.get_labels()
1344
1345 def get_message(self, key):
1346 """Return a Message representation or raise a KeyError."""
1347 start, stop = self._lookup(key)
1348 self._file.seek(start)
1349 self._file.readline() # Skip b'1,' line specifying labels.
1350 original_headers = io.BytesIO()
1351 while True:
1352 line = self._file.readline()
1353 if line == b'*** EOOH ***' + linesep or not line:
1354 break
1355 original_headers.write(line.replace(linesep, b'\n'))
1356 visible_headers = io.BytesIO()
1357 while True:
1358 line = self._file.readline()
1359 if line == linesep or not line:
1360 break
1361 visible_headers.write(line.replace(linesep, b'\n'))
1362 # Read up to the stop, or to the end
1363 n = stop - self._file.tell()
1364 assert n >= 0
1365 body = self._file.read(n)
1366 body = body.replace(linesep, b'\n')
1367 msg = BabylMessage(original_headers.getvalue() + body)
1368 msg.set_visible(visible_headers.getvalue())
1369 if key in self._labels:
1370 msg.set_labels(self._labels[key])
1371 return msg
1372
1373 def get_bytes(self, key):
1374 """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