aboutsummaryrefslogtreecommitdiffstats
path: root/contrib/deprecated/python/backports-abc/README.rst
diff options
context:
space:
mode:
authornkozlovskiy <nmk@ydb.tech>2023-10-02 18:57:38 +0300
committernkozlovskiy <nmk@ydb.tech>2023-10-02 19:39:06 +0300
commit6295ef4d23465c11296e898b9dc4524ad9592b5d (patch)
treefc0c852877b2c52f365a1f6ed0710955844338c2 /contrib/deprecated/python/backports-abc/README.rst
parentde63c80b75948ecc13894854514d147840ff8430 (diff)
downloadydb-6295ef4d23465c11296e898b9dc4524ad9592b5d.tar.gz
oss ydb: fix dstool building and test run
Diffstat (limited to 'contrib/deprecated/python/backports-abc/README.rst')
-rw-r--r--contrib/deprecated/python/backports-abc/README.rst46
1 files changed, 46 insertions, 0 deletions
diff --git a/contrib/deprecated/python/backports-abc/README.rst b/contrib/deprecated/python/backports-abc/README.rst
new file mode 100644
index 0000000000..06cf94aefd
--- /dev/null
+++ b/contrib/deprecated/python/backports-abc/README.rst
@@ -0,0 +1,46 @@
+=============
+ABC-Backports
+=============
+
+Usage:
+
+.. code-block:: python
+
+ try:
+ # ABCs live in "collections.abc" in Python >= 3.3
+ from collections.abc import Coroutine, Generator
+ except ImportError:
+ # fall back to import from "backports_abc"
+ from backports_abc import Coroutine, Generator
+
+You can also install the ABCs into the stdlib by calling the ``patch()``
+function:
+
+.. code-block:: python
+
+ import backports_abc
+ backports_abc.patch()
+
+ try:
+ # ABCs live in "collections.abc" in Python >= 3.3
+ from collections.abc import Coroutine, Generator
+ except ImportError:
+ # fall back to import from "collections" in Python <= 3.2
+ from backports_abc import Coroutine, Generator
+
+Currently, ``patch()`` provides the following names if missing:
+
+* ``collections.abc.Generator``
+* ``collections.abc.Awaitable``
+* ``collections.abc.Coroutine``
+* ``inspect.isawaitable(obj)``
+
+All of them are also available directly from the ``backports_abc``
+module namespace.
+
+In Python 2.x and Python 3.2, it patches the ``collections`` module
+instead of the ``collections.abc`` module. Any names that are already
+available when importing this module will not be overwritten.
+
+The names that were previously patched by ``patch()`` can be queried
+through the mapping in ``backports_abc.PATCHED``.