Example #1
0
 def visitFunction(self, node):
     fc = {}
     get_function_calls(node, fc)
     func = self.system.pushFunction(node.name, node.doc, fc)
     if node.lineno is not None:
         func.linenumber = node.lineno
     # ast.Function has a pretty lame representation of
     # arguments. Let's convert it to a nice concise format
     # somewhat like what inspect.getargspec returns
     argnames = node.argnames[:]
     kwname = starargname = None
     if node.kwargs:
         kwname = argnames.pop(-1)
     if node.varargs:
         starargname = argnames.pop(-1)
     defaults = []
     for default in node.defaults:
         try:
             defaults.append(ast_pp.pp(default))
         except (KeyboardInterrupt, SystemExit):
             raise
         except Exception, e:
             self.system.warning("unparseable default", "%s: %s %r" %
                                 (e.__class__.__name__, e, default))
             defaults.append('???')
Example #2
0
 def visitFunction(self, node):
     fc = {}
     get_function_calls(node, fc)
     func = self.system.pushFunction(node.name, node.doc, fc)
     if node.lineno is not None:
         func.linenumber = node.lineno
     # ast.Function has a pretty lame representation of
     # arguments. Let's convert it to a nice concise format
     # somewhat like what inspect.getargspec returns
     argnames = node.argnames[:]
     kwname = starargname = None
     if node.kwargs:
         kwname = argnames.pop(-1)
     if node.varargs:
         starargname = argnames.pop(-1)
     defaults = []
     for default in node.defaults:
         try:
             defaults.append(ast_pp.pp(default))
         except (KeyboardInterrupt, SystemExit):
             raise
         except Exception, e:
             self.system.warning(
                 "unparseable default",
                 "%s: %s %r" % (e.__class__.__name__, e, default))
             defaults.append('???')
Example #3
0
 def visitClass(self, node):
     cls = self.system.pushClass(node.name, node.doc)
     if node.lineno is not None:
         cls.linenumber = node.lineno
     for n in node.bases:
         str_base = ast_pp.pp(n)
         cls.rawbases.append(str_base)
         base = cls.dottedNameToFullName(str_base)
         cls.bases.append(base)
     self.default(node)
     self.system.popClass()
Example #4
0
 def visitClass(self, node):
     cls = self.system.pushClass(node.name, node.doc)
     if node.lineno is not None:
         cls.linenumber = node.lineno
     for n in node.bases:
         str_base = ast_pp.pp(n)
         cls.rawbases.append(str_base)
         base = cls.dottedNameToFullName(str_base)
         cls.bases.append(base)
     self.default(node)
     self.system.popClass()