1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
<section class="m-doc-details" id="{{ function.id }}"><div>
<h3>
{% set j = joiner('\n ' if function.has_complex_params else ' ') %}
<span class="m-doc-wrap-bumper">def {{ prefix }}</span><span class="m-doc-wrap"><span class="m-doc-wrap-bumper"><a href="#{{ function.id }}" class="m-doc-self">{{ function.name }}</a>(</span><span class="m-doc-wrap">{% for param in function.params %}{% if loop.index0 %}{% if function.params[loop.index0 - 1].kind == 'POSITIONAL_OR_KEYWORD' and param.kind == 'KEYWORD_ONLY' %},<span class="m-text m-dim"> *,</span>{% else %},{% endif %}{% endif %}{{ j() }}{% if param.kind == 'VAR_POSITIONAL' %}*{% elif param.kind == 'VAR_KEYWORD' %}**{% endif %}{{ param.name }}{% if param.type_link %}: {{ param.type_link }}{% endif %}{% if param.default %} = {{ param.default }}{% endif %}{% if param.kind == 'POSITIONAL_ONLY' and (loop.last or function.params[loop.index0 + 1].kind != 'POSITIONAL_ONLY') %}<span class="m-text m-dim">, /</span>{% endif %}{% endfor %}){% if function.type_link %} -> {{ function.type_link }}{% endif %}{% if function.is_classmethod %} <span class="m-label m-success">classmethod</span>{% elif function.is_staticmethod %} <span class="m-label m-info">staticmethod</span>{% endif %}</span></span>
</h3>
{% if function.summary %}
<p>{{ function.summary }}</p>
{% endif %}
{% if function.has_param_details or function.exceptions or function.return_value %}
<table class="m-table m-fullwidth m-flat">
{% if function.has_param_details %}
<thead>
<tr><th colspan="2">Parameters</th></tr>
</thead>
<tbody>
{% for param in function.params %}
{% if loop.index != 1 or param.name != 'self' or param.content %}
<tr>
<td{% if loop.index == 1 or loop.index == 2 and function.params[loop.index0 - 1].name == 'self' %} style="width: 1%"{% endif %}>{{ param.name }}</td>
<td>{{ param.content }}</td>
</tr>
{% endif %}
{% endfor %}
</tbody>
{% endif %}
{% if function.exceptions %}
<thead>
<tr><th colspan="2">Exceptions</th></tr>
</thead>
<tbody>
{% for exception in function.exceptions %}
<tr>
<td{% if loop.index == 1 and not function.has_param_details %} style="width: 1%"{% endif %}>{{ exception.type_link }}</td>
<td>{{ exception.content }}</td>
</tr>
{% endfor %}
</tbody>
{% endif %}
{% if function.return_value %}
<tfoot>
<tr>
<th{% if not function.has_param_details and not function.exceptions %} style="width: 1%"{% endif %}>Returns</th>
<td>{{ function.return_value }}</td>
</tr>
</tfoot>
{% endif %}
</table>
{% endif %}
{% if function.content %}
{{ function.content }}
{% endif %}
</div></section>
|