Commit 891e9e3b authored by Géry Ogam's avatar Géry Ogam Committed by Carol Willing

Correct typos in the codecs module documentation (#15135)

parent 39de95b7
......@@ -568,7 +568,7 @@ define in order to be compatible with the Python codec registry.
implementation should make sure that ``0`` is the most common
state. (States that are more complicated than integers can be converted
into an integer by marshaling/pickling the state and encoding the bytes
of the resulting string into an integer).
of the resulting string into an integer.)
.. method:: setstate(state)
......@@ -780,8 +780,8 @@ compatible with the Python codec registry.
Read all lines available on the input stream and return them as a list of
lines.
Line-endings are implemented using the codec's decoder method and are
included in the list entries if *keepends* is true.
Line-endings are implemented using the codec's :meth:`decode` method and
are included in the list entries if *keepends* is true.
*sizehint*, if given, is passed as the *size* argument to the stream's
:meth:`read` method.
......@@ -841,7 +841,7 @@ The design is such that one can use the factory functions returned by the
code calling :meth:`read` and :meth:`write`, while *Reader* and *Writer*
work on the backend — the data in *stream*.
You can use these objects to do transparent transcodings from e.g. Latin-1
You can use these objects to do transparent transcodings, e.g., from Latin-1
to UTF-8 and back.
The *stream* argument must be a file-like object.
......@@ -1145,7 +1145,7 @@ particular, the following variants typically exist:
| iso2022_kr | csiso2022kr, iso2022kr, | Korean |
| | iso-2022-kr | |
+-----------------+--------------------------------+--------------------------------+
| latin_1 | iso-8859-1, iso8859-1, 8859, | West Europe |
| latin_1 | iso-8859-1, iso8859-1, 8859, | Western Europe |
| | cp819, latin, latin1, L1 | |
+-----------------+--------------------------------+--------------------------------+
| iso8859_2 | iso-8859-2, latin2, L2 | Central and Eastern Europe |
......@@ -1254,7 +1254,7 @@ no meaning outside Python. These are listed in the tables below based on the
expected input and output types (note that while text encodings are the most
common use case for codecs, the underlying codec infrastructure supports
arbitrary data transforms rather than just text encodings). For asymmetric
codecs, the stated purpose describes the encoding direction.
codecs, the stated meaning describes the encoding direction.
Text Encodings
^^^^^^^^^^^^^^
......@@ -1266,27 +1266,27 @@ encodings.
.. tabularcolumns:: |l|p{0.3\linewidth}|p{0.3\linewidth}|
+--------------------+---------+---------------------------+
| Codec | Aliases | Purpose |
| Codec | Aliases | Meaning |
+====================+=========+===========================+
| idna | | Implements :rfc:`3490`, |
| idna | | Implement :rfc:`3490`, |
| | | see also |
| | | :mod:`encodings.idna`. |
| | | Only ``errors='strict'`` |
| | | is supported. |
+--------------------+---------+---------------------------+
| mbcs | ansi, | Windows only: Encode |
| mbcs | ansi, | Windows only: Encode the |
| | dbcs | operand according to the |
| | | ANSI codepage (CP_ACP) |
| | | ANSI codepage (CP_ACP). |
+--------------------+---------+---------------------------+
| oem | | Windows only: Encode |
| oem | | Windows only: Encode the |
| | | operand according to the |
| | | OEM codepage (CP_OEMCP) |
| | | OEM codepage (CP_OEMCP). |
| | | |
| | | .. versionadded:: 3.6 |
+--------------------+---------+---------------------------+
| palmos | | Encoding of PalmOS 3.5 |
| palmos | | Encoding of PalmOS 3.5. |
+--------------------+---------+---------------------------+
| punycode | | Implements :rfc:`3492`. |
| punycode | | Implement :rfc:`3492`. |
| | | Stateful codecs are not |
| | | supported. |
+--------------------+---------+---------------------------+
......@@ -1309,8 +1309,8 @@ encodings.
| | | literal in ASCII-encoded |
| | | Python source code, |
| | | except that quotes are |
| | | not escaped. Decodes from |
| | | Latin-1 source code. |
| | | not escaped. Decode |
| | | from Latin-1 source code. |
| | | Beware that Python source |
| | | code actually uses UTF-8 |
| | | by default. |
......@@ -1333,12 +1333,12 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
.. tabularcolumns:: |l|L|L|L|
+----------------------+------------------+------------------------------+------------------------------+
| Codec | Aliases | Purpose | Encoder / decoder |
| Codec | Aliases | Meaning | Encoder / decoder |
+======================+==================+==============================+==============================+
| base64_codec [#b64]_ | base64, base_64 | Convert operand to multiline | :meth:`base64.encodebytes` / |
| | | MIME base64 (the result | :meth:`base64.decodebytes` |
| | | always includes a trailing | |
| | | ``'\n'``) | |
| base64_codec [#b64]_ | base64, base_64 | Convert the operand to | :meth:`base64.encodebytes` / |
| | | multiline MIME base64 (the | :meth:`base64.decodebytes` |
| | | result always includes a | |
| | | trailing ``'\n'``). | |
| | | | |
| | | .. versionchanged:: 3.4 | |
| | | accepts any | |
......@@ -1346,23 +1346,23 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
| | | as input for encoding and | |
| | | decoding | |
+----------------------+------------------+------------------------------+------------------------------+
| bz2_codec | bz2 | Compress the operand | :meth:`bz2.compress` / |
| | | using bz2 | :meth:`bz2.decompress` |
| bz2_codec | bz2 | Compress the operand using | :meth:`bz2.compress` / |
| | | bz2. | :meth:`bz2.decompress` |
+----------------------+------------------+------------------------------+------------------------------+
| hex_codec | hex | Convert operand to | :meth:`binascii.b2a_hex` / |
| hex_codec | hex | Convert the operand to | :meth:`binascii.b2a_hex` / |
| | | hexadecimal | :meth:`binascii.a2b_hex` |
| | | representation, with two | |
| | | digits per byte | |
| | | digits per byte. | |
+----------------------+------------------+------------------------------+------------------------------+
| quopri_codec | quopri, | Convert operand to MIME | :meth:`quopri.encode` with |
| | quotedprintable, | quoted printable | ``quotetabs=True`` / |
| quopri_codec | quopri, | Convert the operand to MIME | :meth:`quopri.encode` with |
| | quotedprintable, | quoted printable. | ``quotetabs=True`` / |
| | quoted_printable | | :meth:`quopri.decode` |
+----------------------+------------------+------------------------------+------------------------------+
| uu_codec | uu | Convert the operand using | :meth:`uu.encode` / |
| | | uuencode | :meth:`uu.decode` |
| | | uuencode. | :meth:`uu.decode` |
+----------------------+------------------+------------------------------+------------------------------+
| zlib_codec | zip, zlib | Compress the operand | :meth:`zlib.compress` / |
| | | using gzip | :meth:`zlib.decompress` |
| zlib_codec | zip, zlib | Compress the operand using | :meth:`zlib.compress` / |
| | | gzip. | :meth:`zlib.decompress` |
+----------------------+------------------+------------------------------+------------------------------+
.. [#b64] In addition to :term:`bytes-like objects <bytes-like object>`,
......@@ -1388,10 +1388,11 @@ mapping. It is not supported by :meth:`str.encode` (which only produces
.. tabularcolumns:: |l|l|L|
+--------------------+---------+---------------------------+
| Codec | Aliases | Purpose |
| Codec | Aliases | Meaning |
+====================+=========+===========================+
| rot_13 | rot13 | Returns the Caesar-cypher |
| | | encryption of the operand |
| rot_13 | rot13 | Return the Caesar-cypher |
| | | encryption of the |
| | | operand. |
+--------------------+---------+---------------------------+
.. versionadded:: 3.2
......@@ -1438,7 +1439,7 @@ names (:mod:`http.client` then also transparently sends an IDNA hostname in the
:mailheader:`Host` field if it sends that field at all).
When receiving host names from the wire (such as in reverse name lookup), no
automatic conversion to Unicode is performed: Applications wishing to present
automatic conversion to Unicode is performed: applications wishing to present
such host names to the user should decode them to Unicode.
The module :mod:`encodings.idna` also implements the nameprep procedure, which
......@@ -1470,7 +1471,7 @@ functions can be used directly if desired.
.. module:: encodings.mbcs
:synopsis: Windows ANSI codepage
Encode operand according to the ANSI codepage (CP_ACP).
This module implements the ANSI codepage (CP_ACP).
.. availability:: Windows only.
......@@ -1489,7 +1490,7 @@ Encode operand according to the ANSI codepage (CP_ACP).
:synopsis: UTF-8 codec with BOM signature
.. moduleauthor:: Walter Dörwald
This module implements a variant of the UTF-8 codec: On encoding a UTF-8 encoded
This module implements a variant of the UTF-8 codec. On encoding, a UTF-8 encoded
BOM will be prepended to the UTF-8 encoded bytes. For the stateful encoder this
is only done once (on the first write to the byte stream). For decoding an
is only done once (on the first write to the byte stream). On decoding, an
optional UTF-8 encoded BOM at the start of the data will be skipped.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment