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

Function get_ttext

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

2309 return invalid_parameter, value
2310
2311def get_ttext(value):
2312 """ttext = <matches _ttext_matcher>
2313
2314 We allow any non-TOKEN_ENDS in ttext, but add defects to the token&#x27;s
2315 defects list if we find non-ttext characters. We also register defects for
2316 *any* non-printables even though the RFC doesn&#x27;t exclude all of them,
2317 because we follow the spirit of RFC 5322.
2318
2319 """
2320 m = _non_token_end_matcher(value)
2321 if not m:
2322 raise errors.HeaderParseError(
2323 "expected ttext but found '{}'".format(value))
2324 ttext = m.group()
2325 value = value[len(ttext):]
2326 ttext = ValueTerminal(ttext, 'ttext')
2327 _validate_xtext(ttext)
2328 return ttext, value
2329
2330def get_token(value):
2331 """token = [CFWS] 1*ttext [CFWS]

Callers 1

get_tokenFunction · 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…