mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
docs update (#2239)
* docs update * class template * no annotations in sig
This commit is contained in:
48
docs/_templates/python/material/_base/signature.html
vendored
Normal file
48
docs/_templates/python/material/_base/signature.html
vendored
Normal file
@@ -0,0 +1,48 @@
|
||||
{%- if config.show_signature -%}
|
||||
{{ log.debug("Rendering signature") }}
|
||||
{%- with -%}
|
||||
|
||||
{%- set ns = namespace(has_pos_only=False, render_pos_only_separator=True, render_kw_only_separator=True, equal="=") -%}
|
||||
|
||||
{%- if config.show_signature_annotations -%}
|
||||
{%- set ns.equal = " = " -%}
|
||||
{%- endif -%}
|
||||
|
||||
(
|
||||
{%- for parameter in function.parameters -%}
|
||||
{%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%}
|
||||
|
||||
{%- if parameter.kind.value == "positional-only" -%}
|
||||
{%- set ns.has_pos_only = True -%}
|
||||
{%- else -%}
|
||||
{%- if ns.has_pos_only and ns.render_pos_only_separator -%}
|
||||
{%- set ns.render_pos_only_separator = False %}/, {% endif -%}
|
||||
{%- if parameter.kind.value == "keyword-only" -%}
|
||||
{%- if ns.render_kw_only_separator -%}
|
||||
{%- set ns.render_kw_only_separator = False %}*, {% endif -%}
|
||||
{%- endif -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if config.show_signature_annotations and parameter.annotation is not none -%}
|
||||
{%- set annotation = ": " + parameter.annotation|safe -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%}
|
||||
{%- set default = ns.equal + parameter.default|safe -%}
|
||||
{%- endif -%}
|
||||
|
||||
{%- if parameter.kind.value == "variadic positional" -%}
|
||||
{%- set ns.render_kw_only_separator = False -%}
|
||||
{%- endif -%}
|
||||
|
||||
{% if parameter.kind.value == "variadic positional" %}*{% elif parameter.kind.value == "variadic keyword" %}**{% endif -%}
|
||||
{{ parameter.name }}{{ annotation }}{{ default }}
|
||||
{%- if not loop.last %}, {% endif -%}
|
||||
|
||||
{%- endif -%}
|
||||
{%- endfor -%}
|
||||
)
|
||||
{%- if config.show_signature_annotations and function.annotation %} -> {{ function.annotation|safe }}{%- endif -%}
|
||||
|
||||
{%- endwith -%}
|
||||
{%- endif -%}
|
||||
Reference in New Issue
Block a user