mkdocstrings-python 1.14.3__py3-none-any.whl → 1.14.5__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.
@@ -7,12 +7,18 @@ import sys
7
7
  from dataclasses import field, fields
8
8
  from typing import TYPE_CHECKING, Annotated, Any, Literal
9
9
 
10
+ from mkdocstrings.loggers import get_logger
11
+
10
12
  # YORE: EOL 3.10: Replace block with line 2.
11
13
  if sys.version_info >= (3, 11):
12
14
  from typing import Self
13
15
  else:
14
16
  from typing_extensions import Self
15
17
 
18
+
19
+ logger = get_logger(__name__)
20
+
21
+
16
22
  try:
17
23
  # When Pydantic is available, use it to validate options (done automatically).
18
24
  # Users can therefore opt into validation by installing Pydantic in development/CI.
@@ -30,6 +36,17 @@ try:
30
36
  if getattr(pydantic, "__version__", "1.").startswith("1."):
31
37
  raise ImportError # noqa: TRY301
32
38
 
39
+ if sys.version_info < (3, 10):
40
+ try:
41
+ import eval_type_backport # noqa: F401
42
+ except ImportError:
43
+ logger.debug(
44
+ "Pydantic needs the `eval-type-backport` package to be installed "
45
+ "for modern type syntax to work on Python 3.9. "
46
+ "Deactivating Pydantic validation for Python handler options.",
47
+ )
48
+ raise
49
+
33
50
  from inspect import cleandoc
34
51
 
35
52
  from pydantic import Field as BaseField
@@ -539,11 +539,20 @@ def do_as_attributes_section(
539
539
  Returns:
540
540
  An attributes docstring section.
541
541
  """
542
+
543
+ def _parse_docstring_summary(attribute: Attribute) -> str:
544
+ if attribute.docstring is None:
545
+ return ""
546
+ line = attribute.docstring.value.split("\n", 1)[0]
547
+ if ":" in line and attribute.docstring.parser_options.get("returns_type_in_property_summary", False):
548
+ _, line = line.split(":", 1)
549
+ return line
550
+
542
551
  return DocstringSectionAttributes(
543
552
  [
544
553
  DocstringAttribute(
545
554
  name=attribute.name,
546
- description=attribute.docstring.value.split("\n", 1)[0] if attribute.docstring else "",
555
+ description=_parse_docstring_summary(attribute),
547
556
  annotation=attribute.annotation,
548
557
  value=attribute.value, # type: ignore[arg-type]
549
558
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mkdocstrings-python
3
- Version: 1.14.3
3
+ Version: 1.14.5
4
4
  Summary: A Python handler for mkdocstrings.
5
5
  Author-Email: =?utf-8?q?Timoth=C3=A9e_Mazzucotelli?= <dev@pawamoy.fr>
6
6
  License: ISC
@@ -148,11 +148,11 @@ mkdocstrings_handlers/python/.mypy_cache/3.12/watchdog/observers/polling.data.js
148
148
  mkdocstrings_handlers/python/.mypy_cache/3.12/watchdog/observers/polling.meta.json,sha256=EDv6SusmmK9nmVtgCfInvJ8BlI91GDkqFeYVkybpql0,1941
149
149
  mkdocstrings_handlers/python/.mypy_cache/CACHEDIR.TAG,sha256=8cE6_FVTWMkDOw8fMKqhd_6IvaQPS4okWYQA1UeHatw,190
150
150
  mkdocstrings_handlers/python/__init__.py,sha256=k-0NWvXysr5RqWjtGyCozookveBB-ADZHIhgxvI1px8,128
151
- mkdocstrings_handlers/python/config.py,sha256=Sc6w1p92A0h4Lro64Ibnn4e9X7gjBTavz9Xc-ZMNsy8,30966
151
+ mkdocstrings_handlers/python/config.py,sha256=dZTBl2BbEyVc_o8PW0rReWHDzdqYstOP7fnlWioRVk0,31459
152
152
  mkdocstrings_handlers/python/debug.py,sha256=4vqIbCbbz_vcjcFk6jPoF8E1kLig8AQEsQ93ybcjIVc,2894
153
153
  mkdocstrings_handlers/python/handler.py,sha256=ucz0l8mbt-Ez3RAnPOCx3_e5L8PvRsMRJ--ODTOpbZI,14577
154
154
  mkdocstrings_handlers/python/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
155
- mkdocstrings_handlers/python/rendering.py,sha256=0j1LmGkwJg8zsnNYTnn_a62iqUJv0McIJMSrmh_ap_8,21628
155
+ mkdocstrings_handlers/python/rendering.py,sha256=rxK3GMaw_kyx8xA2b_LM9H54j746eAz6gbGf7RnGW-A,21946
156
156
  mkdocstrings_handlers/python/templates/material/_base/attribute.html,sha256=nn0671f4bE7VqnTs-VQL3SGPACWAxb2uJBRcP2nwYng,427
157
157
  mkdocstrings_handlers/python/templates/material/_base/attribute.html.jinja,sha256=sbbkQtl5bPm5mmmZ-VCyLtfsOuhSr-FrD2FUSlbK-Zs,4451
158
158
  mkdocstrings_handlers/python/templates/material/_base/children.html,sha256=mOafkSlphFQJLWfrYrIMFVRGi2yjdtN6iJh8bPt7uRI,424
@@ -327,8 +327,8 @@ mkdocstrings_handlers/python/templates/readthedocs/languages/ja.html.jinja,sha25
327
327
  mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html,sha256=OuvrkorxuL0gKZNYneann1bwd1Z2i5bBY7SbC496HDw,46
328
328
  mkdocstrings_handlers/python/templates/readthedocs/languages/zh.html.jinja,sha256=OuvrkorxuL0gKZNYneann1bwd1Z2i5bBY7SbC496HDw,46
329
329
  mkdocstrings_handlers/python/templates/readthedocs/style.css,sha256=Ds8vF1rSxc2B0c4P10osx4cqXHWMntcSCxmRfX-nfzw,971
330
- mkdocstrings_python-1.14.3.dist-info/METADATA,sha256=FvAVNjYn20CycZ_WEL_IQWdJjapPk1I07uTuPnEwLdc,5570
331
- mkdocstrings_python-1.14.3.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
332
- mkdocstrings_python-1.14.3.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
333
- mkdocstrings_python-1.14.3.dist-info/licenses/LICENSE,sha256=JGb4pdPEM8TTjjhr-uNCO7oXkiVrwG5Pz0JamcjNF_s,754
334
- mkdocstrings_python-1.14.3.dist-info/RECORD,,
330
+ mkdocstrings_python-1.14.5.dist-info/METADATA,sha256=A332XSZsOMUOrJBoaw_SRbtY262ragu8wuuH_JYYFXk,5570
331
+ mkdocstrings_python-1.14.5.dist-info/WHEEL,sha256=thaaA2w1JzcGC48WYufAs8nrYZjJm8LqNfnXFOFyCC4,90
332
+ mkdocstrings_python-1.14.5.dist-info/entry_points.txt,sha256=6OYgBcLyFCUgeqLgnvMyOJxPCWzgy7se4rLPKtNonMs,34
333
+ mkdocstrings_python-1.14.5.dist-info/licenses/LICENSE,sha256=JGb4pdPEM8TTjjhr-uNCO7oXkiVrwG5Pz0JamcjNF_s,754
334
+ mkdocstrings_python-1.14.5.dist-info/RECORD,,