Home
last modified time | relevance | path

Searched refs:altchars (Results 1 – 3 of 3) sorted by relevance

/third_party/python/Lib/
Dbase64.py51 def b64encode(s, altchars=None): argument
59 if altchars is not None:
60 assert len(altchars) == 2, repr(altchars)
61 return encoded.translate(bytes.maketrans(b'+/', altchars))
65 def b64decode(s, altchars=None, validate=False): argument
81 if altchars is not None:
82 altchars = _bytes_from_decode_data(altchars)
83 assert len(altchars) == 2, repr(altchars)
84 s = s.translate(bytes.maketrans(altchars, b'+/'))
/third_party/python/Lib/test/
Dtest_base64.py141 eq(base64.b64encode(b'\xd3V\xbeo\xf7\x1d', altchars=b'*$'), b'01a*b$cd')
142 eq(base64.b64encode(b'\xd3V\xbeo\xf7\x1d', altchars=bytearray(b'*$')),
144 eq(base64.b64encode(b'\xd3V\xbeo\xf7\x1d', altchars=memoryview(b'*$')),
146 eq(base64.b64encode(b'\xd3V\xbeo\xf7\x1d', altchars=array('B', b'*$')),
151 self.assertRaises(TypeError, base64.b64encode, b"", altchars="*$")
202 for (data, altchars), res in tests_altchars.items():
204 altchars_str = altchars.decode('ascii')
206 eq(base64.b64decode(data, altchars=altchars), res)
207 eq(base64.b64decode(data_str, altchars=altchars), res)
208 eq(base64.b64decode(data, altchars=altchars_str), res)
[all …]
/third_party/python/Doc/library/
Dbase64.rst51 .. function:: b64encode(s, altchars=None)
56 Optional *altchars* must be a :term:`bytes-like object` of at least
63 .. function:: b64decode(s, altchars=None, validate=False)
68 Optional *altchars* must be a :term:`bytes-like object` or ASCII string of