Debian Codegraph @

docs/templates/python/material/class.html.jinja

raw
1 {% extends "_base/class.html.jinja" %}
2 {% set anta_test = namespace(found=false) %}
3 {% set anta_test_input_model = namespace(found=false) %}
4 {% for base in class.bases %}
5 {% set basestr = base | string %}
6 {% if "AntaTest" == basestr %}
7 {% set anta_test.found = True %}
8 {% endif %}
9 {% endfor %}
10 {# TODO make this nicer #}
11 {% if class.parent.parent.name == "input_models" or class.parent.parent.parent.name == "input_models" %}
12 {% set anta_test_input_model.found = True %}
13 {% endif %}
14 {% block children %}
15 {% if anta_test.found %}
16 {% set root = False %}
17 {% set heading_level = heading_level + 1 %}
18 {% include "anta_test.html.jinja" with context %}
19 {# render source after children - TODO make add flag to respect disabling it.. though do we want to disable?#}
20 <details class="quote">
21 <summary>Source code in <code>
22 {%- if class.relative_filepath.is_absolute() -%}
23 {{ class.relative_package_filepath }}
24 {%- else -%}
25 {{ class.relative_filepath }}
26 {%- endif -%}
27 </code></summary>
28 {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
29 </details>
30 {% elif anta_test_input_model.found %}
31 {% set root = False %}
32 {% set heading_level = heading_level + 1 %}
33 {% include "anta_test_input_model.html.jinja" with context %}
34 {# render source after children - TODO make add flag to respect disabling it.. though do we want to disable?#}
35 <details class="quote">
36 <summary>Source code in <code>
37 {%- if class.relative_filepath.is_absolute() -%}
38 {{ class.relative_package_filepath }}
39 {%- else -%}
40 {{ class.relative_filepath }}
41 {%- endif -%}
42 </code></summary>
43 {{ class.source|highlight(language="python", linestart=class.lineno, linenums=True) }}
44 </details>
45 {% else %}
46 {{ super() }}
47 {% endif %}
48 {% endblock children %}
49
50 {# Do not render source before children for AntaTest #}
51 {% block source %}
52 {% if not anta_test.found and not anta_test_input_model%}
53 {{ super() }}
54 {% endif %}
55 {% endblock source %}
56
57 {# overwrite block base to render some stuff on deprecation for anta_test #}
58 {% block bases %}
59 {{ super() }}
60
61 {# value is a string... #}
62 {% if anta_test.found and class._atomic_support.value == "True" %}
63 <img alt="Atomic support badge" src="https://img.shields.io/badge/Atomic%20result%20support-brightgreen?style=flat&logoSize=auto">
64 {% endif %}
65 {% for dec in class.decorators %}
66 {% if dec.value.name is defined and dec.value.name == "preview_test_class" %}
67 <img alt="Preview badge" src="https://img.shields.io/badge/PREVIEW-blue?style=flat&logoSize=auto">
68 <div class="admonition warning">
69 <p class="admonition-title">Preview</p>
70 <p>Input models and behavior may change between minor releases without a deprecation notice.</p>
71 </div>
72 {% endif %}
73 {% if dec.value.function is defined and dec.value.function.name == "deprecated_test_class" %}
74 <img alt="Static Badge" src="https://img.shields.io/badge/DEPRECATED-yellow?style=flat&logoSize=auto">
75 {% for arg in dec.value.arguments | selectattr("name", "equalto", "removal_in_version") | list %}
76 <img alt="Static Badge" src="https://img.shields.io/badge/REMOVAL-{{ arg.value[1:-1] }}-grey?style=flat&logoSize=auto&labelColor=red">
77 {% endfor %}
78 <br/>
79 {% for arg in dec.value.arguments | selectattr("name", "equalto", "new_tests") | list %}
80 <strong>Replaced with:</strong> {{ arg.value.elements | map("replace", "'", "<code>", 1) | map("replace", "'", "</code>", 1) | join(", ") | safe }}
81 {% endfor %}
82 {% endif %}
83 {% endfor %}
84 {% endblock bases %}