(self, inp)
| 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: |
no outgoing calls
no test coverage detected