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

Function get_token

Lib/email/_header_value_parser.py:2287–2308  ·  view source on GitHub ↗

token = [CFWS] 1*ttext [CFWS] The RFC equivalent of ttext is any US-ASCII chars except space, ctls, or tspecials. We also exclude tabs even though the RFC doesn't. The RFC implies the CFWS but is not explicit about it in the BNF.

(value)

Source from the content-addressed store, hash-verified

2285 return ttext, value
2286
2287def get_token(value):
2288 """token = [CFWS] 1*ttext [CFWS]
2289
2290 The RFC equivalent of ttext is any US-ASCII chars except space, ctls, or
2291 tspecials. We also exclude tabs even though the RFC doesn't.
2292
2293 The RFC implies the CFWS but is not explicit about it in the BNF.
2294
2295 """
2296 mtoken = Token()
2297 if value and value[0] in CFWS_LEADER:
2298 token, value = get_cfws(value)
2299 mtoken.append(token)
2300 if value and value[0] in TOKEN_ENDS:
2301 raise errors.HeaderParseError(
2302 "expected token but found '{}'".format(value))
2303 token, value = get_ttext(value)
2304 mtoken.append(token)
2305 if value and value[0] in CFWS_LEADER:
2306 token, value = get_cfws(value)
2307 mtoken.append(token)
2308 return mtoken, value
2309
2310def get_attrtext(value):
2311 """attrtext = 1*(any non-ATTRIBUTE_ENDS character)

Calls 5

get_cfwsFunction · 0.85
get_ttextFunction · 0.85
TokenClass · 0.70
appendMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected