Utilities/ModuleParser.py

branch
Py2 comp.
changeset 3060
5883ce99ee12
parent 3058
0a02c433f52d
parent 3039
8dd0165d805d
child 3145
a9de05d4a22f
--- a/Utilities/ModuleParser.py	Fri Nov 01 15:48:48 2013 +0100
+++ b/Utilities/ModuleParser.py	Sun Nov 03 15:58:22 2013 +0100
@@ -190,7 +190,7 @@
         (?P<ConditionalDefineIndent> [ \t]* )
         (?: (?: if | elif ) [ \t]+ [^:]* | else [ \t]* ) : (?= \s* def)
     )
-""", re.VERBOSE | re.DOTALL | re.MULTILINE).search
+""", re.VERBOSE | re.DOTALL | re.MULTILINE).search      # __IGNORE_WARNING__
 
 _rb_getnext = re.compile(
 r"""
@@ -327,7 +327,7 @@
             end \b [^_]
         )
     )
-""", re.VERBOSE | re.DOTALL | re.MULTILINE).search
+""", re.VERBOSE | re.DOTALL | re.MULTILINE).search      # __IGNORE_WARNING__
 
 _hashsub = re.compile(r"""^([ \t]*)#[ \t]?""", re.MULTILINE).sub
 
@@ -569,14 +569,14 @@
                         thisindent -= deltaindent
                     else:
                         while conditionalsstack and \
-                              conditionalsstack[-1] >= thisindent:
+                                conditionalsstack[-1] >= thisindent:
                             del conditionalsstack[-1]
                             if deltastack:
                                 del deltastack[-1]
                         deltaindentcalculated = 0
                 # close all classes indented at least as much
                 while classstack and \
-                      classstack[-1][1] >= thisindent:
+                        classstack[-1][1] >= thisindent:
                     if classstack[-1][0] is not None and \
                        isinstance(classstack[-1][0], (Class, Function)):
                         # record the end line of this class or function
@@ -634,15 +634,15 @@
                             contents = ""
                     else:
                         contents = 1 and m.group("DocstringContents1") \
-                                   or m.group("DocstringContents2")
+                            or m.group("DocstringContents2")
                 if cur_obj:
                     cur_obj.addDescription(contents)
             
             elif m.start("String") >= 0:
                 if modulelevel and \
-                   (src[start - len('\r\n'):start] == '\r\n' or \
-                    src[start - len('\n'):start] == '\n' or \
-                    src[start - len('\r'):start] == '\r'):
+                   (src[start - len('\r\n'):start] == '\r\n' or
+                    src[start - len('\n'):start] == '\n' or
+                        src[start - len('\r'):start] == '\r'):
                     contents = m.group("StringContents3")
                     if contents is not None:
                         contents = _hashsub(r"\1", contents)
@@ -651,7 +651,7 @@
                             contents = ""
                         else:
                             contents = 1 and m.group("StringContents1") \
-                                       or m.group("StringContents2")
+                                or m.group("StringContents2")
                     if cur_obj:
                         cur_obj.addDescription(contents)
             
@@ -662,7 +662,7 @@
                 last_lineno_pos = start
                 # close all classes indented at least as much
                 while classstack and \
-                      classstack[-1][1] >= thisindent:
+                        classstack[-1][1] >= thisindent:
                     if classstack[-1][0] is not None and \
                        isinstance(classstack[-1][0], (Class,  Function)):
                         # record the end line of this class or function
@@ -756,7 +756,7 @@
 
             elif m.start("Import") >= 0:
                 # import module
-                names = [n.strip() for n in 
+                names = [n.strip() for n in
                          "".join(m.group("ImportList").splitlines())
                          .replace("\\", "").split(',')]
                 for name in names:
@@ -766,7 +766,7 @@
             elif m.start("ImportFrom") >= 0:
                 # from module import stuff
                 mod = m.group("ImportFromPath")
-                names = [n.strip() for n in 
+                names = [n.strip() for n in
                          "".join(m.group("ImportFromList").splitlines())
                          .replace("\\", "").split(',')]
                 if mod not in self.from_imports:
@@ -777,7 +777,7 @@
                 # a conditional function/method definition
                 thisindent = _indent(m.group("ConditionalDefineIndent"))
                 while conditionalsstack and \
-                      conditionalsstack[-1] >= thisindent:
+                        conditionalsstack[-1] >= thisindent:
                     del conditionalsstack[-1]
                     if deltastack:
                         del deltastack[-1]
@@ -814,8 +814,8 @@
                 thisindent = indent
                 indent += 1
                 meth_name = m.group("MethodName") or \
-                            m.group("MethodName2") or \
-                            m.group("MethodName3")
+                    m.group("MethodName2") or \
+                    m.group("MethodName3")
                 meth_sig = m.group("MethodSignature")
                 meth_sig = meth_sig and meth_sig.replace('\\\n', '') or ''
                 lineno = lineno + src.count('\n', last_lineno_pos, start)
@@ -826,7 +826,7 @@
                     meth_name = meth_name[6:]
                 # close all classes/modules indented at least as much
                 while classstack and \
-                      classstack[-1][1] >= thisindent:
+                        classstack[-1][1] >= thisindent:
                     if classstack[-1][0] is not None and \
                        isinstance(classstack[-1][0],
                                   (Class, Function, RbModule)):
@@ -834,7 +834,7 @@
                         classstack[-1][0].setEndLine(lineno - 1)
                     del classstack[-1]
                 while acstack and \
-                      acstack[-1][1] >= thisindent:
+                        acstack[-1][1] >= thisindent:
                     del acstack[-1]
                 if classstack:
                     csi = -1
@@ -904,7 +904,7 @@
                 last_lineno_pos = start
                 # close all classes/modules indented at least as much
                 while classstack and \
-                      classstack[-1][1] >= thisindent:
+                        classstack[-1][1] >= thisindent:
                     if classstack[-1][0] is not None and \
                        isinstance(classstack[-1][0],
                                   (Class, Function, RbModule)):
@@ -928,8 +928,8 @@
                 if class_name in parent_obj.classes:
                     cur_class = parent_obj.classes[class_name]
                 elif classstack and \
-                     isinstance(classstack[-1][0], Class) and \
-                     class_name == "self":
+                    isinstance(classstack[-1][0], Class) and \
+                        class_name == "self":
                     cur_class = classstack[-1][0]
                 else:
                     parent_obj.addClass(class_name, cur_class)
@@ -940,7 +940,7 @@
                 cur_obj = cur_class
                 classstack.append((cur_class, thisindent))
                 while acstack and \
-                      acstack[-1][1] >= thisindent:
+                        acstack[-1][1] >= thisindent:
                     del acstack[-1]
                 acstack.append(["public", thisindent])
                 # default access control is 'public'
@@ -953,7 +953,7 @@
                 last_lineno_pos = start
                 # close all classes/modules indented at least as much
                 while classstack and \
-                      classstack[-1][1] >= thisindent:
+                        classstack[-1][1] >= thisindent:
                     if classstack[-1][0] is not None and \
                        isinstance(classstack[-1][0],
                                   (Class, Function, RbModule)):
@@ -976,7 +976,7 @@
                 cur_obj = cur_class
                 classstack.append((cur_class, thisindent))
                 while acstack and \
-                      acstack[-1][1] >= thisindent:
+                        acstack[-1][1] >= thisindent:
                     del acstack[-1]
                 acstack.append(["public", thisindent])
                 # default access control is 'public'
@@ -1065,8 +1065,8 @@
                             # get rid of leading ':'
                             name = nv[0].strip()[1:]
                             attr = parent.getAttribute("@" + name) or \
-                                   parent.getAttribute("@@" + name) or \
-                                   Attribute(
+                                parent.getAttribute("@@" + name) or \
+                                Attribute(
                                     self.name, "@" + name, self.file, lineno)
                             if len(nv) == 1 or nv[1].strip() == "false":
                                 attr.setProtected()
@@ -1079,8 +1079,8 @@
                                 # get rid of leading ':'
                                 name = name.strip()[1:]
                                 attr = parent.getAttribute("@" + name) or \
-                                       parent.getAttribute("@@" + name) or \
-                                       Attribute(
+                                    parent.getAttribute("@@" + name) or \
+                                    Attribute(
                                         self.name, "@" + name, self.file,
                                         lineno)
                                 if access == "_accessor":

eric ide

mercurial