Deprecate: The module argument of find_autosummary_in_docstring()

This commit is contained in:
Takeshi KOMIYA 2020-03-25 00:43:56 +09:00
parent 8cc0b890bd
commit 53f0d4e646
3 changed files with 14 additions and 1 deletions

View File

@ -10,6 +10,9 @@ Incompatible changes
Deprecated
----------
* The ``module`` argument of ``sphinx.ext.autosummary.generate.
find_autosummary_in_docstring()``
Features added
--------------

View File

@ -26,6 +26,12 @@ The following is a list of deprecated interfaces.
- (will be) Removed
- Alternatives
* - The ``module`` argument of
``sphinx.ext.autosummary.generate.find_autosummary_in_docstring()``
- 3.0
- 5.0
- N/A
* - ``desc_signature['first']``
-
- 3.0

View File

@ -33,7 +33,7 @@ import sphinx.locale
from sphinx import __display_version__
from sphinx import package_dir
from sphinx.builders import Builder
from sphinx.deprecation import RemovedInSphinx40Warning
from sphinx.deprecation import RemovedInSphinx40Warning, RemovedInSphinx50Warning
from sphinx.ext.autodoc import Documenter
from sphinx.ext.autosummary import import_by_name, get_documenter
from sphinx.jinja2glue import BuiltinTemplateLoader
@ -332,6 +332,10 @@ def find_autosummary_in_docstring(name: str, module: str = None, filename: str =
See `find_autosummary_in_lines`.
"""
if module:
warnings.warn('module argument for find_autosummary_in_docstring() is deprecated.',
RemovedInSphinx50Warning)
try:
real_name, obj, parent, modname = import_by_name(name)
lines = pydoc.getdoc(obj).splitlines()