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

Function parse_message_ids

Lib/email/_header_value_parser.py:2191–2215  ·  view source on GitHub ↗

in-reply-to = "In-Reply-To:" 1*msg-id CRLF references = "References:" 1*msg-id CRLF

(value)

Source from the content-addressed store, hash-verified

2189 return message_id
2190
2191def parse_message_ids(value):
2192 """in-reply-to = "In-Reply-To:" 1*msg-id CRLF
2193 references = "References:" 1*msg-id CRLF
2194 """
2195 message_id_list = MessageIDList()
2196 while value:
2197 if value[0] == ',':
2198 # message id list separated with commas - this is invalid,
2199 # but happens rather frequently in the wild
2200 message_id_list.defects.append(
2201 errors.InvalidHeaderDefect("comma in msg-id list"))
2202 message_id_list.append(
2203 WhiteSpaceTerminal(' ', 'invalid-comma-replacement'))
2204 value = value[1:]
2205 continue
2206 try:
2207 token, value = get_msg_id(value)
2208 message_id_list.append(token)
2209 except errors.HeaderParseError as ex:
2210 token = get_unstructured(value)
2211 message_id_list.append(InvalidMessageID(token))
2212 message_id_list.defects.append(
2213 errors.InvalidHeaderDefect("Invalid msg-id: {!r}".format(ex)))
2214 break
2215 return message_id_list
2216
2217#
2218# XXX: As I begin to add additional header parsers, I'm realizing we probably

Callers

nothing calls this directly

Calls 7

MessageIDListClass · 0.85
WhiteSpaceTerminalClass · 0.85
get_msg_idFunction · 0.85
get_unstructuredFunction · 0.85
InvalidMessageIDClass · 0.85
appendMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…