diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2015-12-08 10:14:50 (GMT) |
---|---|---|
committer | Berker Peksag <berker.peksag@gmail.com> | 2015-12-08 10:14:50 (GMT) |
commit | 6e9d2e687b78e9c43e95666c00f721803c9fcba4 (patch) | |
tree | 2b0ab1da50c777375b3754f13c9cb2b4d0545b93 /Doc/tools | |
parent | 45be8d67be0083c923ca31e4803de861177a2383 (diff) | |
download | cpython-6e9d2e687b78e9c43e95666c00f721803c9fcba4.zip cpython-6e9d2e687b78e9c43e95666c00f721803c9fcba4.tar.gz cpython-6e9d2e687b78e9c43e95666c00f721803c9fcba4.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.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Doc/tools/extensions/pyspecific.py b/Doc/tools/extensions/pyspecific.py index d44b052..6311283 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} |