Skip to content

Commit b97d51f

Browse files
committed
refactor: Look into inherited members for __init__ methods when merging docstrings
Issue mkdocstrings#106: mkdocstrings#106
1 parent 3a760ac commit b97d51f

File tree

1 file changed

+8
-8
lines changed
  • src/mkdocstrings_handlers/python/templates/material/_base

1 file changed

+8
-8
lines changed

src/mkdocstrings_handlers/python/templates/material/_base/class.html

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
{% block heading scoped %}
2727
{% if config.separate_signature %}
2828
<span class="doc doc-object-name doc-class-name">{{ class_name }}</span>
29-
{% elif config.merge_init_into_class and "__init__" in class.members %}
30-
{% with function = class.members["__init__"] %}
29+
{% elif config.merge_init_into_class and "__init__" in class.all_members %}
30+
{% with function = class.all_members["__init__"] %}
3131
{%+ filter highlight(language="python", inline=True) %}
3232
{{ class_name }}{% include "signature.html" with context %}
3333
{% endfilter %}
@@ -47,8 +47,8 @@
4747

4848
{% block signature scoped %}
4949
{% if config.separate_signature and config.merge_init_into_class %}
50-
{% if "__init__" in class.members %}
51-
{% with function = class.members["__init__"] %}
50+
{% if "__init__" in class.all_members %}
51+
{% with function = class.all_members["__init__"] %}
5252
{% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
5353
{{ class.name }}
5454
{% endfilter %}
@@ -86,8 +86,8 @@
8686
{% include "docstring.html" with context %}
8787
{% endwith %}
8888
{% if config.merge_init_into_class %}
89-
{% if "__init__" in class.members and class.members["__init__"].has_docstring %}
90-
{% with docstring_sections = class.members["__init__"].docstring.parsed %}
89+
{% if "__init__" in class.all_members and class.all_members["__init__"].has_docstring %}
90+
{% with docstring_sections = class.all_members["__init__"].docstring.parsed %}
9191
{% include "docstring.html" with context %}
9292
{% endwith %}
9393
{% endif %}
@@ -97,10 +97,10 @@
9797
{% block source scoped %}
9898
{% if config.show_source %}
9999
{% if config.merge_init_into_class %}
100-
{% if "__init__" in class.members and class.members["__init__"].source %}
100+
{% if "__init__" in class.all_members and class.all_members["__init__"].source %}
101101
<details class="quote">
102102
<summary>Source code in <code>{{ class.relative_filepath }}</code></summary>
103-
{{ class.members["__init__"].source|highlight(language="python", linestart=class.members["__init__"].lineno, linenums=True) }}
103+
{{ class.all_members["__init__"].source|highlight(language="python", linestart=class.all_members["__init__"].lineno, linenums=True) }}
104104
</details>
105105
{% endif %}
106106
{% elif class.source %}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy