eric6/Utilities/ClassBrowsers/rbclbr.py

changeset 8205
4a0f1f896341
parent 7923
91e843545d9a
child 8217
385f60c94548
--- a/eric6/Utilities/ClassBrowsers/rbclbr.py	Thu Apr 08 17:27:12 2021 +0200
+++ b/eric6/Utilities/ClassBrowsers/rbclbr.py	Thu Apr 08 18:27:47 2021 +0200
@@ -347,10 +347,7 @@
             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, Module)):
                     # it's a method
                     f = Function(None, meth_name,
                                  file, lineno, meth_sig)
@@ -426,7 +423,7 @@
                 cls = classstack[-1][0]
                 if class_name in cls.classes:
                     cur_class = cls.classes[class_name]
-                elif cls.name == class_name or class_name == "self":
+                elif class_name in (cls.name, "self"):
                     cur_class = cls
                 else:
                     cls._addclass(class_name, cur_class)
@@ -500,7 +497,7 @@
                     if (
                         classstack[index][0] is not None and
                         not isinstance(classstack[index][0], Function) and
-                        not classstack[index][1] >= indent
+                        classstack[index][1] < indent
                     ):
                         parent = classstack[index][0]
                         actype = (
@@ -531,7 +528,7 @@
                 if (
                     classstack[index][0] is not None and
                     not isinstance(classstack[index][0], Function) and
-                    not classstack[index][1] >= indent
+                    classstack[index][1] < indent
                 ):
                     attr = Attribute(
                         module, m.group("AttributeName"), file, lineno)
@@ -551,7 +548,7 @@
                 if (
                     classstack[index][0] is not None and
                     not isinstance(classstack[index][0], Function) and
-                    not classstack[index][1] >= indent
+                    classstack[index][1] < indent
                 ):
                     parent = classstack[index][0]
                     if m.group("AttrType") is None:
@@ -580,7 +577,7 @@
                             )
                             if access == "_accessor":
                                 attr.setPublic()
-                            elif access == "_reader" or access == "_writer":
+                            elif access in ("_reader", "_writer"):
                                 if attr.isPrivate():
                                     attr.setProtected()
                                 elif attr.isProtected():

eric ide

mercurial