MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / encode

Method encode

tools/python-3.11.9-amd64/Lib/imaplib.py:1413–1435  ·  view source on GitHub ↗
(self, inp)

Source from the content-addressed store, hash-verified

1411 return self.encode(ret)
1412
1413 def encode(self, inp):
1414 #
1415 # Invoke binascii.b2a_base64 iteratively with
1416 # short even length buffers, strip the trailing
1417 # line feed from the result and append. "Even"
1418 # means a number that factors to both 6 and 8,
1419 # so when it gets to the end of the 8-bit input
1420 # there's no partial 6-bit output.
1421 #
1422 oup = b''
1423 if isinstance(inp, str):
1424 inp = inp.encode('utf-8')
1425 while inp:
1426 if len(inp) > 48:
1427 t = inp[:48]
1428 inp = inp[48:]
1429 else:
1430 t = inp
1431 inp = b''
1432 e = binascii.b2a_base64(t)
1433 if e:
1434 oup = oup + e[:-1]
1435 return oup
1436
1437 def decode(self, inp):
1438 if not inp:

Callers 3

processMethod · 0.95
_CRAM_MD5_AUTHMethod · 0.45
imaplib.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected