Skip to content

Commit a35a47a

Browse files
committed
Add more autosummary templates
1 parent 488bdb5 commit a35a47a

File tree

7 files changed

+124
-47
lines changed

7 files changed

+124
-47
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:orphan:
2+
3+
{{ fullname | escape | underline}}
4+
5+
.. currentmodule:: {{ module }}
6+
7+
attribute
8+
9+
.. auto{{ objtype }}:: {{ fullname | replace("dpnp.", "dpnp::") }}
10+
11+
{# In the fullname (e.g. ``dpnp.ndarray.methodname``), the module name is
12+
ambiguous. Using a ``::`` separator (e.g. ``dpnp::ndarray.methodname``)
13+
specifies ``dpnp`` as the module name. #}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{% if objtype == 'property' %}
2+
:orphan:
3+
{% endif %}
4+
5+
{{ fullname | escape | underline}}
6+
7+
.. currentmodule:: {{ module }}
8+
9+
{% if objtype == 'property' %}
10+
property
11+
{% endif %}
12+
13+
.. auto{{ objtype }}:: {{ fullname | replace("dpnp.", "dpnp::") }}
14+
15+
{# In the fullname (e.g. ``dpnp.ndarray.methodname``), the module name is
16+
ambiguous. Using a ``::`` separator (e.g. ``dpnp::ndarray.methodname``)
17+
specifies ``dpnp`` as the module name. #}
Lines changed: 21 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,27 @@
1-
{{ fullname }}
2-
{{ underline }}
3-
4-
.. currentmodule:: {{ module }}
5-
6-
.. autoclass:: {{ objname }}
7-
8-
..
9-
Methods
1+
{% extends "!autosummary/class.rst" %}
102

113
{% block methods %}
12-
13-
.. rubric:: Methods
14-
15-
..
16-
Special methods
17-
18-
{% for item in ('__getitem__', '__setitem__', '__len__', '__next__', '__iter__') %}
19-
{% if item in all_methods or item in all_attributes %}
20-
.. automethod:: {{ item }}
4+
{% if methods %}
5+
.. HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages.
6+
.. autosummary::
7+
:toctree:
8+
{% for item in all_methods %}
9+
{%- if not item.startswith('_') or item in ['__call__'] %}
10+
{{ name }}.{{ item }}
11+
{%- endif -%}
12+
{%- endfor %}
2113
{% endif %}
22-
{%- endfor %}
23-
24-
..
25-
Ordinary methods
26-
27-
{% for item in methods %}
28-
{% if item not in ('__init__',) %}
29-
.. automethod:: {{ item }}
30-
{% endif %}
31-
{%- endfor %}
32-
33-
..
34-
Special methods
14+
{% endblock %}
3515

36-
{% for item in ('__eq__', '__ne__', '__lt__', '__le__', '__gt__', '__ge__') %}
37-
{% if item in all_methods %}
38-
.. automethod:: {{ item }}
16+
{% block attributes %}
17+
{% if attributes %}
18+
.. HACK -- the point here is that we don't want this to appear in the output, but the autosummary should still generate the pages.
19+
.. autosummary::
20+
:toctree:
21+
{% for item in all_attributes %}
22+
{%- if not item.startswith('_') %}
23+
{{ name }}.{{ item }}
24+
{%- endif -%}
25+
{%- endfor %}
3926
{% endif %}
40-
{%- endfor %}
4127
{% endblock %}
42-
43-
..
44-
Attributes
45-
46-
{% block attributes %} {% if attributes %}
47-
48-
.. rubric:: Attributes
49-
50-
{% for item in attributes %}
51-
.. autoattribute:: {{ item }}
52-
{%- endfor %}
53-
{% endif %} {% endblock %}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:orphan:
2+
3+
{{ fullname | escape | underline}}
4+
5+
.. currentmodule:: {{ module }}
6+
7+
member
8+
9+
.. auto{{ objtype }}:: {{ fullname | replace("dpnp.", "dpnp::") }}
10+
11+
{# In the fullname (e.g. ``dpnp.ndarray.methodname``), the module name is
12+
ambiguous. Using a ``::`` separator (e.g. ``dpnp::ndarray.methodname``)
13+
specifies ``dpnp`` as the module name. #}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
:orphan:
2+
3+
{{ fullname | escape | underline}}
4+
5+
.. currentmodule:: {{ module }}
6+
7+
method
8+
9+
.. auto{{ objtype }}:: {{ fullname | replace("dpnp.", "dpnp::") }}
10+
11+
{# In the fullname (e.g. ``dpnp.ndarray.methodname``), the module name is
12+
ambiguous. Using a ``::`` separator (e.g. ``dpnp::ndarray.methodname``)
13+
specifies ``dpnp`` as the module name. #}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{{ fullname | escape | underline}}
2+
3+
.. automodule:: {{ fullname }}
4+
5+
{% block docstring %}
6+
{% endblock %}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
{% extends "!autosummary/module.rst" %}
2+
3+
{# This file is almost the same as the default, but adds :toctree: to the
4+
autosummary directives. The original can be found at
5+
``sphinx/ext/autosummary/templates/autosummary/module.rst``. #}
6+
7+
{% block attributes %}
8+
{% if attributes %}
9+
.. rubric:: Module Attributes
10+
11+
.. autosummary::
12+
:toctree:
13+
{% for item in attributes %}
14+
{{ item }}
15+
{%- endfor %}
16+
{% endif %}
17+
{% endblock %}
18+
19+
{% block functions %}
20+
{% if functions %}
21+
.. rubric:: Functions
22+
23+
.. autosummary::
24+
:toctree:
25+
{% for item in functions %}
26+
{{ item }}
27+
{%- endfor %}
28+
{% endif %}
29+
{% endblock %}
30+
31+
{% block classes %}
32+
{% if classes %}
33+
.. rubric:: Classes
34+
35+
.. autosummary::
36+
:toctree:
37+
{% for item in classes %}
38+
{{ item }}
39+
{%- endfor %}
40+
{% endif %}
41+
{% endblock %}

0 commit comments

Comments
 (0)