Merging upstream version 1.2.0.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-02-05 11:55:22 +01:00
parent ae7b7df396
commit afeccccd6a
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
154 changed files with 7346 additions and 5000 deletions

View file

@ -0,0 +1,154 @@
{% if obj.members %}
{{ log.debug("Rendering children of " + obj.path) }}
<div class="doc doc-children">
{% if root_members %}
{% set members_list = config.members %}
{% else %}
{% set members_list = none %}
{% endif %}
{% if config.group_by_category %}
{% with %}
{% if config.show_category_heading %}
{% set extra_level = 1 %}
{% else %}
{% set extra_level = 0 %}
{% endif %}
{% with attributes = obj.attributes|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if attributes %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-attributes") %}Attributes{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% set old_obj = obj %}
{% set obj = class %}
{% include "attributes_table.html" with context %}
{% set obj = old_obj %}
{% endwith %}
{% endif %}
{% endwith %}
{% with classes = obj.classes|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if classes %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-classes") %}Classes{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% for class in classes|order_members(config.members_order, members_list) %}
{% if members_list is not none or class.is_public %}
{% include class|get_template with context %}
{% endif %}
{% endfor %}
{% endwith %}
{% endif %}
{% endwith %}
{% with functions = obj.functions|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if functions %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-functions") %}Functions{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% for function in functions|order_members(config.members_order, members_list) %}
{% if not (obj.kind.value == "class" and function.name == "__init__" and config.merge_init_into_class) %}
{% if members_list is not none or function.is_public %}
{% include function|get_template with context %}
{% endif %}
{% endif %}
{% endfor %}
{% endwith %}
{% endif %}
{% endwith %}
{% if config.show_submodules %}
{% with modules = obj.modules|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
) %}
{% if modules %}
{% if config.show_category_heading %}
{% filter heading(heading_level, id=html_id ~ "-modules") %}Modules{% endfilter %}
{% endif %}
{% with heading_level = heading_level + extra_level %}
{% for module in modules|order_members(config.members_order.alphabetical, members_list) %}
{% if members_list is not none or module.is_public %}
{% include module|get_template with context %}
{% endif %}
{% endfor %}
{% endwith %}
{% endif %}
{% endwith %}
{% endif %}
{% endwith %}
{% else %}
{% for child in obj.all_members
|filter_objects(
filters=config.filters,
members_list=members_list,
inherited_members=config.inherited_members,
keep_no_docstrings=config.show_if_no_docstring,
)
|order_members(config.members_order, members_list)
%}
{% if not (obj.is_class and child.name == "__init__" and config.merge_init_into_class) %}
{% if members_list is not none or child.is_public %}
{% if child.is_attribute %}
{% with attribute = child %}
{% include attribute|get_template with context %}
{% endwith %}
{% elif child.is_class %}
{% with class = child %}
{% include class|get_template with context %}
{% endwith %}
{% elif child.is_function %}
{% with function = child %}
{% include function|get_template with context %}
{% endwith %}
{% elif child.is_module and config.show_submodules %}
{% with module = child %}
{% include module|get_template with context %}
{% endwith %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endif %}
</div>
{% endif %}

View file

@ -1,26 +1,46 @@
{% extends "_base/class.html.jinja" %}
{% set anta_test = namespace(found=false) %}
{% set anta_test_input_model = namespace(found=false) %}
{% for base in class.bases %}
{% set basestr = base | string %}
{% if "AntaTest" == basestr %}
{% set anta_test.found = True %}
{% endif %}
{% endfor %}
{# TODO make this nicer #}
{% if class.parent.parent.name == "input_models" or class.parent.parent.parent.name == "input_models" %}
{% set anta_test_input_model.found = True %}
{% endif %}
{% block children %}
{% if anta_test.found %}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% include "anta_test.html.jinja" with context %}
{# render source after children - TODO make add flag to respect disabling it.. though do we want to disable?#}
<details class="quote">
<summary>Source code in <code>
{%- if class.relative_filepath.is_absolute() -%}
{{ class.relative_package_filepath }}
{%- else -%}
{{ class.relative_filepath }}
{%- endif -%}
</code></summary>
{{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
<details class="quote">
<summary>Source code in <code>
{%- if class.relative_filepath.is_absolute() -%}
{{ class.relative_package_filepath }}
{%- else -%}
{{ class.relative_filepath }}
{%- endif -%}
</code></summary>
{{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
</details>
{% elif anta_test_input_model.found %}
{% set root = False %}
{% set heading_level = heading_level + 1 %}
{% include "anta_test_input_model.html.jinja" with context %}
{# render source after children - TODO make add flag to respect disabling it.. though do we want to disable?#}
<details class="quote">
<summary>Source code in <code>
{%- if class.relative_filepath.is_absolute() -%}
{{ class.relative_package_filepath }}
{%- else -%}
{{ class.relative_filepath }}
{%- endif -%}
</code></summary>
{{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
</details>
{% else %}
{{ super() }}
@ -29,7 +49,25 @@
{# Do not render source before children for AntaTest #}
{% block source %}
{% if not anta_test.found %}
{% if not anta_test.found and not anta_test_input_model%}
{{ super() }}
{% endif %}
{% endblock source %}
{# overwrite block base to render some stuff on deprecation for anta_test #}
{% block bases %}
{{ super() }}
{% for dec in class.decorators %}
{% if dec.value.function.name == "deprecated_test_class" %}
<img alt="Static Badge" src="https://img.shields.io/badge/DEPRECATED-yellow?style=flat&logoSize=auto">
{% for arg in dec.value.arguments | selectattr("name", "equalto", "removal_in_version") | list %}
<img alt="Static Badge" src="https://img.shields.io/badge/REMOVAL-{{ arg.value[1:-1] }}-grey?style=flat&logoSize=auto&labelColor=red">
{% endfor %}
<br/>
{% for arg in dec.value.arguments | selectattr("name", "equalto", "new_tests") | list %}
<strong>Replaced with:</strong> {{ arg.value.elements | map("replace", "'", "<code>", 1) | map("replace", "'", "</code>", 1) | join(", ") | safe }}
{% endfor %}
{% endif %}
{% endfor %}
{% endblock bases %}