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

Function get_ttext

Lib/email/_header_value_parser.py:2268–2285  ·  view source on GitHub ↗

ttext = We allow any non-TOKEN_ENDS in ttext, but add defects to the token's defects list if we find non-ttext characters. We also register defects for *any* non-printables even though the RFC doesn't exclude all of them, because we follow the spirit of RFC

(value)

Source from the content-addressed store, hash-verified

2266 return invalid_parameter, value
2267
2268def get_ttext(value):
2269 """ttext = <matches _ttext_matcher>
2270
2271 We allow any non-TOKEN_ENDS in ttext, but add defects to the token&#x27;s
2272 defects list if we find non-ttext characters. We also register defects for
2273 *any* non-printables even though the RFC doesn&#x27;t exclude all of them,
2274 because we follow the spirit of RFC 5322.
2275
2276 """
2277 m = _non_token_end_matcher(value)
2278 if not m:
2279 raise errors.HeaderParseError(
2280 "expected ttext but found '{}'".format(value))
2281 ttext = m.group()
2282 value = value[len(ttext):]
2283 ttext = ValueTerminal(ttext, 'ttext')
2284 _validate_xtext(ttext)
2285 return ttext, value
2286
2287def get_token(value):
2288 """token = [CFWS] 1*ttext [CFWS]

Callers 1

get_tokenFunction · 0.85

Calls 5

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

Tested by

no test coverage detected