summaryrefslogtreecommitdiffstats
path: root/Doc/tools
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2015-12-08 10:15:19 (GMT)
committerBerker Peksag <berker.peksag@gmail.com>2015-12-08 10:15:19 (GMT)
commit2e7fca8e481a6ae41fc5a85c2cf8ecb213cc680c (patch)
treeb2375dbd2014b4521a7ac948e008c0d581acf239 /Doc/tools
parent2300bf29e69ec9ecee563134f8cdfdab93b2a7c0 (diff)
parent6e9d2e687b78e9c43e95666c00f721803c9fcba4 (diff)
downloadcpython-2e7fca8e481a6ae41fc5a85c2cf8ecb213cc680c.zip
cpython-2e7fca8e481a6ae41fc5a85c2cf8ecb213cc680c.tar.gz
cpython-2e7fca8e481a6ae41fc5a85c2cf8ecb213cc680c.tar.bz2
Issue #21240: Add an abstractmethod directive to mark abstract methods in the docs more explicitly
Diffstat (limited to 'Doc/tools')
-rw-r--r--Doc/tools/extensions/pyspecific.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py
index 9b78184..7986017 100644
--- a/Doc/tools/extensions/pyspecific.py
+++ b/Doc/tools/extensions/pyspecific.py
@@ -164,6 +164,19 @@ class PyCoroutineMethod(PyCoroutineMixin, PyClassmember):
return PyClassmember.run(self)
+class PyAbstractMethod(PyClassmember):
+
+ def handle_signature(self, sig, signode):
+ ret = super(PyAbstractMethod, self).handle_signature(sig, signode)
+ signode.insert(0, addnodes.desc_annotation('abstractmethod ',
+ 'abstractmethod '))
+ return ret
+
+ def run(self):
+ self.name = 'py:method'
+ return PyClassmember.run(self)
+
+
# Support for documenting version of removal in deprecations
class DeprecatedRemoved(Directive):
@@ -368,5 +381,6 @@ 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', 'abstractmethod', PyAbstractMethod)
app.add_directive('miscnews', MiscNews)
return {'version': '1.0', 'parallel_read_safe': True}