-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Methods are documented on class pages (#10455)
(cherry picked from commit e55389f)
- Loading branch information
1 parent
a8faffb
commit 161cb2e
Showing
4 changed files
with
38 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 17 additions & 27 deletions
44
docs/_templates/autosummary/class_no_inherited_members.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,28 @@ | ||
{# | ||
This is very similar to the default class template, except this one is used | ||
when we don't want to generate any inherited methods. | ||
-#} | ||
{# This is identical to class.rst, except for the filtering in `set wanted_methods`. -#} | ||
|
||
{{ objname | escape | underline }} | ||
|
||
.. currentmodule:: {{ module }} | ||
|
||
.. autoclass:: {{ objname }} | ||
{#- | ||
Avoid having autodoc populate the class with the members we're about to | ||
summarize to avoid duplication. | ||
#} | ||
:no-members: | ||
:show-inheritance: | ||
{# | ||
Methods all get their own separate page, with their names and the first lines | ||
of their docstrings tabulated. | ||
-#} | ||
{% block methods_summary %}{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %}{% if wanted_methods %} | ||
.. rubric:: Methods Defined Here | ||
|
||
.. autosummary:: | ||
:nosignatures: | ||
:toctree: ../stubs/ | ||
{% for item in wanted_methods %} | ||
~{{ name }}.{{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock %} | ||
|
||
{% block attributes_summary %}{% if attributes %} | ||
{% block attributes_summary %} | ||
{% if attributes %} | ||
.. rubric:: Attributes | ||
{# Attributes should all be summarized directly on the same page. -#} | ||
{% for item in attributes %} | ||
{% for item in attributes %} | ||
.. autoattribute:: {{ item }} | ||
{%- endfor %} | ||
{% endif %}{% endblock -%} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock -%} | ||
|
||
{% block methods_summary %} | ||
{% set wanted_methods = (methods | reject('in', inherited_members) | reject('==', '__init__') | list) %} | ||
{% if wanted_methods %} | ||
.. rubric:: Methods | ||
{% for item in wanted_methods %} | ||
.. automethod:: {{ item }} | ||
{%- endfor %} | ||
{% endif %} | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters