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

Function get_comment

Lib/email/_header_value_parser.py:1282–1305  ·  view source on GitHub ↗

comment = "(" *([FWS] ccontent) [FWS] ")" ccontent = ctext / quoted-pair / comment We handle nested comments here, and quoted-pair in our qp-ctext routine.

(value)

Source from the content-addressed store, hash-verified

1280 return bare_quoted_string, value[1:]
1281
1282def get_comment(value):
1283 """comment = "(" *([FWS] ccontent) [FWS] ")"
1284 ccontent = ctext / quoted-pair / comment
1285
1286 We handle nested comments here, and quoted-pair in our qp-ctext routine.
1287 """
1288 if value and value[0] != '(':
1289 raise errors.HeaderParseError(
1290 "expected '(' but found '{}'".format(value))
1291 comment = Comment()
1292 value = value[1:]
1293 while value and value[0] != ")":
1294 if value[0] in WSP:
1295 token, value = get_fws(value)
1296 elif value[0] == '(':
1297 token, value = get_comment(value)
1298 else:
1299 token, value = get_qp_ctext(value)
1300 comment.append(token)
1301 if not value:
1302 comment.defects.append(errors.InvalidHeaderDefect(
1303 "end of header inside comment"))
1304 return comment, value
1305 return comment, value[1:]
1306
1307def get_cfws(value):
1308 """CFWS = (1*([FWS] comment) [FWS]) / FWS

Callers 1

get_cfwsFunction · 0.85

Calls 5

get_fwsFunction · 0.85
get_qp_ctextFunction · 0.85
CommentClass · 0.70
formatMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…