diff --git a/docs/_templates/autosummary/analysis.rst b/docs/_templates/autosummary/analysis.rst index 222df215af..d8811523ac 100644 --- a/docs/_templates/autosummary/analysis.rst +++ b/docs/_templates/autosummary/analysis.rst @@ -17,11 +17,9 @@ .. rubric:: Attributes - .. autosummary:: - :toctree: ../stubs/ {% for item in all_attributes %} {%- if not item.startswith('_') %} - {{ name }}.{{ item }} + .. autoattribute:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% endif %} @@ -32,16 +30,14 @@ .. rubric:: Methods - .. autosummary:: - :toctree: ../stubs/ {% for item in all_methods %} {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% for item in inherited_members %} {%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} diff --git a/docs/_templates/autosummary/class.rst b/docs/_templates/autosummary/class.rst index f6e8a53f58..fd25d5706e 100644 --- a/docs/_templates/autosummary/class.rst +++ b/docs/_templates/autosummary/class.rst @@ -12,58 +12,37 @@ :no-inherited-members: :no-special-members: - {% block attributes_summary %} - {% if attributes %} +{% block attributes_summary %} - {# This counter lets us only render the heading if there's at least - one valid entry. #} - {% set count = namespace(value=0) %} + {% set wanted_attributes = [] %} + {% for item in attributes%} + {%- if not item.startswith('_') %} + {% set _ = wanted_attributes.append(item)%} + {%- endif -%} + {%- endfor %} - {% for item in attributes %} - {% if not item.startswith('_') %} - {% set count.value = count.value + 1 %} - {% if count.value == 1 %} + {% if wanted_attributes %} .. rubric:: Attributes - - .. autosummary:: - :toctree: ../stubs/ - {% endif %} - - {{ name }}.{{ item }} - {% endif %} - {% endfor %} + {% for item in wanted_attributes %} + .. autoattribute:: {{ name }}.{{ item }} + {%- endfor %} {% endif %} - {% endblock %} +{% endblock %} - {% block methods_summary %} - {% if methods %} +{% block methods_summary %} - {% set count = namespace(value=0) %} + {% set wanted_methods = [] %} {% for item in all_methods %} - {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {% set count.value = count.value + 1 %} - {% if count.value == 1 %} - .. rubric:: Methods - - .. autosummary:: - :toctree: ../stubs/ - {% endif %} - {{ name }}.{{ item }} + {% set _ = wanted_methods.append(item)%} {%- endif -%} {%- endfor %} - {% for item in inherited_members %} - {%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {% set count.value = count.value + 1 %} - {% if count.value == 1 %} - .. rubric:: Methods - .. autosummary:: - :toctree: ../stubs/ - {% endif %} - {{ name }}.{{ item }} - {%- endif -%} + {% if wanted_methods%} + .. rubric:: Methods + {% for item in wanted_methods %} + .. automethod:: {{ name }}.{{ item }} {%- endfor %} {% endif %} - {% endblock %} +{% endblock %} \ No newline at end of file diff --git a/docs/_templates/autosummary/class_no_inherited_members.rst b/docs/_templates/autosummary/class_no_inherited_members.rst new file mode 100644 index 0000000000..9e3b9339c9 --- /dev/null +++ b/docs/_templates/autosummary/class_no_inherited_members.rst @@ -0,0 +1,52 @@ +{# This is identical to class.rst, except for the filtering of the inherited_members. -#} + +{% if referencefile %} +.. include:: {{ referencefile }} +{% endif %} + +{{ objname }} +{{ underline }} + +.. currentmodule:: {{ module }} + +.. autoclass:: {{ objname }} + :no-members: + :no-inherited-members: + :no-special-members: + +{% block attributes_summary %} + + {% set wanted_attributes = [] %} + {% for item in attributes%} + {%- if not item.startswith('_') %} + {% set _ = wanted_attributes.append(item)%} + {%- endif -%} + {%- endfor %} + + {% if wanted_attributes%} + .. rubric:: Attributes + {% for item in wanted_attributes %} + .. autoattribute:: {{ name }}.{{ item }} + {%- endfor %} + {% endif %} +{% endblock %} + +{% block methods_summary %} + + {% set wanted_methods = [] %} + {% for item in all_methods %} + {%- if item not in inherited_members %} + {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} + {% set _ = wanted_methods.append(item)%} + {%- endif -%} + {%- endif -%} + {%- endfor %} + + {% if wanted_methods %} + .. rubric:: Methods + {% for item in wanted_methods %} + .. automethod:: {{ name }}.{{ item }} + {%- endfor %} + + {% endif %} +{% endblock %} \ No newline at end of file diff --git a/docs/_templates/autosummary/drawer.rst b/docs/_templates/autosummary/drawer.rst index a17d57f6da..03501a5cd0 100644 --- a/docs/_templates/autosummary/drawer.rst +++ b/docs/_templates/autosummary/drawer.rst @@ -17,11 +17,9 @@ .. rubric:: Attributes - .. autosummary:: - :toctree: ../stubs/ {% for item in all_attributes %} {%- if not item.startswith('_') %} - {{ name }}.{{ item }} + .. autoattribute:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% endif %} @@ -32,16 +30,14 @@ .. rubric:: Methods - .. autosummary:: - :toctree: ../stubs/ {% for item in all_methods %} {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% for item in inherited_members %} {%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} diff --git a/docs/_templates/autosummary/experiment.rst b/docs/_templates/autosummary/experiment.rst index 01800ea10b..0de1a1c3c3 100644 --- a/docs/_templates/autosummary/experiment.rst +++ b/docs/_templates/autosummary/experiment.rst @@ -17,11 +17,9 @@ .. rubric:: Attributes - .. autosummary:: - :toctree: ../stubs/ {% for item in all_attributes %} {%- if not item.startswith('_') %} - {{ name }}.{{ item }} + .. autoattribute:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% endif %} @@ -32,16 +30,14 @@ .. rubric:: Methods - .. autosummary:: - :toctree: ../stubs/ {% for item in all_methods %} {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% for item in inherited_members %} {%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} diff --git a/docs/_templates/autosummary/plotter.rst b/docs/_templates/autosummary/plotter.rst index 83e19addbe..0b5cdeefaa 100644 --- a/docs/_templates/autosummary/plotter.rst +++ b/docs/_templates/autosummary/plotter.rst @@ -17,11 +17,9 @@ .. rubric:: Attributes - .. autosummary:: - :toctree: ../stubs/ {% for item in all_attributes %} {%- if not item.startswith('_') %} - {{ name }}.{{ item }} + .. autoattribute:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% endif %} @@ -32,17 +30,14 @@ .. rubric:: Methods - .. autosummary:: - :toctree: ../stubs/ - {% for item in all_methods %} {%- if not item.startswith('_') or item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %} {% for item in inherited_members %} {%- if item in ['__call__', '__mul__', '__getitem__', '__len__'] %} - {{ name }}.{{ item }} + .. automethod:: {{ name }}.{{ item }} {%- endif -%} {%- endfor %}