GH-121970: Replace custom abstract method directive with the `:abstract:` option (#129311)

This commit is contained in:
Adam Turner 2025-02-22 01:53:57 +00:00 committed by GitHub
parent 8e96adf453
commit 30e892473e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 66 additions and 47 deletions

View file

@ -103,19 +103,6 @@ class PyAwaitableMethod(PyAwaitableMixin, PyMethod):
return PyMethod.run(self)
class PyAbstractMethod(PyMethod):
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 PyMethod.run(self)
# Support for documenting Opcodes
opcode_sig_re = re.compile(r'(\w+(?:\+\d)?)(?:\s*\((.*)\))?')
@ -201,6 +188,5 @@ def setup(app):
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.connect('env-check-consistency', patch_pairindextypes)
return {'version': '1.0', 'parallel_read_safe': True}