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

Method header_fetch_parse

Lib/email/policy.py:157–170  ·  view source on GitHub ↗

+ If the value has a 'name' attribute, it is returned to unmodified. Otherwise the name and the value with any linesep characters removed are passed to the header_factory method, and the resulting custom header object is returned. Any surrogateescaped bytes get turne

(self, name, value)

Source from the content-addressed store, hash-verified

155 return (name, self.header_factory(name, value))
156
157 def header_fetch_parse(self, name, value):
158 """+
159 If the value has a 'name' attribute, it is returned to unmodified.
160 Otherwise the name and the value with any linesep characters removed
161 are passed to the header_factory method, and the resulting custom
162 header object is returned. Any surrogateescaped bytes get turned
163 into the unicode unknown-character glyph.
164
165 """
166 if hasattr(value, 'name'):
167 return value
168 # We can't use splitlines here because it splits on more than \r and \n.
169 value = ''.join(linesep_splitter.split(value))
170 return self.header_factory(name, value)
171
172 def fold(self, name, value):
173 """+

Callers 4

valuesMethod · 0.45
itemsMethod · 0.45
getMethod · 0.45
get_allMethod · 0.45

Calls 2

joinMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected