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

Function parse_content_transfer_encoding_header

Lib/email/_header_value_parser.py:2782–2811  ·  view source on GitHub ↗

mechanism

(value)

Source from the content-addressed store, hash-verified

2780 return disp_header
2781
2782def parse_content_transfer_encoding_header(value):
2783 """ mechanism
2784
2785 """
2786 # We should probably validate the values, since the list is fixed.
2787 cte_header = ContentTransferEncoding()
2788 if not value:
2789 cte_header.defects.append(errors.HeaderMissingRequiredValue(
2790 "Missing content transfer encoding"))
2791 return cte_header
2792 try:
2793 token, value = get_token(value)
2794 except errors.HeaderParseError:
2795 cte_header.defects.append(errors.InvalidHeaderDefect(
2796 "Expected content transfer encoding but found {!r}".format(value)))
2797 else:
2798 cte_header.append(token)
2799 cte_header.cte = token.value.strip().lower()
2800 if not value:
2801 return cte_header
2802 while value:
2803 cte_header.defects.append(errors.InvalidHeaderDefect(
2804 "Extra text after content transfer encoding"))
2805 if value[0] in PHRASE_ENDS:
2806 cte_header.append(ValueTerminal(value[0], 'misplaced-special'))
2807 value = value[1:]
2808 else:
2809 token, value = get_phrase(value)
2810 cte_header.append(token)
2811 return cte_header
2812
2813
2814#

Callers

nothing calls this directly

Calls 8

get_tokenFunction · 0.85
ValueTerminalClass · 0.85
get_phraseFunction · 0.85
appendMethod · 0.45
formatMethod · 0.45
lowerMethod · 0.45
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…