Fixed an issue parsing Python source code for documentation and navigation purposes. eric7

Fri, 30 Jul 2021 13:43:42 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 30 Jul 2021 13:43:42 +0200
branch
eric7
changeset 8495
e8278859d9fd
parent 8490
22230c2591c3
child 8496
72642569dd21

Fixed an issue parsing Python source code for documentation and navigation purposes.
(grafted from da73e8e32ba77cb3a81637c6a1e1e9439a933b76)

eric7/Utilities/ClassBrowsers/pyclbr.py file | annotate | diff | comparison | revisions
eric7/Utilities/ModuleParser.py file | annotate | diff | comparison | revisions
--- a/eric7/Utilities/ClassBrowsers/pyclbr.py	Thu Jul 29 19:40:12 2021 +0200
+++ b/eric7/Utilities/ClassBrowsers/pyclbr.py	Fri Jul 30 13:43:42 2021 +0200
@@ -416,8 +416,9 @@
         # start with zero based line after start line
         while lineno < len(lines):
             line = lines[lineno]
-            if line.strip():
-                # line contains some text
+            if line.strip() and not line.lstrip().startswith("#"):
+                # line contains some text and does not start with
+                # a comment sign
                 lineIndent = _indent(line.replace(line.lstrip(), ""))
                 if lineIndent <= indent:
                     return lineno
--- a/eric7/Utilities/ModuleParser.py	Thu Jul 29 19:40:12 2021 +0200
+++ b/eric7/Utilities/ModuleParser.py	Fri Jul 30 13:43:42 2021 +0200
@@ -543,8 +543,9 @@
             # start with zero based line after start line
             while lineno < len(lines):
                 line = lines[lineno]
-                if line.strip():
-                    # line contains some text
+                if line.strip() and not line.lstrip().startswith("#"):
+                    # line contains some text and does not start with
+                    # a comment sign
                     lineIndent = _indent(line.replace(line.lstrip(), ""))
                     if lineIndent <= indent:
                         return lineno

eric ide

mercurial