Docstring: corrected the return section generation for ericdoc and sphinxdoc.

Mon, 25 Jan 2021 14:53:56 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Mon, 25 Jan 2021 14:53:56 +0100
changeset 8005
94a6a1bd5f80
parent 8004
38d359e2ded7
child 8007
5b5e68ccca03

Docstring: corrected the return section generation for ericdoc and sphinxdoc.

eric6/QScintilla/DocstringGenerator/EricdocGenerator.py file | annotate | diff | comparison | revisions
eric6/QScintilla/DocstringGenerator/SphinxdocGenerator.py file | annotate | diff | comparison | revisions
--- a/eric6/QScintilla/DocstringGenerator/EricdocGenerator.py	Mon Jan 25 14:44:35 2021 +0100
+++ b/eric6/QScintilla/DocstringGenerator/EricdocGenerator.py	Mon Jan 25 14:53:56 2021 +0100
@@ -99,7 +99,11 @@
         lines.append(argLine)
     
     # add return section
-    if functionInfo.hasYield or functionInfo.returnValueInBody:
+    if (
+        functionInfo.hasYield or
+        functionInfo.returnValueInBody or
+        functionInfo.returnTypeAnnotated
+    ):
         if functionInfo.hasYield:
             lines.append("@yield DESCRIPTION")
             rType = "@ytype"
--- a/eric6/QScintilla/DocstringGenerator/SphinxdocGenerator.py	Mon Jan 25 14:44:35 2021 +0100
+++ b/eric6/QScintilla/DocstringGenerator/SphinxdocGenerator.py	Mon Jan 25 14:53:56 2021 +0100
@@ -67,7 +67,11 @@
             lines.append(":raises {0}: DESCRIPTION".format(exc))
     
     # add return section
-    if functionInfo.hasYield or functionInfo.returnValueInBody:
+    if (
+        functionInfo.hasYield or
+        functionInfo.returnValueInBody or
+        functionInfo.returnTypeAnnotated
+    ):
         if functionInfo.hasYield:
             lines.append(":yield: DESCRIPTION")
         else:

eric ide

mercurial