mkdocstrings-python 1.6.3__py3-none-any.whl → 1.7.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -109,6 +109,7 @@ class PythonHandler(BaseHandler):
109
109
  "annotations_path": "brief",
110
110
  "preload_modules": None,
111
111
  "allow_inspection": True,
112
+ "unwrap_annotated": False,
112
113
  }
113
114
  """
114
115
  Attributes: General options:
@@ -180,6 +181,7 @@ class PythonHandler(BaseHandler):
180
181
  signature_crossrefs (bool): Whether to render cross-references for type annotations in signatures. Default: `False`.
181
182
  separate_signature (bool): Whether to put the whole signature in a code block below the heading.
182
183
  If Black is installed, the signature is also formatted using it. Default: `False`.
184
+ unwrap_annotated (bool): Whether to unwrap `Annotated` types to show only the type without the annotations. Default: `False`.
183
185
  """
184
186
 
185
187
  def __init__(
@@ -26,8 +26,8 @@
26
26
  {% block heading scoped %}
27
27
  {% if config.separate_signature %}
28
28
  <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__"] %}
31
31
  {%+ filter highlight(language="python", inline=True) %}
32
32
  {{ class_name }}{% include "signature.html" with context %}
33
33
  {% endfilter %}
@@ -47,8 +47,8 @@
47
47
 
48
48
  {% block signature scoped %}
49
49
  {% 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__"] %}
52
52
  {% filter format_signature(function, config.line_length, crossrefs=config.signature_crossrefs) %}
53
53
  {{ class.name }}
54
54
  {% endfilter %}
@@ -86,8 +86,8 @@
86
86
  {% include "docstring.html" with context %}
87
87
  {% endwith %}
88
88
  {% 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 %}
91
91
  {% include "docstring.html" with context %}
92
92
  {% endwith %}
93
93
  {% endif %}
@@ -97,10 +97,10 @@
97
97
  {% block source scoped %}
98
98
  {% if config.show_source %}
99
99
  {% 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 %}
101
101
  <details class="quote">
102
102
  <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) }}
104
104
  </details>
105
105
  {% endif %}
106
106
  {% elif class.source %}
@@ -25,6 +25,8 @@
25
25
  {%- if signature -%}{{ expression|safe }}{%- else -%}{{ expression }}{%- endif -%}
26
26
  {%- elif expression.classname == "ExprName" -%}
27
27
  {{ crossref(expression, annotations_path) }}
28
+ {%- elif config.unwrap_annotated and expression.classname == "ExprSubscript" and expression.canonical_path in ("typing.Annotated", "typing_extensions.Annotated") -%}
29
+ {{ render(expression.slice.elements[0], annotations_path) }}
28
30
  {%- elif expression.classname == "ExprAttribute" -%}
29
31
  {%- if annotations_path == "brief" -%}
30
32
  {{ render(expression.last, "brief") }}
@@ -11,10 +11,6 @@
11
11
  )
12
12
  -%}
13
13
 
14
- {%- if config.show_signature_annotations -%}
15
- {%- set ns.equal = " = " -%}
16
- {%- endif -%}
17
-
18
14
  (
19
15
  {%- for parameter in function.parameters -%}
20
16
  {%- if parameter.name not in ("self", "cls") or loop.index0 > 0 or not (function.parent and function.parent.is_class) -%}
@@ -31,6 +27,7 @@
31
27
  {%- endif -%}
32
28
 
33
29
  {%- if config.show_signature_annotations and parameter.annotation is not none -%}
30
+ {%- set ns.equal = " = " -%}
34
31
  {%- if config.separate_signature and config.signature_crossrefs -%}
35
32
  {%- with expression = parameter.annotation -%}
36
33
  {%- set ns.annotation -%}: {% include "expression.html" with context %}{%- endset -%}
@@ -38,6 +35,9 @@
38
35
  {%- else -%}
39
36
  {%- set ns.annotation = ": " + parameter.annotation|safe -%}
40
37
  {%- endif -%}
38
+ {%- else -%}
39
+ {%- set ns.equal = "=" -%}
40
+ {%- set ns.annotation = "" -%}
41
41
  {%- endif -%}
42
42
 
43
43
  {%- if parameter.default is not none and parameter.kind.value != "variadic positional" and parameter.kind.value != "variadic keyword" -%}
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mkdocstrings-python
3
- Version: 1.6.3
3
+ Version: 1.7.1
4
4
  Summary: A Python handler for mkdocstrings.
5
5
  Author-Email: Timothée Mazzucotelli <pawamoy@pm.me>
6
6
  License: ISC
@@ -1,10 +1,10 @@
1
1
  mkdocstrings_handlers/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
2
2
  mkdocstrings_handlers/python/__init__.py,sha256=CJT3hmg9HpEMy5dbq2jL3Y8unO6UOHND7yCLojwQrS8,326
3
- mkdocstrings_handlers/python/handler.py,sha256=DBYtXwFGSDUkfllF4j07LsBzha-w1fmflXs7bIKMcLA,20180
3
+ mkdocstrings_handlers/python/handler.py,sha256=HjHHYUiCzk9zxrIUmZwo6yM-_mjR0C-lvQz6-NLmSe4,20349
4
4
  mkdocstrings_handlers/python/rendering.py,sha256=pBpsM_zxGGlp-xmCNZRcOOkQppyQFPev5b1exmtJSW0,11551
5
5
  mkdocstrings_handlers/python/templates/material/_base/attribute.html,sha256=1nLfAEyZiD3DF9R7nyEb69cIM5oFp1MA-Zl7SJwuVts,2539
6
6
  mkdocstrings_handlers/python/templates/material/_base/children.html,sha256=8z5dQ2HOywV7CQ3KYYgdBX8N-CGbnYZ8Sm7ugN89IIo,5709
7
- mkdocstrings_handlers/python/templates/material/_base/class.html,sha256=OQATi6Zz0Vg34ONWwh6mimGdeHd2s0VqxulyrLMMzq8,4479
7
+ mkdocstrings_handlers/python/templates/material/_base/class.html,sha256=T1i4f82Gtx9Yyf7cvhxiZ2s1ipLnZ0tli_sXnmkRBSc,4523
8
8
  mkdocstrings_handlers/python/templates/material/_base/docstring.html,sha256=Sw8TwJy4aTZA2phqqg61QVAZDfLYJAzgE_lQmDcdUsU,2163
9
9
  mkdocstrings_handlers/python/templates/material/_base/docstring/admonition.html,sha256=wiD2FtMnGrFMZJDilURnNqzIu8bOR0zcMErUVUqbDPo,274
10
10
  mkdocstrings_handlers/python/templates/material/_base/docstring/attributes.html,sha256=hpGB3CKuD44C4utJxKfA4V-uqQCVnV4fVRkjwGMrcdU,2840
@@ -19,14 +19,14 @@ mkdocstrings_handlers/python/templates/material/_base/docstring/receives.html,sh
19
19
  mkdocstrings_handlers/python/templates/material/_base/docstring/returns.html,sha256=GACKAuJKUjAu3mUts_GJnQ31VZt04wxznMQNdHbDeAI,3479
20
20
  mkdocstrings_handlers/python/templates/material/_base/docstring/warns.html,sha256=FROLXo9Xd97TlpokL0YZC1kZ08QRL5bIm8_QnFtrBNQ,2453
21
21
  mkdocstrings_handlers/python/templates/material/_base/docstring/yields.html,sha256=3aBn3F8wO6ptxWQzMHyykrX8r4_rn2ezfhE7IZUO1Uw,3444
22
- mkdocstrings_handlers/python/templates/material/_base/expression.html,sha256=lfvgET2b8dxvqYZJqiGjS-ooO_nNXqV42zsL8yL05_s,1845
22
+ mkdocstrings_handlers/python/templates/material/_base/expression.html,sha256=sDcvcJiqWSpSXyX_gr7kY7zetlIAi9IzLPK0RN4rOgo,2078
23
23
  mkdocstrings_handlers/python/templates/material/_base/function.html,sha256=7f_RhIvsWa9KNDrg5Dgj8XX0_ltAv629EybAX-yQ2p0,2787
24
24
  mkdocstrings_handlers/python/templates/material/_base/labels.html,sha256=QMO1lrs1smktTGvkDZabvJZFQpMp_nSoM8JBt-tAcu8,250
25
25
  mkdocstrings_handlers/python/templates/material/_base/languages/en.html,sha256=u0j9TIPh18qHEI4bzlGlwu4IX95EPIi0Q3AaDi6D58I,966
26
26
  mkdocstrings_handlers/python/templates/material/_base/languages/ja.html,sha256=Az63fFTq4MIr65DjufCh8GYujB0-CiAJFDVVW9mCGtQ,984
27
27
  mkdocstrings_handlers/python/templates/material/_base/languages/zh.html,sha256=oPB3-fnOdmdGdrnRZUgXw6zuQGlF-aq5Bbkm1zF4xgA,902
28
28
  mkdocstrings_handlers/python/templates/material/_base/module.html,sha256=OrQb5_CfpQno9TJeVkHdz0Dp_DrXXKFW7sVRflsw-mI,2085
29
- mkdocstrings_handlers/python/templates/material/_base/signature.html,sha256=tW7V8nc1Ojan0BrehKDeN4irmRivR0Kfv0C8fPzyhuw,2790
29
+ mkdocstrings_handlers/python/templates/material/_base/signature.html,sha256=aXGcPXowRwAc__-OQYBuNYT45trt7BZIxlp-64-WRrM,2833
30
30
  mkdocstrings_handlers/python/templates/material/attribute.html,sha256=Zbo0SMrqjdlUhXunXpy_VENWITviBDLt8UBdF5EnVb0,37
31
31
  mkdocstrings_handlers/python/templates/material/children.html,sha256=xLnVaXevA0HRffVdOK0INULbekvbOYV9vKQ_zXBLyK0,36
32
32
  mkdocstrings_handlers/python/templates/material/class.html,sha256=BGYm-uj8AEDiUZtNxr6ji7I1xFrlAiyOB7cOwM7gzEM,33
@@ -67,7 +67,7 @@ mkdocstrings_handlers/python/templates/readthedocs/languages/en.html,sha256=bhfj
67
67
  mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html,sha256=ULdcRwrN9rF8shxFVwEZ1jqSICebVKMi8cYHpNZypd8,372
68
68
  mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html,sha256=ZYm9N33cRC4Z66-ZqmteWDfRNfo8hKe25Bz4ijVk22A,359
69
69
  mkdocstrings_handlers/python/templates/readthedocs/style.css,sha256=Ds8vF1rSxc2B0c4P10osx4cqXHWMntcSCxmRfX-nfzw,971
70
- mkdocstrings_python-1.6.3.dist-info/METADATA,sha256=z0xXCzKJz7OiEMLn7m7S7wD_p90XMZrn6OUoOoZdXjQ,5748
71
- mkdocstrings_python-1.6.3.dist-info/WHEEL,sha256=1D4d-_ODszlK6-qFybc5BLF-ZhZvee-uKVh2hLa3IIc,90
72
- mkdocstrings_python-1.6.3.dist-info/licenses/LICENSE,sha256=JGb4pdPEM8TTjjhr-uNCO7oXkiVrwG5Pz0JamcjNF_s,754
73
- mkdocstrings_python-1.6.3.dist-info/RECORD,,
70
+ mkdocstrings_python-1.7.1.dist-info/METADATA,sha256=-xUoZmk8lP5DyZLiop0byqpZmZBTiX6KrkVedc12pn8,5748
71
+ mkdocstrings_python-1.7.1.dist-info/WHEEL,sha256=1D4d-_ODszlK6-qFybc5BLF-ZhZvee-uKVh2hLa3IIc,90
72
+ mkdocstrings_python-1.7.1.dist-info/licenses/LICENSE,sha256=JGb4pdPEM8TTjjhr-uNCO7oXkiVrwG5Pz0JamcjNF_s,754
73
+ mkdocstrings_python-1.7.1.dist-info/RECORD,,