Implemented a little enhancement for the Python docstring generator. eric7

Tue, 23 May 2023 14:39:14 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 23 May 2023 14:39:14 +0200
branch
eric7
changeset 10057
1e31ca1078ab
parent 10056
ac1c214e0a05
child 10058
5d965939ab85

Implemented a little enhancement for the Python docstring generator.

src/eric7/QScintilla/DocstringGenerator/EricdocGenerator.py file | annotate | diff | comparison | revisions
src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py file | annotate | diff | comparison | revisions
--- a/src/eric7/QScintilla/DocstringGenerator/EricdocGenerator.py	Tue May 23 13:33:47 2023 +0200
+++ b/src/eric7/QScintilla/DocstringGenerator/EricdocGenerator.py	Tue May 23 14:39:14 2023 +0200
@@ -107,7 +107,10 @@
     if (
         functionInfo.hasYield
         or functionInfo.returnValueInBody
-        or functionInfo.returnTypeAnnotated
+        or (
+            functionInfo.returnTypeAnnotated
+            and functionInfo.returnTypeAnnotated != "None"
+        )
     ):
         if functionInfo.hasYield:
             lines.append("@yield DESCRIPTION")
--- a/src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py	Tue May 23 13:33:47 2023 +0200
+++ b/src/eric7/QScintilla/DocstringGenerator/PyDocstringGenerator.py	Tue May 23 14:39:14 2023 +0200
@@ -340,8 +340,10 @@
         @rtype str
         """
         startLine = cursorPosition[0] - 1
-        endLine = startLine - min(startLine, 20)
+        endLine = startLine - min(startLine, 20) - 1
         # max. 20 lines of definition allowed
+        if endLine < -1:
+            endLine = -1
         isFirstLine = True
         functionTextList = []
 

eric ide

mercurial