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

Function get_comment

Lib/email/_header_value_parser.py:1265–1288  ·  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

1263 return bare_quoted_string, value[1:]
1264
1265def get_comment(value):
1266 """comment = "(" *([FWS] ccontent) [FWS] ")"
1267 ccontent = ctext / quoted-pair / comment
1268
1269 We handle nested comments here, and quoted-pair in our qp-ctext routine.
1270 """
1271 if value and value[0] != '(':
1272 raise errors.HeaderParseError(
1273 "expected '(' but found '{}'".format(value))
1274 comment = Comment()
1275 value = value[1:]
1276 while value and value[0] != ")":
1277 if value[0] in WSP:
1278 token, value = get_fws(value)
1279 elif value[0] == '(':
1280 token, value = get_comment(value)
1281 else:
1282 token, value = get_qp_ctext(value)
1283 comment.append(token)
1284 if not value:
1285 comment.defects.append(errors.InvalidHeaderDefect(
1286 "end of header inside comment"))
1287 return comment, value
1288 return comment, value[1:]
1289
1290def get_cfws(value):
1291 """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