mirror of
https://github.com/python/cpython
synced 2024-09-18 21:41:39 +00:00
gh-90717: Update the documentation for the altchars paremeter in base64 library (GH-94187)
This commit is contained in:
parent
74d5f61ebd
commit
05dfc539c2
|
@ -53,11 +53,13 @@ The modern interface provides:
|
||||||
Encode the :term:`bytes-like object` *s* using Base64 and return the encoded
|
Encode the :term:`bytes-like object` *s* using Base64 and return the encoded
|
||||||
:class:`bytes`.
|
:class:`bytes`.
|
||||||
|
|
||||||
Optional *altchars* must be a :term:`bytes-like object` of at least
|
Optional *altchars* must be a :term:`bytes-like object` of length 2 which
|
||||||
length 2 (additional characters are ignored) which specifies an alternative
|
specifies an alternative alphabet for the ``+`` and ``/`` characters.
|
||||||
alphabet for the ``+`` and ``/`` characters. This allows an application to e.g.
|
This allows an application to e.g. generate URL or filesystem safe Base64
|
||||||
generate URL or filesystem safe Base64 strings. The default is ``None``, for
|
strings. The default is ``None``, for which the standard Base64 alphabet is used.
|
||||||
which the standard Base64 alphabet is used.
|
|
||||||
|
May assert or raise a a :exc:`ValueError` if the length of *altchars* is not 2. Raises a
|
||||||
|
:exc:`TypeError` if *altchars* is not a :term:`bytes-like object`.
|
||||||
|
|
||||||
|
|
||||||
.. function:: b64decode(s, altchars=None, validate=False)
|
.. function:: b64decode(s, altchars=None, validate=False)
|
||||||
|
@ -65,9 +67,9 @@ The modern interface provides:
|
||||||
Decode the Base64 encoded :term:`bytes-like object` or ASCII string
|
Decode the Base64 encoded :term:`bytes-like object` or ASCII string
|
||||||
*s* and return the decoded :class:`bytes`.
|
*s* and return the decoded :class:`bytes`.
|
||||||
|
|
||||||
Optional *altchars* must be a :term:`bytes-like object` or ASCII string of
|
Optional *altchars* must be a :term:`bytes-like object` or ASCII string
|
||||||
at least length 2 (additional characters are ignored) which specifies the
|
of length 2 which specifies the alternative alphabet used instead of the
|
||||||
alternative alphabet used instead of the ``+`` and ``/`` characters.
|
``+`` and ``/`` characters.
|
||||||
|
|
||||||
A :exc:`binascii.Error` exception is raised
|
A :exc:`binascii.Error` exception is raised
|
||||||
if *s* is incorrectly padded.
|
if *s* is incorrectly padded.
|
||||||
|
@ -80,6 +82,7 @@ The modern interface provides:
|
||||||
|
|
||||||
For more information about the strict base64 check, see :func:`binascii.a2b_base64`
|
For more information about the strict base64 check, see :func:`binascii.a2b_base64`
|
||||||
|
|
||||||
|
May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2.
|
||||||
|
|
||||||
.. function:: standard_b64encode(s)
|
.. function:: standard_b64encode(s)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue