Skip to content

Commit

Permalink
refactor: Look into inherited members for __init__ methods when mer…
Browse files Browse the repository at this point in the history
…ging docstrings

Issue #106: #106
  • Loading branch information
pawamoy committed Sep 28, 2023
1 parent 3a760ac commit b97d51f
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
{% block heading scoped %}
{% if config.separate_signature %}
<span class="doc doc-object-name doc-class-name">{{ class_name }}</span>
{% elif config.merge_init_into_class and "__init__" in class.members %}
{% with function = class.members["__init__"] %}
{% elif config.merge_init_into_class and "__init__" in class.all_members %}
{% with function = class.all_members["__init__"] %}
{%+ filter highlight(language="python", inline=True) %}
{{ class_name }}{% include "signature.html" with context %}
{% endfilter %}
Expand All @@ -47,8 +47,8 @@

{% block signature scoped %}
{% if config.separate_signature and config.merge_init_into_class %}
{% if "__init__" in class.members %}
{% with function = class.members["__init__"] %}
{% if "__init__" in class.all_members %}
{% with function = class.all_members["__init__"] %}
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
{{ class.name }}
{% endfilter %}
Expand Down Expand Up @@ -86,8 +86,8 @@
{% include "docstring.html" with context %}
{% endwith %}
{% if config.merge_init_into_class %}
{% if "__init__" in class.members and class.members["__init__"].has_docstring %}
{% with docstring_sections = class.members["__init__"].docstring.parsed %}
{% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %}
{% with docstring_sections = class.all_members["__init__"].docstring.parsed %}
{% include "docstring.html" with context %}
{% endwith %}
{% endif %}
Expand All @@ -97,10 +97,10 @@
{% block source scoped %}
{% if config.show_source %}
{% if config.merge_init_into_class %}
{% if "__init__" in class.members and class.members["__init__"].source %}
{% if "__init__" in class.all_members and class.all_members["__init__"].source %}
<details class="quote">
<summary>Source code in <code>{{ class.relative_filepath }}</code></summary>
{{ class.members["__init__"].source|highlight(language="python", linestart=class.members["__init__"].lineno, linenums=True) }}
{{ class.all_members["__init__"].source|highlight(language="python", linestart=class.all_members["__init__"].lineno, linenums=True) }}
</details>
{% endif %}
{% elif class.source %}
Expand Down

0 comments on commit b97d51f

Please sign in to comment.