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

Method fold

Lib/email/policy.py:172–191  ·  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

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

Callers 3

_foldMethod · 0.45
_write_headersMethod · 0.45
_prepare_setFunction · 0.45

Calls 1

_foldMethod · 0.95

Tested by

no test coverage detected