Utilities/ClassBrowsers/jsclbr.py

branch
Py2 comp.
changeset 3057
10516539f238
parent 2847
1843ef6e2656
parent 2997
7f0ef975da9e
child 3145
a9de05d4a22f
diff -r 9986ec0e559a -r 10516539f238 Utilities/ClassBrowsers/jsclbr.py
--- a/Utilities/ClassBrowsers/jsclbr.py	Tue Oct 15 22:03:54 2013 +0200
+++ b/Utilities/ClassBrowsers/jsclbr.py	Fri Oct 18 23:00:41 2013 +0200
@@ -42,7 +42,8 @@
     """
     Class to represent a Python function.
     """
-    def __init__(self, module, name, file, lineno, signature='', separator=','):
+    def __init__(self, module, name, file, lineno, signature='',
+                 separator=','):
         """
         Constructor
         
@@ -113,9 +114,13 @@
     
     def __visit(self, root):
         """
-        Private method implementing the visit logic delegating to interesting methods.
+        Private method implementing the visit logic delegating to interesting
+        methods.
+        
+        @param root root node to visit
         """
-        call = lambda n: getattr(self, "visit_{0}".format(n.type), self.visit_noop)(n)
+        call = lambda n: getattr(self, "visit_{0}".format(n.type),
+                                 self.visit_noop)(n)
         call(root)
         for node in root:
             self.__visit(node)
@@ -139,7 +144,8 @@
            node.functionForm == "declared_form":
             if self.__stack and self.__stack[-1].endlineno < node.line:
                 del self.__stack[-1]
-            endline = node.line + self.__source.count('\n', node.start, node.end)
+            endline = node.line + self.__source.count(
+                '\n', node.start, node.end)
             if getattr(node, "params", None):
                 func_sig = ", ".join([p.value for p in node.params])
             else:
@@ -174,7 +180,8 @@
         if node.type == "property_init" and node[1].type == "function":
             if self.__stack and self.__stack[-1].endlineno < node[0].line:
                 del self.__stack[-1]
-            endline = node[0].line + self.__source.count('\n', node.start, node[1].end)
+            endline = node[0].line + self.__source.count(
+                '\n', node.start, node[1].end)
             if getattr(node[1], "params", None):
                 func_sig = ", ".join([p.value for p in node[1].params])
             else:
@@ -214,16 +221,17 @@
             if self.__stack:
                 # function variables
                 for var in node:
-                    attr = Attribute(self.__module, var.name, self.__file, var.line)
+                    attr = Attribute(
+                        self.__module, var.name, self.__file, var.line)
                     self.__stack[-1]._addattribute(attr)
             else:
                 # global variable
                 if "@@Globals@@" not in self.__dict:
-                    self.__dict["@@Globals@@"] = \
-                        ClbrBaseClasses.ClbrBase(self.__module, "Globals", self.__file, 0)
+                    self.__dict["@@Globals@@"] = ClbrBaseClasses.ClbrBase(
+                        self.__module, "Globals", self.__file, 0)
                 for var in node:
-                    self.__dict["@@Globals@@"]._addglobal(
-                        Attribute(self.__module, var.name, self.__file, var.line))
+                    self.__dict["@@Globals@@"]._addglobal(Attribute(
+                        self.__module, var.name, self.__file, var.line))
     
     def visit_const(self, node):
         """
@@ -245,8 +253,8 @@
             else:
                 # global variable
                 if "@@Globals@@" not in self.__dict:
-                    self.__dict["@@Globals@@"] = \
-                        ClbrBaseClasses.ClbrBase(self.__module, "Globals", self.__file, 0)
+                    self.__dict["@@Globals@@"] = ClbrBaseClasses.ClbrBase(
+                        self.__module, "Globals", self.__file, 0)
                 for var in node:
                     self.__dict["@@Globals@@"]._addglobal(
                         Attribute(self.__module, "const " + var.name,
@@ -254,13 +262,13 @@
 
 
 def readmodule_ex(module, path=[]):
-    '''
+    """
     Read a JavaScript file and return a dictionary of functions and variables.
 
     @param module name of the JavaScript file (string)
     @param path path the file should be searched in (list of strings)
     @return the resulting dictionary
-    '''
+    """
     global _modules
     
     dict = {}

eric ide

mercurial