Skip to content

Commit

Permalink
fix: Handle __init__ overloads when merging into class
Browse files Browse the repository at this point in the history
Issue-212: #212
  • Loading branch information
pawamoy committed Dec 3, 2024
1 parent 3bf55b2 commit af6fab3
Showing 1 changed file with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,26 @@ Context:
{#- Signature block.
This block renders the signature for the class.
Overloads of the `__init__` method are rendered if `merge_init_into_class` is enabled.
The actual `__init__` method signature is only rendered if `separate_signature` is also enabled.
-#}
{% if config.separate_signature and config.merge_init_into_class %}
{% if config.merge_init_into_class %}
{% if "__init__" in all_members %}
{% with function = all_members["__init__"] %}
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
{{ class.name }}
{% endfilter %}
{% if function.overloads %}
<div class="doc-overloads">
{% for overload in function.overloads %}
{% filter format_signature(overload, config.line_length, annotations=True, crossrefs=config.signature_crossrefs) %}
{{ class.name }}
{% endfilter %}
{% endfor %}
</div>
{% endif %}
{% if config.separate_signature %}
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
{{ class.name }}
{% endfilter %}
{% endif %}
{% endwith %}
{% endif %}
{% endif %}
Expand Down

0 comments on commit af6fab3

Please sign in to comment.