summaryrefslogtreecommitdiffstats
path: root/Doc/tools/extensions
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2018-09-18 21:55:44 (GMT)
committerGitHub <noreply@github.com>2018-09-18 21:55:44 (GMT)
commit471503954a91d86cf04228c38134108c67a263b0 (patch)
tree25ccace31572e066077eb9a2b343b986e252f4e1 /Doc/tools/extensions
parenta3c88ef12c7b8993912750b56a1e095652fe47c0 (diff)
downloadcpython-471503954a91d86cf04228c38134108c67a263b0.zip
cpython-471503954a91d86cf04228c38134108c67a263b0.tar.gz
cpython-471503954a91d86cf04228c38134108c67a263b0.tar.bz2
bpo-33649: Add a high-level section about Futures; few quick fixes (GH-9403)
Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
Diffstat (limited to 'Doc/tools/extensions')
-rw-r--r--Doc/tools/extensions/pyspecific.py21
1 files changed, 21 insertions, 0 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index b6618f9..8036daa 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -163,6 +163,13 @@ class PyCoroutineMixin(object):
return ret
+class PyAwaitableMixin(object):
+ def handle_signature(self, sig, signode):
+ ret = super(PyAwaitableMixin, self).handle_signature(sig, signode)
+ signode.insert(0, addnodes.desc_annotation('awaitable ', 'awaitable '))
+ return ret
+
+
class PyCoroutineFunction(PyCoroutineMixin, PyModulelevel):
def run(self):
self.name = 'py:function'
@@ -175,6 +182,18 @@ class PyCoroutineMethod(PyCoroutineMixin, PyClassmember):
return PyClassmember.run(self)
+class PyAwaitableFunction(PyAwaitableMixin, PyClassmember):
+ def run(self):
+ self.name = 'py:function'
+ return PyClassmember.run(self)
+
+
+class PyAwaitableMethod(PyAwaitableMixin, PyClassmember):
+ def run(self):
+ self.name = 'py:method'
+ return PyClassmember.run(self)
+
+
class PyAbstractMethod(PyClassmember):
def handle_signature(self, sig, signode):
@@ -394,6 +413,8 @@ def setup(app):
app.add_directive_to_domain('py', 'decoratormethod', PyDecoratorMethod)
app.add_directive_to_domain('py', 'coroutinefunction', PyCoroutineFunction)
app.add_directive_to_domain('py', 'coroutinemethod', PyCoroutineMethod)
+ app.add_directive_to_domain('py', 'awaitablefunction', PyAwaitableFunction)
+ app.add_directive_to_domain('py', 'awaitablemethod', PyAwaitableMethod)
app.add_directive_to_domain('py', 'abstractmethod', PyAbstractMethod)
app.add_directive('miscnews', MiscNews)
return {'version': '1.0', 'parallel_read_safe': True}