Skip to content

Commit bd3ed76

Browse files
Address review comment.
1 parent 8a3e4e5 commit bd3ed76

3 files changed

Lines changed: 14 additions & 22 deletions

File tree

Doc/library/base64.rst

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,13 @@ POST request.
6161
This allows an application to e.g. generate URL or filesystem safe Base64
6262
strings. The default is ``None``, for which the standard Base64 alphabet is used.
6363

64+
If *wrapcol* is non-zero, insert a newline (``b'\n'``) character
65+
after at most every *wrapcol* characters.
66+
If *wrapcol* is zero (default), do not add any newlines.
67+
6468
May assert or raise a :exc:`ValueError` if the length of *altchars* is not 2. Raises a
6569
:exc:`TypeError` if *altchars* is not a :term:`bytes-like object`.
6670

67-
If *wrapcol* is non-zero, the output will be represented in lines of
68-
no more than *wrapcol* characters each, separated by a newline
69-
(``b'\n'``) character.
70-
If *wrapcol* is zero (default), the output will be represented as
71-
a single line.
72-
7371
.. versionchanged:: next
7472
Added the *wrapcol* parameter.
7573

@@ -223,11 +221,9 @@ Refer to the documentation of the individual functions for more information.
223221
instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
224222
feature is not supported by the "standard" Ascii85 encoding.
225223

226-
If *wrapcol* is non-zero, the output will be represented in lines of
227-
no more than *wrapcol* characters each, separated by a newline
228-
(``b'\n'``) character.
229-
If *wrapcol* is zero (default), the output will be represented as
230-
a single line.
224+
If *wrapcol* is non-zero, insert a newline (``b'\n'``) character
225+
after at most every *wrapcol* characters.
226+
If *wrapcol* is zero (default), do not add any newlines.
231227

232228
*pad* controls whether the input is padded to a multiple of 4
233229
before encoding. Note that the ``btoa`` implementation always pads.

Doc/library/binascii.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,9 @@ The :mod:`binascii` module defines the following functions:
7272
Convert binary data to a line(s) of ASCII characters in base64 coding,
7373
as specified in :rfc:`4648`.
7474

75-
If *wrapcol* is non-zero, the output will be represented in lines of
76-
no more than *wrapcol* characters each, separated by a newline
77-
(``b'\n'``) character.
78-
If *wrapcol* is zero (default), the output will be represented as
79-
a single line.
75+
If *wrapcol* is non-zero, insert a newline (``b'\n'``) character
76+
after at most every *wrapcol* characters.
77+
If *wrapcol* is zero (default), do not add any newlines.
8078

8179
If *newline* is true (default), a newline character will be added
8280
at the end of the output.

Lib/base64.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ def b64encode(s, altchars=None, *, wrapcol=0):
5252
alternative alphabet for the '+' and '/' characters. This allows an
5353
application to e.g. generate url or filesystem safe Base64 strings.
5454
55-
If wrapcol is non-zero, the output will be represented in lines of
56-
no more than wrapcol characters each, separated by a newline (b'\\n')
57-
character.
55+
If wrapcol is non-zero, insert a newline (b'\\n') character after at most
56+
every wrapcol characters.
5857
"""
5958
encoded = binascii.b2a_base64(s, wrapcol=wrapcol, newline=False)
6059
if altchars is not None:
@@ -331,9 +330,8 @@ def a85encode(b, *, foldspaces=False, wrapcol=0, pad=False, adobe=False):
331330
instead of 4 consecutive spaces (ASCII 0x20) as supported by 'btoa'. This
332331
feature is not supported by the "standard" Adobe encoding.
333332
334-
If wrapcol is non-zero, the output will be represented in lines of
335-
no more than wrapcol characters each, separated by a newline (b'\\n')
336-
character.
333+
If wrapcol is non-zero, insert a newline (b'\\n') character after at most
334+
every wrapcol characters.
337335
338336
pad controls whether the input is padded to a multiple of 4 before
339337
encoding. Note that the btoa implementation always pads.

0 commit comments

Comments
 (0)