mirror of
https://github.com/python/cpython.git
synced 2025-08-19 08:11:46 +00:00
[3.12] GH-121970: Remove pyspecific `PyDecoratorMixin
` patches (GH-129306) (#129310)
(cherry picked from commit 0ef8d470b7
)
This commit is contained in:
parent
c17d30bf34
commit
53204a11f1
1 changed files with 1 additions and 28 deletions
|
@ -96,32 +96,6 @@ class ImplementationDetail(SphinxDirective):
|
|||
return [pnode]
|
||||
|
||||
|
||||
# Support for documenting decorators
|
||||
|
||||
class PyDecoratorMixin(object):
|
||||
def handle_signature(self, sig, signode):
|
||||
ret = super(PyDecoratorMixin, self).handle_signature(sig, signode)
|
||||
signode.insert(0, addnodes.desc_addname('@', '@'))
|
||||
return ret
|
||||
|
||||
def needs_arglist(self):
|
||||
return False
|
||||
|
||||
|
||||
class PyDecoratorFunction(PyDecoratorMixin, PyFunction):
|
||||
def run(self):
|
||||
# a decorator function is a function after all
|
||||
self.name = 'py:function'
|
||||
return PyFunction.run(self)
|
||||
|
||||
|
||||
# TODO: Use sphinx.domains.python.PyDecoratorMethod when possible
|
||||
class PyDecoratorMethod(PyDecoratorMixin, PyMethod):
|
||||
def run(self):
|
||||
self.name = 'py:method'
|
||||
return PyMethod.run(self)
|
||||
|
||||
|
||||
class PyCoroutineMixin(object):
|
||||
def handle_signature(self, sig, signode):
|
||||
ret = super(PyCoroutineMixin, self).handle_signature(sig, signode)
|
||||
|
@ -360,8 +334,7 @@ def setup(app):
|
|||
app.add_object_type('pdbcommand', 'pdbcmd', '%s (pdb command)', parse_pdb_command)
|
||||
app.add_object_type('monitoring-event', 'monitoring-event', '%s (monitoring event)', parse_monitoring_event)
|
||||
app.add_object_type('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_to_domain('py', 'awaitablefunction', PyAwaitableFunction)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue