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

Function get_attrtext

Lib/email/_header_value_parser.py:2353–2370  ·  view source on GitHub ↗

attrtext = 1*(any non-ATTRIBUTE_ENDS character) We allow any non-ATTRIBUTE_ENDS in attrtext, but add defects to the token's defects list if we find non-attrtext characters. We also register defects for *any* non-printables even though the RFC doesn't exclude all of them, because we

(value)

Source from the content-addressed store, hash-verified

2351 return mtoken, value
2352
2353def get_attrtext(value):
2354 """attrtext = 1*(any non-ATTRIBUTE_ENDS character)
2355
2356 We allow any non-ATTRIBUTE_ENDS in attrtext, but add defects to the
2357 token's defects list if we find non-attrtext characters. We also register
2358 defects for *any* non-printables even though the RFC doesn't exclude all of
2359 them, because we follow the spirit of RFC 5322.
2360
2361 """
2362 m = _non_attribute_end_matcher(value)
2363 if not m:
2364 raise errors.HeaderParseError(
2365 "expected attrtext but found {!r}".format(value))
2366 attrtext = m.group()
2367 value = value[len(attrtext):]
2368 attrtext = ValueTerminal(attrtext, 'attrtext')
2369 _validate_xtext(attrtext)
2370 return attrtext, value
2371
2372def get_attribute(value):
2373 """ [CFWS] 1*attrtext [CFWS]

Callers 2

get_attributeFunction · 0.85
get_parameterFunction · 0.85

Calls 4

ValueTerminalClass · 0.85
_validate_xtextFunction · 0.85
formatMethod · 0.45
groupMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…