{% if not obj.display %}
:orphan:
{% endif %}

:mod:`{{ obj.name }}`
======={{ "=" * obj.name|length }}

.. py:module:: {{ obj.name }}

{% if obj.docstring %}
.. autoapi-nested-parse::

   {{ obj.docstring|prepare_docstring|indent(3) }}
{% endif %}

{% block subpackages %}
{% set visible_subpackages = obj.subpackages|selectattr("display")|list %}
{% if visible_subpackages %}
Subpackages
-----------
.. toctree::
   :titlesonly:
   :maxdepth: 3

{% for subpackage in visible_subpackages %}
   {{ subpackage.short_name }}/index.rst
{% endfor %}
{% endif %}
{% endblock %}

{% block submodules %}
{% set visible_submodules = obj.submodules|selectattr("display")|list %}
{% if visible_submodules %}
Submodules
----------
.. toctree::
   :titlesonly:
   :maxdepth: 1

{% for submodule in visible_submodules %}
   {{ submodule.short_name }}/index.rst
{% endfor %}
{% endif %}
{% endblock %}

{% if obj.all is not none %}
{%     set visible_children = obj.children|selectattr("short_name", "in", obj.all)|list %}
{% elif obj.type is equalto("package") %}
{%     set visible_children = obj.children|selectattr("display")|list %}
{% else %}
{%     set visible_children = obj.children|selectattr("display")|rejectattr("imported")|list %}
{% endif %}

{% if visible_children %}                              {# if visible_children #}

{% set visible_classes = visible_children|selectattr("type", "equalto", "class")|list %}
{% set visible_functions = visible_children|selectattr("type", "equalto", "function")|list %}
{% set visible_data = visible_children|selectattr("type", "equalto", "data")|list %}

{% if "show-module-summary" in autoapi_options
    and (visible_classes or visible_functions or visible_data) %}
                                                         {# if show-summaries #}
{# === CLASSES SUMMARY === #}
{% block classes scoped %}
{% if visible_classes %}
Classes summary
---------------

.. autosummary::

{% for klass in visible_classes %}
   {{ klass.id }}
{% endfor %}
{% endif %}
{% endblock %}

{# === FUNCTIONS SUMMARY === #}
{% block functions scoped %}
{% if visible_functions %}
Functions Summary
-----------------

.. autosummary::

{% for function in visible_functions %}
   {{ function.id }}
{% endfor %}
{% endif %}
{% endblock %}

{# === DATA SUMMARY === #}
{# {% block data scoped %}
{% if visible_data %}
Data Summary
------------

.. autoapisummary::

{% for data in visible_data %}
   {{ data.id }}
{% endfor %}
{% endif %}
{% endblock %} #}

{% endif %}                                           {# endif show-summaries #}

{# === CONTENTS === #}
{% block contents scoped %}
Contents
--------
{% for obj_item in visible_children %}
{{ obj_item.rendered|indent(0) }}
{% endfor %}
{% endblock %}

{% endif %}                                         {# endif visible-children #}
