Skip to content

Commit

Permalink
Document special methods in a class e.g. __call__
Browse files Browse the repository at this point in the history
  • Loading branch information
niboshi committed Jun 12, 2017
1 parent 08edaa7 commit 714a07b
Showing 1 changed file with 37 additions and 3 deletions.
40 changes: 37 additions & 3 deletions docs/source/_templates/autosummary/class.rst
Original file line number Diff line number Diff line change
@@ -1,13 +1,47 @@
{% extends "!autosummary/class.rst" %}
{{ fullname }}
{{ underline }}

{% block methods %} {% if methods %}
.. currentmodule:: {{ module }}

.. autoclass:: {{ objname }}

..
Methods
{% block methods %}

.. rubric:: Methods

..
Special methods
{% for item in ('__call__', '__enter__', '__exit__') %}
{% if item in all_methods %}
.. automethod:: {{ item }}
{% endif %}
{%- endfor %}

..
Ordinary methods
{% for item in methods %}
{% if item not in ('__init__',) %}
.. automethod:: {{ item }}
{% endif %}
{%- endfor %}
{% endif %} {% endblock %}

..
Special methods
{% for item in ('__eq__', '__ne__', '__lt__', '__le__', '__gt__', '__ge__', '__nonzero__', '__bool__') %}
{% if item in all_methods %}
.. automethod:: {{ item }}
{% endif %}
{%- endfor %}
{% endblock %}

..
Atributes
{% block attributes %} {% if attributes %}

Expand Down

0 comments on commit 714a07b

Please sign in to comment.