mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
refactor: Deprecate unused parameters
This commit is contained in:
parent
b15e3f6639
commit
61b823ad10
4
CHANGES
4
CHANGES
@ -12,8 +12,12 @@ Incompatible changes
|
|||||||
Deprecated
|
Deprecated
|
||||||
----------
|
----------
|
||||||
|
|
||||||
|
* The ``template_dir`` argument of ``sphinx.ext.autosummary.generate.
|
||||||
|
AutosummaryRenderer``
|
||||||
* The ``module`` argument of ``sphinx.ext.autosummary.generate.
|
* The ``module`` argument of ``sphinx.ext.autosummary.generate.
|
||||||
find_autosummary_in_docstring()``
|
find_autosummary_in_docstring()``
|
||||||
|
* The ``template_dir`` argument of ``sphinx.ext.autosummary.generate.
|
||||||
|
generate_autosummary_docs()``
|
||||||
|
|
||||||
Features added
|
Features added
|
||||||
--------------
|
--------------
|
||||||
|
@ -26,12 +26,24 @@ The following is a list of deprecated interfaces.
|
|||||||
- (will be) Removed
|
- (will be) Removed
|
||||||
- Alternatives
|
- Alternatives
|
||||||
|
|
||||||
|
* - The ``template_dir`` argument of
|
||||||
|
``sphinx.ext.autosummary.generate.AutosummaryRenderer``
|
||||||
|
- 3.1
|
||||||
|
- 5.0
|
||||||
|
- N/A
|
||||||
|
|
||||||
* - The ``module`` argument of
|
* - The ``module`` argument of
|
||||||
``sphinx.ext.autosummary.generate.find_autosummary_in_docstring()``
|
``sphinx.ext.autosummary.generate.find_autosummary_in_docstring()``
|
||||||
- 3.0
|
- 3.0
|
||||||
- 5.0
|
- 5.0
|
||||||
- N/A
|
- N/A
|
||||||
|
|
||||||
|
* - The ``template_dir`` argument of
|
||||||
|
``sphinx.ext.autosummary.generate.generate_autosummary_docs()``
|
||||||
|
- 3.1
|
||||||
|
- 5.0
|
||||||
|
- N/A
|
||||||
|
|
||||||
* - ``desc_signature['first']``
|
* - ``desc_signature['first']``
|
||||||
-
|
-
|
||||||
- 3.0
|
- 3.0
|
||||||
|
@ -127,7 +127,11 @@ def _underline(title: str, line: str = '=') -> str:
|
|||||||
class AutosummaryRenderer:
|
class AutosummaryRenderer:
|
||||||
"""A helper class for rendering."""
|
"""A helper class for rendering."""
|
||||||
|
|
||||||
def __init__(self, builder: Builder, template_dir: str) -> None:
|
def __init__(self, builder: Builder, template_dir: str = None) -> None:
|
||||||
|
if template_dir:
|
||||||
|
warnings.warn('template_dir argument for AutosummaryRenderer is deprecated.',
|
||||||
|
RemovedInSphinx50Warning)
|
||||||
|
|
||||||
system_templates_path = [os.path.join(package_dir, 'ext', 'autosummary', 'templates')]
|
system_templates_path = [os.path.join(package_dir, 'ext', 'autosummary', 'templates')]
|
||||||
loader = SphinxTemplateLoader(builder.srcdir,
|
loader = SphinxTemplateLoader(builder.srcdir,
|
||||||
builder.config.templates_path,
|
builder.config.templates_path,
|
||||||
@ -277,6 +281,10 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None,
|
|||||||
else:
|
else:
|
||||||
_warn = logger.warning
|
_warn = logger.warning
|
||||||
|
|
||||||
|
if template_dir:
|
||||||
|
warnings.warn('template_dir argument for generate_autosummary_docs() is deprecated.',
|
||||||
|
RemovedInSphinx50Warning)
|
||||||
|
|
||||||
showed_sources = list(sorted(sources))
|
showed_sources = list(sorted(sources))
|
||||||
if len(showed_sources) > 20:
|
if len(showed_sources) > 20:
|
||||||
showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:]
|
showed_sources = showed_sources[:10] + ['...'] + showed_sources[-10:]
|
||||||
@ -289,7 +297,7 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None,
|
|||||||
if base_path is not None:
|
if base_path is not None:
|
||||||
sources = [os.path.join(base_path, filename) for filename in sources]
|
sources = [os.path.join(base_path, filename) for filename in sources]
|
||||||
|
|
||||||
template = AutosummaryRenderer(builder, template_dir)
|
template = AutosummaryRenderer(builder)
|
||||||
|
|
||||||
# read
|
# read
|
||||||
items = find_autosummary_in_files(sources)
|
items = find_autosummary_in_files(sources)
|
||||||
@ -337,7 +345,6 @@ def generate_autosummary_docs(sources: List[str], output_dir: str = None,
|
|||||||
generate_autosummary_docs(new_files, output_dir=output_dir,
|
generate_autosummary_docs(new_files, output_dir=output_dir,
|
||||||
suffix=suffix, warn=warn, info=info,
|
suffix=suffix, warn=warn, info=info,
|
||||||
base_path=base_path, builder=builder,
|
base_path=base_path, builder=builder,
|
||||||
template_dir=template_dir,
|
|
||||||
imported_members=imported_members, app=app,
|
imported_members=imported_members, app=app,
|
||||||
overwrite=overwrite)
|
overwrite=overwrite)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user