File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1472,6 +1472,36 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
14721472 Restoration of the aliases for the binary transforms.
14731473
14741474
1475+ .. _standalone-codec-functions :
1476+
1477+ Standalone Codec Functions
1478+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
1479+
1480+ The following functions provide encoding and decoding functionality similar to codecs,
1481+ but are not available as named codecs through :func: `codecs.encode ` or :func: `codecs.decode `.
1482+ They are used internally (for example, by :mod: `pickle `) and behave similarly to the
1483+ ``string_escape `` codec that was removed in Python 3.
1484+
1485+ .. function :: codecs.escape_encode(input, errors=None)
1486+
1487+ Encode *input * using escape sequences. Similar to how :func: `repr ` on bytes
1488+ produces escaped byte values.
1489+
1490+ *input * must be a :class: `bytes ` object.
1491+
1492+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1493+ object and *length * is the number of bytes consumed.
1494+
1495+ .. function :: codecs.escape_decode(input, errors=None)
1496+
1497+ Decode *input * from escape sequences back to the original bytes.
1498+
1499+ *input * must be a :term: `bytes-like object `.
1500+
1501+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1502+ object and *length * is the number of bytes consumed.
1503+
1504+
14751505.. _text-transforms :
14761506
14771507Text Transforms
You can’t perform that action at this time.
0 commit comments