File tree 1 file changed +10
-1
lines changed
src/mkdocstrings_handlers/python
1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -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
)
You can’t perform that action at this time.
0 commit comments