eric6/Utilities/ClassBrowsers/rbclbr.py

changeset 7259
7c017076c12e
parent 7229
53054eb5b15a
child 7360
9190402e4505
--- a/eric6/Utilities/ClassBrowsers/rbclbr.py	Mon Sep 23 19:10:42 2019 +0200
+++ b/eric6/Utilities/ClassBrowsers/rbclbr.py	Mon Sep 23 19:22:12 2019 +0200
@@ -303,9 +303,11 @@
             # found a method definition or function
             thisindent = indent
             indent += 1
-            meth_name = m.group("MethodName") or \
-                m.group("MethodName2") or \
+            meth_name = (
+                m.group("MethodName") or
+                m.group("MethodName2") or
                 m.group("MethodName3")
+            )
             meth_sig = m.group("MethodSignature")
             meth_sig = meth_sig and meth_sig.replace('\\\n', '') or ''
             meth_sig = _commentsub('', meth_sig)
@@ -316,20 +318,20 @@
             elif meth_name.startswith('self::'):
                 meth_name = meth_name[6:]
             # close all classes/modules indented at least as much
-            while classstack and \
-                    classstack[-1][1] >= thisindent:
+            while classstack and classstack[-1][1] >= thisindent:
                 if classstack[-1][0] is not None:
                     # record the end line
                     classstack[-1][0].setEndLine(lineno - 1)
                 del classstack[-1]
-            while acstack and \
-                    acstack[-1][1] >= thisindent:
+            while acstack and acstack[-1][1] >= thisindent:
                 del acstack[-1]
             if classstack:
                 # it's a class/module method
                 cur_class = classstack[-1][0]
-                if isinstance(cur_class, Class) or \
-                        isinstance(cur_class, Module):
+                if (
+                    isinstance(cur_class, Class) or
+                    isinstance(cur_class, Module)
+                ):
                     # it's a method
                     f = Function(None, meth_name,
                                  file, lineno, meth_sig)
@@ -382,8 +384,7 @@
             lineno = lineno + src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             # close all classes/modules indented at least as much
-            while classstack and \
-                    classstack[-1][1] >= thisindent:
+            while classstack and classstack[-1][1] >= thisindent:
                 if classstack[-1][0] is not None:
                     # record the end line
                     classstack[-1][0].setEndLine(lineno - 1)
@@ -416,8 +417,7 @@
                 lastGlobalEntry = cur_class
             cur_obj = cur_class
             classstack.append((cur_class, thisindent))
-            while acstack and \
-                    acstack[-1][1] >= thisindent:
+            while acstack and acstack[-1][1] >= thisindent:
                 del acstack[-1]
             acstack.append(["public", thisindent])
             # default access control is 'public'
@@ -429,8 +429,7 @@
             lineno = lineno + src.count('\n', last_lineno_pos, start)
             last_lineno_pos = start
             # close all classes/modules indented at least as much
-            while classstack and \
-                    classstack[-1][1] >= thisindent:
+            while classstack and classstack[-1][1] >= thisindent:
                 if classstack[-1][0] is not None:
                     # record the end line
                     classstack[-1][0].setEndLine(lineno - 1)
@@ -457,8 +456,7 @@
                 lastGlobalEntry = cur_class
             cur_obj = cur_class
             classstack.append((cur_class, thisindent))
-            while acstack and \
-                    acstack[-1][1] >= thisindent:
+            while acstack and acstack[-1][1] >= thisindent:
                 del acstack[-1]
             acstack.append(["public", thisindent])
             # default access control is 'public'
@@ -469,8 +467,10 @@
                 index = -1
                 while index >= -len(acstack):
                     if acstack[index][1] < indent:
-                        actype = m.group("AccessControlType") or \
+                        actype = (
+                            m.group("AccessControlType") or
                             m.group("AccessControlType2").split('_')[0]
+                        )
                         acstack[index][0] = actype.lower()
                         break
                     else:
@@ -478,12 +478,16 @@
             else:
                 index = -1
                 while index >= -len(classstack):
-                    if classstack[index][0] is not None and \
-                       not isinstance(classstack[index][0], Function) and \
-                       not classstack[index][1] >= indent:
+                    if (
+                        classstack[index][0] is not None and
+                        not isinstance(classstack[index][0], Function) and
+                        not classstack[index][1] >= indent
+                    ):
                         parent = classstack[index][0]
-                        actype = m.group("AccessControlType") or \
+                        actype = (
+                            m.group("AccessControlType") or
                             m.group("AccessControlType2").split('_')[0]
+                        )
                         actype = actype.lower()
                         for name in aclist.split(","):
                             name = name.strip()[1:]   # get rid of leading ':'
@@ -505,9 +509,11 @@
             last_lineno_pos = start
             index = -1
             while index >= -len(classstack):
-                if classstack[index][0] is not None and \
-                   not isinstance(classstack[index][0], Function) and \
-                   not classstack[index][1] >= indent:
+                if (
+                    classstack[index][0] is not None and
+                    not isinstance(classstack[index][0], Function) and
+                    not classstack[index][1] >= indent
+                ):
                     attr = Attribute(
                         module, m.group("AttributeName"), file, lineno)
                     classstack[index][0]._addattribute(attr)
@@ -523,18 +529,22 @@
             last_lineno_pos = start
             index = -1
             while index >= -len(classstack):
-                if classstack[index][0] is not None and \
-                   not isinstance(classstack[index][0], Function) and \
-                   not classstack[index][1] >= indent:
+                if (
+                    classstack[index][0] is not None and
+                    not isinstance(classstack[index][0], Function) and
+                    not classstack[index][1] >= indent
+                ):
                     parent = classstack[index][0]
                     if m.group("AttrType") is None:
                         nv = m.group("AttrList").split(",")
                         if not nv:
                             break
                         name = nv[0].strip()[1:]    # get rid of leading ':'
-                        attr = parent._getattribute("@" + name) or \
-                            parent._getattribute("@@" + name) or \
+                        attr = (
+                            parent._getattribute("@" + name) or
+                            parent._getattribute("@@" + name) or
                             Attribute(module, "@" + name, file, lineno)
+                        )
                         if len(nv) == 1 or nv[1].strip() == "false":
                             attr.setProtected()
                         elif nv[1].strip() == "true":
@@ -544,9 +554,11 @@
                         access = m.group("AttrType")
                         for name in m.group("AttrList").split(","):
                             name = name.strip()[1:]   # get rid of leading ':'
-                            attr = parent._getattribute("@" + name) or \
-                                parent._getattribute("@@" + name) or \
+                            attr = (
+                                parent._getattribute("@" + name) or
+                                parent._getattribute("@@" + name) or
                                 Attribute(module, "@" + name, file, lineno)
+                            )
                             if access == "_accessor":
                                 attr.setPublic()
                             elif access == "_reader" or access == "_writer":

eric ide

mercurial