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

Method _get_encoder

Lib/email/charset.py:354–367  ·  view source on GitHub ↗
(self, header_bytes)

Source from the content-addressed store, hash-verified

352 return lines
353
354 def _get_encoder(self, header_bytes):
355 if self.header_encoding == BASE64:
356 return email.base64mime
357 elif self.header_encoding == QP:
358 return email.quoprimime
359 elif self.header_encoding == SHORTEST:
360 len64 = email.base64mime.header_length(header_bytes)
361 lenqp = email.quoprimime.header_length(header_bytes)
362 if len64 < lenqp:
363 return email.base64mime
364 else:
365 return email.quoprimime
366 else:
367 return None
368
369 def body_encode(self, string):
370 """Body-encode a string by converting it first to bytes.

Callers 2

header_encodeMethod · 0.95
header_encode_linesMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected