eric6/Utilities/ModuleParser.py

changeset 8205
4a0f1f896341
parent 8131
f2129bb79269
child 8207
d359172d11be
diff -r fd477cded1c1 -r 4a0f1f896341 eric6/Utilities/ModuleParser.py
--- a/eric6/Utilities/ModuleParser.py	Thu Apr 08 17:27:12 2021 +0200
+++ b/eric6/Utilities/ModuleParser.py	Thu Apr 08 18:27:47 2021 +0200
@@ -874,7 +874,8 @@
         Private method to scan the source text of a Python module and retrieve
         the relevant information.
         
-        @param src the source text to be scanned (string)
+        @param src the source text to be scanned
+        @type str
         """
         lineno, last_lineno_pos = 1, 0
         classstack = []  # stack of (class, indent) pairs
@@ -927,10 +928,7 @@
                         if cur_class is None:
                             continue
                         
-                        if (
-                            isinstance(cur_class, Class) or
-                            isinstance(cur_class, RbModule)
-                        ):
+                        if isinstance(cur_class, (Class, RbModule)):
                             # it's a class/module method
                             f = Function(None, meth_name,
                                          None, lineno, meth_sig)
@@ -1087,7 +1085,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 = (
@@ -1119,7 +1117,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
                     ):
                         attrName = m.group("AttributeName")
                         attr = Attribute(
@@ -1149,7 +1147,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:
@@ -1183,10 +1181,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():
@@ -1662,13 +1657,16 @@
                     if ext == '.ptl':
                         # Quixote page template
                         return (open(pathname), pathname,
+                        # __IGNORE_WARNING_Y115__
                                 ('.ptl', 'r', PTL_SOURCE))
                     elif ext == '.rb':
                         # Ruby source file
                         return (open(pathname), pathname,
+                        # __IGNORE_WARNING_Y115__
                                 ('.rb', 'r', RB_SOURCE))
                     else:
                         return (open(pathname), pathname,
+                        # __IGNORE_WARNING_Y115__
                                 (ext, 'r', PY_SOURCE))
             raise ImportError
     
@@ -1682,6 +1680,7 @@
     if isinstance(spec.loader, importlib.machinery.SourceFileLoader):
         ext = os.path.splitext(spec.origin)[-1]
         return (open(spec.origin), spec.origin, (ext, 'r', PY_SOURCE))
+        # __IGNORE_WARNING_Y115__
     
     raise ImportError
 

eric ide

mercurial