class.rst 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {% if obj.display %}
  2. .. py:{{ obj.type }}:: {{ obj.short_name }}{% if obj.args %}({{ obj.args }}){% endif %}
  3. {% if obj.bases %}
  4. {% if "show-inheritance" in autoapi_options %}
  5. Bases: {% for base in obj.bases %}:class:`{{ base }}`{% if not loop.last %}, {% endif %}{% endfor %}
  6. {% endif %}
  7. {% if "show-inheritance-diagram" in autoapi_options and obj.bases != ["object"] %}
  8. .. autoapi-inheritance-diagram:: {{ obj.obj["full_name"] }}
  9. :parts: 1
  10. {% if "private-members" in autoapi_options %}:private-bases:{% endif %}
  11. {% endif %}
  12. {% endif %}
  13. {% if obj.docstring %}
  14. {{ obj.docstring|prepare_docstring|indent(3) }}
  15. {% endif %}
  16. {% if "inherited-members" in autoapi_options %}
  17. {% set visible_classes = obj.classes|selectattr("display")|list %}
  18. {% else %}
  19. {% set visible_classes = obj.classes|rejectattr("inherited")|selectattr("display")|list %}
  20. {% endif %}
  21. {% for klass in visible_classes %}
  22. {{ klass.rendered|indent(3) }}
  23. {% endfor %}
  24. {% if "inherited-members" in autoapi_options %}
  25. {% set visible_attributes = obj.attributes|selectattr("display")|list %}
  26. {% else %}
  27. {% set visible_attributes = obj.attributes|rejectattr("inherited")|selectattr("display")|list %}
  28. {% endif %}
  29. {% for attribute in visible_attributes %}
  30. {{ attribute.rendered|indent(3) }}
  31. {% endfor %}
  32. {% if "inherited-members" in autoapi_options %}
  33. {% set visible_methods = obj.methods|selectattr("display")|list %}
  34. {% else %}
  35. {% set visible_methods = obj.methods|rejectattr("inherited")|selectattr("display")|list %}
  36. {% endif %}
  37. {% for method in visible_methods %}
  38. {{ method.rendered|indent(3) }}
  39. {% endfor %}
  40. {% endif %}