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 @@ -1483,6 +1483,36 @@ to :class:`bytes` mappings. They are not supported by :meth:`bytes.decode`
1483
1483
Restoration of the aliases for the binary transforms.
1484
1484
1485
1485
1486
+ .. _standalone-codec-functions :
1487
+
1488
+ Standalone Codec Functions
1489
+ ^^^^^^^^^^^^^^^^^^^^^^^^^^
1490
+
1491
+ The following functions provide encoding and decoding functionality similar to codecs,
1492
+ but are not available as named codecs through :func: `codecs.encode ` or :func: `codecs.decode `.
1493
+ They are used internally (for example, by :mod: `pickle `) and behave similarly to the
1494
+ ``string_escape `` codec that was removed in Python 3.
1495
+
1496
+ .. function :: codecs.escape_encode(input, errors=None)
1497
+
1498
+ Encode *input * using escape sequences. Similar to how :func: `repr ` on bytes
1499
+ produces escaped byte values.
1500
+
1501
+ *input * must be a :class: `bytes ` object.
1502
+
1503
+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1504
+ object and *length * is the number of bytes consumed.
1505
+
1506
+ .. function :: codecs.escape_decode(input, errors=None)
1507
+
1508
+ Decode *input * from escape sequences back to the original bytes.
1509
+
1510
+ *input * must be a :term: `bytes-like object `.
1511
+
1512
+ Returns a tuple ``(output, length) `` where *output * is a :class: `bytes `
1513
+ object and *length * is the number of bytes consumed.
1514
+
1515
+
1486
1516
.. _text-transforms :
1487
1517
1488
1518
Text Transforms
You can’t perform that action at this time.
0 commit comments