summaryrefslogtreecommitdiffstats
path: root/Doc/tools/extensions/pyspecific.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2015-02-12 21:49:45 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2015-02-12 21:49:45 (GMT)
commit866ca88f2d86e09a2b16fe7a9ff6d3f8ae13e672 (patch)
treeabaa8c4d19feb29a904b01cdb54ac5190b21960c /Doc/tools/extensions/pyspecific.py
parentcf40a9e640953111c9b5fa3d92477853e3dd08fd (diff)
parentbdd574d09a834f4b9935d91fe9d16a0d4a56d846 (diff)
downloadcpython-866ca88f2d86e09a2b16fe7a9ff6d3f8ae13e672.zip
cpython-866ca88f2d86e09a2b16fe7a9ff6d3f8ae13e672.tar.gz
cpython-866ca88f2d86e09a2b16fe7a9ff6d3f8ae13e672.tar.bz2
Merge 3.4 (asyncio doc)
Diffstat (limited to 'Doc/tools/extensions/pyspecific.py')
-rw-r--r--Doc/tools/extensions/pyspecific.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index 41c25bc..b4ec6ee 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -145,6 +145,30 @@ class PyDecoratorMethod(PyDecoratorMixin, PyClassmember):
return PyClassmember.run(self)
+class PyCoroutineMixin(object):
+ def handle_signature(self, sig, signode):
+ ret = super(PyCoroutineMixin, self).handle_signature(sig, signode)
+# signode.insert(0, addnodes.desc_addname('coroutine ', 'coroutine '))
+ signode.insert(0, addnodes.desc_annotation('coroutine ', 'coroutine '))
+ return ret
+
+ def needs_arglist(self):
+ return False
+
+
+class PyCoroutineFunction(PyCoroutineMixin, PyModulelevel):
+ def run(self):
+ # a decorator function is a function after all
+ self.name = 'py:function'
+ return PyModulelevel.run(self)
+
+
+class PyCoroutineMethod(PyCoroutineMixin, PyClassmember):
+ def run(self):
+ self.name = 'py:method'
+ return PyClassmember.run(self)
+
+
# Support for documenting version of removal in deprecations
class DeprecatedRemoved(Directive):
@@ -347,5 +371,7 @@ def setup(app):
app.add_description_unit('2to3fixer', '2to3fixer', '%s (2to3 fixer)')
app.add_directive_to_domain('py', 'decorator', PyDecoratorFunction)
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('miscnews', MiscNews)
return {'version': '1.0', 'parallel_read_safe': True}