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

Method fold

Lib/email/policy.py:165–184  ·  view source on GitHub ↗

+ Header folding is controlled by the refold_source policy setting. A value is considered to be a 'source value' if and only if it does not have a 'name' attribute (having a 'name' attribute means it is a header object of some sort). If a source value needs to be re

(self, name, value)

Source from the content-addressed store, hash-verified

163 return self.header_factory(name, value)
164
165 def fold(self, name, value):
166 """+
167 Header folding is controlled by the refold_source policy setting. A
168 value is considered to be a 'source value' if and only if it does not
169 have a 'name' attribute (having a 'name' attribute means it is a header
170 object of some sort). If a source value needs to be refolded according
171 to the policy, it is converted into a custom header object by passing
172 the name and the value with any linesep characters removed to the
173 header_factory method. Folding of a custom header object is done by
174 calling its fold method with the current policy.
175
176 Source values are split into lines using splitlines. If the value is
177 not to be refolded, the lines are rejoined using the linesep from the
178 policy and returned. The exception is lines containing non-ascii
179 binary data. In that case the value is refolded regardless of the
180 refold_source setting, which causes the binary data to be CTE encoded
181 using the unknown-8bit charset.
182
183 """
184 return self._fold(name, value, refold_binary=True)
185
186 def fold_binary(self, name, value):
187 """+

Callers 3

_foldMethod · 0.45
_write_headersMethod · 0.45
_prepare_setFunction · 0.45

Calls 1

_foldMethod · 0.95

Tested by

no test coverage detected