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

Method header_store_parse

Lib/email/policy.py:131–148  ·  view source on GitHub ↗

+ The name is returned unchanged. If the input value has a 'name' attribute and it matches the name ignoring case, the value is returned unchanged. Otherwise the name and value are passed to header_factory method, and the resulting custom header object is returned a

(self, name, value)

Source from the content-addressed store, hash-verified

129 return (name, value.rstrip('\r\n'))
130
131 def header_store_parse(self, name, value):
132 """+
133 The name is returned unchanged. If the input value has a 'name'
134 attribute and it matches the name ignoring case, the value is returned
135 unchanged. Otherwise the name and value are passed to header_factory
136 method, and the resulting custom header object is returned as the
137 value. In this case a ValueError is raised if the input value contains
138 CR or LF characters.
139
140 """
141 if hasattr(value, 'name') and value.name.lower() == name.lower():
142 return (name, value)
143 if isinstance(value, str) and len(value.splitlines())>1:
144 # XXX this error message isn't quite right when we use splitlines
145 # (see issue 22233), but I'm not sure what should happen here.
146 raise ValueError("Header values may not contain linefeed "
147 "or carriage return characters")
148 return (name, self.header_factory(name, value))
149
150 def header_fetch_parse(self, name, value):
151 """+

Callers 3

__setitem__Method · 0.45
replace_headerMethod · 0.45
set_boundaryMethod · 0.45

Calls 5

hasattrFunction · 0.85
isinstanceFunction · 0.85
lenFunction · 0.85
lowerMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected