bpo-35293: Remove RemovedInSphinx40Warning (GH-22198)
* bpo-35293: Remove RemovedInSphinx40Warning
* Update Misc/NEWS.d/next/Documentation/2020-09-12-17-37-13.bpo-35293._cOwPD.rst
Co-authored-by: Victor Stinner <vstinner@python.org>
* bpo-35293: Apply Victor's review
Co-authored-by: Victor Stinner <vstinner@python.org>
(cherry picked from commit 6595cb0af4
)
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
This commit is contained in:
parent
c5cddc17b5
commit
b7cdea8f08
|
@ -31,7 +31,12 @@ from sphinx.util import status_iterator, logging
|
||||||
from sphinx.util.nodes import split_explicit_title
|
from sphinx.util.nodes import split_explicit_title
|
||||||
from sphinx.writers.text import TextWriter, TextTranslator
|
from sphinx.writers.text import TextWriter, TextTranslator
|
||||||
from sphinx.writers.latex import LaTeXTranslator
|
from sphinx.writers.latex import LaTeXTranslator
|
||||||
from sphinx.domains.python import PyModulelevel, PyClassmember
|
|
||||||
|
try:
|
||||||
|
from sphinx.domains.python import PyFunction, PyMethod
|
||||||
|
except ImportError:
|
||||||
|
from sphinx.domains.python import PyClassmember as PyMethod
|
||||||
|
from sphinx.domains.python import PyModulelevel as PyFunction
|
||||||
|
|
||||||
# Support for checking for suspicious markup
|
# Support for checking for suspicious markup
|
||||||
|
|
||||||
|
@ -238,17 +243,18 @@ class PyDecoratorMixin(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
class PyDecoratorFunction(PyDecoratorMixin, PyModulelevel):
|
class PyDecoratorFunction(PyDecoratorMixin, PyFunction):
|
||||||
def run(self):
|
def run(self):
|
||||||
# a decorator function is a function after all
|
# a decorator function is a function after all
|
||||||
self.name = 'py:function'
|
self.name = 'py:function'
|
||||||
return PyModulelevel.run(self)
|
return PyFunction.run(self)
|
||||||
|
|
||||||
|
|
||||||
class PyDecoratorMethod(PyDecoratorMixin, PyClassmember):
|
# TODO: Use sphinx.domains.python.PyDecoratorMethod when possible
|
||||||
|
class PyDecoratorMethod(PyDecoratorMixin, PyMethod):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.name = 'py:method'
|
self.name = 'py:method'
|
||||||
return PyClassmember.run(self)
|
return PyMethod.run(self)
|
||||||
|
|
||||||
|
|
||||||
class PyCoroutineMixin(object):
|
class PyCoroutineMixin(object):
|
||||||
|
@ -265,31 +271,31 @@ class PyAwaitableMixin(object):
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
class PyCoroutineFunction(PyCoroutineMixin, PyModulelevel):
|
class PyCoroutineFunction(PyCoroutineMixin, PyFunction):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.name = 'py:function'
|
self.name = 'py:function'
|
||||||
return PyModulelevel.run(self)
|
return PyFunction.run(self)
|
||||||
|
|
||||||
|
|
||||||
class PyCoroutineMethod(PyCoroutineMixin, PyClassmember):
|
class PyCoroutineMethod(PyCoroutineMixin, PyMethod):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.name = 'py:method'
|
self.name = 'py:method'
|
||||||
return PyClassmember.run(self)
|
return PyMethod.run(self)
|
||||||
|
|
||||||
|
|
||||||
class PyAwaitableFunction(PyAwaitableMixin, PyClassmember):
|
class PyAwaitableFunction(PyAwaitableMixin, PyFunction):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.name = 'py:function'
|
self.name = 'py:function'
|
||||||
return PyClassmember.run(self)
|
return PyFunction.run(self)
|
||||||
|
|
||||||
|
|
||||||
class PyAwaitableMethod(PyAwaitableMixin, PyClassmember):
|
class PyAwaitableMethod(PyAwaitableMixin, PyMethod):
|
||||||
def run(self):
|
def run(self):
|
||||||
self.name = 'py:method'
|
self.name = 'py:method'
|
||||||
return PyClassmember.run(self)
|
return PyMethod.run(self)
|
||||||
|
|
||||||
|
|
||||||
class PyAbstractMethod(PyClassmember):
|
class PyAbstractMethod(PyMethod):
|
||||||
|
|
||||||
def handle_signature(self, sig, signode):
|
def handle_signature(self, sig, signode):
|
||||||
ret = super(PyAbstractMethod, self).handle_signature(sig, signode)
|
ret = super(PyAbstractMethod, self).handle_signature(sig, signode)
|
||||||
|
@ -299,7 +305,7 @@ class PyAbstractMethod(PyClassmember):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
self.name = 'py:method'
|
self.name = 'py:method'
|
||||||
return PyClassmember.run(self)
|
return PyMethod.run(self)
|
||||||
|
|
||||||
|
|
||||||
# Support for documenting version of removal in deprecations
|
# Support for documenting version of removal in deprecations
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Fix RemovedInSphinx40Warning when building the documentation. Patch by Dong-hee Na.
|
Loading…
Reference in New Issue