eric6/Utilities/ClassBrowsers/pyclbr.py

changeset 8217
385f60c94548
parent 8207
d359172d11be
child 8493
da73e8e32ba7
--- a/eric6/Utilities/ClassBrowsers/pyclbr.py	Sat Apr 10 17:54:58 2021 +0200
+++ b/eric6/Utilities/ClassBrowsers/pyclbr.py	Sat Apr 10 18:31:17 2021 +0200
@@ -463,7 +463,7 @@
             meth_ret = m.group("MethodReturnAnnotation")
             meth_ret = meth_ret.replace('\\\n', '')
             meth_ret = _commentsub('', meth_ret)
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             if modifierType and modifierIndent == thisindent:
                 if modifierType == "@staticmethod":
@@ -535,7 +535,7 @@
             # close all classes indented at least as much
             while classstack and classstack[-1][1] >= thisindent:
                 del classstack[-1]
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             class_name = m.group("ClassName")
             inherit = m.group("ClassSupers")
@@ -561,8 +561,7 @@
                             c = c[-1]
                             if m in _modules:
                                 d = _modules[m]
-                                if c in d:
-                                    n = d[c]
+                                n = d.get(c, n)
                     names.append(n)
                 inherit = names
             # modify indentation level for conditional defines
@@ -600,7 +599,7 @@
             classstack.append((cur_class, thisindent))
 
         elif m.start("Attribute") >= 0:
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             index = -1
             while index >= -len(classstack):
@@ -617,14 +616,14 @@
 
         elif m.start("Main") >= 0:
             # 'main' part of the script, reset class stack
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             classstack = []
 
         elif m.start("Variable") >= 0:
             thisindent = _indent(m.group("VariableIndent"))
             variable_name = m.group("VariableName")
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             if thisindent == 0 or not classstack:
                 # global variable, reset class stack first
@@ -648,7 +647,7 @@
 
         elif m.start("Publics") >= 0:
             idents = m.group("Identifiers")
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             pubs = Publics(module, file, lineno, idents)
             dictionary['__all__'] = pubs
@@ -658,7 +657,7 @@
             names = [n.strip() for n in
                      "".join(m.group("ImportList").splitlines())
                      .replace("\\", "").split(',')]
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             if "@@Import@@" not in dictionary:
                 dictionary["@@Import@@"] = Imports(module, file)
@@ -677,7 +676,7 @@
             names = [n.strip() for n in
                      "".join(namesLines)
                      .split(',')]
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             if "@@Import@@" not in dictionary:
                 dictionary["@@Import@@"] = Imports(module, file)
@@ -696,7 +695,7 @@
         elif m.start("CodingLine") >= 0:
             # a coding statement
             coding = m.group("Coding")
-            lineno = lineno + src.count('\n', last_lineno_pos, start)
+            lineno += src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             if "@@Coding@@" not in dictionary:
                 dictionary["@@Coding@@"] = ClbrBaseClasses.Coding(

eric ide

mercurial