@@ -1461,26 +1461,10 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
14611461| uu_codec | uu | Convert the operand using | |
14621462| | | uuencode. | |
14631463+----------------------+------------------+------------------------------+------------------------------+
1464- | escape_codec | escape | Encode and decode byte | :func: `codecs.escape_encode ` |
1465- | | | sequences using escape | / |
1466- | | | sequences, similar to | :func: `codecs.escape_decode ` |
1467- | | | :func: `repr ` of bytes. | |
1468- +----------------------+------------------+------------------------------+------------------------------+
14691464| zlib_codec | zip, zlib | Compress the operand using | :meth: `zlib.compress ` / |
14701465| | | gzip. | :meth: `zlib.decompress ` |
14711466+----------------------+------------------+------------------------------+------------------------------+
14721467
1473- .. function :: codecs.escape_encode(input, errors=None)
1474-
1475- Encode *input * using escape sequences. Similar to how :func: `repr ` on bytes
1476- produces escaped byte values. Returns a tuple of the encoded bytes and
1477- the length consumed.
1478-
1479- .. function :: codecs.escape_decode(input, errors=None)
1480-
1481- Decode *input * from escape sequences back to the original bytes.
1482- Returns a tuple of the decoded bytes and the length consumed.
1483-
14841468.. [#b64 ] In addition to :term: `bytes-like objects <bytes-like object> `,
14851469 ``'base64_codec' `` also accepts ASCII-only instances of :class: `str ` for
14861470 decoding
@@ -1492,6 +1476,36 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
14921476 Restoration of the aliases for the binary transforms.
14931477
14941478
1479+ .. _standalone-codec-functions :
1480+
1481+ Standalone Codec Functions
1482+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
1483+
1484+ The following functions provide encoding and decoding functionality similar to codecs,
1485+ but are not available as named codecs through :func: `codecs.encode ` or :func: `codecs.decode `.
1486+ They are used internally (for example, by :mod: `pickle `) and behave similarly to the
1487+ `string_escape ` codec that was removed in Python 3.
1488+
1489+ .. function :: codecs.escape_encode(input, errors=None)
1490+
1491+ Encode *input * using escape sequences. Similar to how :func: `repr ` on bytes
1492+ produces escaped byte values.
1493+
1494+ *input * must be a :class: `bytes ` object.
1495+
1496+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1497+ object and *length * is the number of bytes consumed.
1498+
1499+ .. function :: codecs.escape_decode(input, errors=None)
1500+
1501+ Decode *input * from escape sequences back to the original bytes.
1502+
1503+ *input * must be a :term: `bytes-like object `.
1504+
1505+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1506+ object and *length * is the number of bytes consumed.
1507+
1508+
14951509.. _text-transforms :
14961510
14971511Text Transforms
0 commit comments