mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
bpo-33649: Add a high-level section about Futures; few quick fixes (GH-9403)
Co-authored-by: Elvis Pranskevichus <elvis@magic.io>
This commit is contained in:
parent
a3c88ef12c
commit
471503954a
5 changed files with 148 additions and 45 deletions
|
@ -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}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue