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

Function get_attribute

Lib/email/_header_value_parser.py:2372–2393  ·  view source on GitHub ↗

[CFWS] 1*attrtext [CFWS] This version of the BNF makes the CFWS explicit, and as usual we use a value terminal for the actual run of characters. The RFC equivalent of attrtext is the token characters, with the subtraction of '*', "'", and '%'. We include tab in the excluded set ju

(value)

Source from the content-addressed store, hash-verified

2370 return attrtext, value
2371
2372def get_attribute(value):
2373 """ [CFWS] 1*attrtext [CFWS]
2374
2375 This version of the BNF makes the CFWS explicit, and as usual we use a
2376 value terminal for the actual run of characters. The RFC equivalent of
2377 attrtext is the token characters, with the subtraction of '*', "'", and '%'.
2378 We include tab in the excluded set just as we do for token.
2379
2380 """
2381 attribute = Attribute()
2382 if value and value[0] in CFWS_LEADER:
2383 token, value = get_cfws(value)
2384 attribute.append(token)
2385 if value and value[0] in ATTRIBUTE_ENDS:
2386 raise errors.HeaderParseError(
2387 "expected token but found '{}'".format(value))
2388 token, value = get_attrtext(value)
2389 attribute.append(token)
2390 if value and value[0] in CFWS_LEADER:
2391 token, value = get_cfws(value)
2392 attribute.append(token)
2393 return attribute, value
2394
2395def get_extended_attrtext(value):
2396 """attrtext = 1*(any non-ATTRIBUTE_ENDS character plus '%')

Callers 1

get_parameterFunction · 0.70

Calls 5

AttributeClass · 0.85
get_cfwsFunction · 0.85
get_attrtextFunction · 0.85
appendMethod · 0.45
formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…