mirror of
https://github.com/python/cpython.git
synced 2025-09-24 17:33:29 +00:00
[3.13] gh-121970: Replace .. coroutine{method,function}
with :async:
(GH-130448) (#130465)
(cherry picked from commit 5ec4bf86b7
)
Co-authored-by: sobolevn <mail@sobolevn.me>
Co-authored-by: Adam Turner <9087854+aa-turner@users.noreply.github.com>
This commit is contained in:
parent
2412c914ef
commit
c68a8722be
10 changed files with 197 additions and 150 deletions
|
@ -71,13 +71,6 @@ def gh_issue_role(typ, rawtext, text, lineno, inliner, options={}, content=[]):
|
|||
return [refnode], []
|
||||
|
||||
|
||||
class PyCoroutineMixin(object):
|
||||
def handle_signature(self, sig, signode):
|
||||
ret = super(PyCoroutineMixin, self).handle_signature(sig, signode)
|
||||
signode.insert(0, addnodes.desc_annotation('coroutine ', 'coroutine '))
|
||||
return ret
|
||||
|
||||
|
||||
class PyAwaitableMixin(object):
|
||||
def handle_signature(self, sig, signode):
|
||||
ret = super(PyAwaitableMixin, self).handle_signature(sig, signode)
|
||||
|
@ -85,18 +78,6 @@ class PyAwaitableMixin(object):
|
|||
return ret
|
||||
|
||||
|
||||
class PyCoroutineFunction(PyCoroutineMixin, PyFunction):
|
||||
def run(self):
|
||||
self.name = 'py:function'
|
||||
return PyFunction.run(self)
|
||||
|
||||
|
||||
class PyCoroutineMethod(PyCoroutineMixin, PyMethod):
|
||||
def run(self):
|
||||
self.name = 'py:method'
|
||||
return PyMethod.run(self)
|
||||
|
||||
|
||||
class PyAwaitableFunction(PyAwaitableMixin, PyFunction):
|
||||
def run(self):
|
||||
self.name = 'py:function'
|
||||
|
@ -254,8 +235,6 @@ def setup(app):
|
|||
app.add_object_type('opcode', 'opcode', '%s (opcode)', parse_opcode_signature)
|
||||
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_directive_to_domain('py', 'coroutinefunction', PyCoroutineFunction)
|
||||
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.connect('env-check-consistency', patch_pairindextypes)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue