Skip to content

Commit

Permalink
fix: Fix rendering of / in signatures
Browse files Browse the repository at this point in the history
Previously, `/` was added in front of positional-only
parameters. It is now fixed: `/` is added at the end
of such parameters.

Issue #25: #25
  • Loading branch information
pawamoy committed Jun 12, 2022
1 parent bc1a8ae commit 3e927e4
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{{ log.debug("Rendering signature") }}
{%- with -%}

{%- set ns = namespace(render_pos_only_separator=True, render_kw_only_separator=True, equal="=") -%}
{%- 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 = " = " -%}
Expand All @@ -13,11 +13,14 @@
{%- 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" -%}
{%- if ns.render_pos_only_separator -%}
{%- 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 -%}
{%- elif parameter.kind.value == "keyword-only" -%}
{%- if ns.render_kw_only_separator -%}
{%- set ns.render_kw_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 -%}
Expand Down

0 comments on commit 3e927e4

Please sign in to comment.