Ejemplo n.º 1
0
    def visit_Call(self, node):
	func = node.func.id
	args = [ self.visit( arg ) for arg in node.args ]
	if functions.is_utility( func ):
	    kargs = dict([ (keyword.arg, self.visit(keyword.value) ) for keyword in node.keywords ])
	    return functions.do_utility_func( func, args, self, kargs )
	elif functions.is_operation( func ):
	    return OpenCall( self,  args[0], func, args[1] if len(args) > 1 else None )
	elif functions.is_productivity( func ):
	    return functions.do_productivity_func( func, args, self )
	else:
	    raise ValueError( "Unsupported function: '%s'" % func )
Ejemplo n.º 2
0
 def visit_Call(self, node):
     func = node.func.id
     args = [self.visit(arg) for arg in node.args]
     if functions.is_utility(func):
         kargs = dict([(keyword.arg, self.visit(keyword.value))
                       for keyword in node.keywords])
         return functions.do_utility_func(func, args, self, kargs)
     elif functions.is_operation(func):
         return OpenCall(self, args[0], func,
                         args[1] if len(args) > 1 else None)
     elif functions.is_productivity(func):
         return functions.do_productivity_func(func, args, self)
     else:
         raise ValueError("Unsupported function: '%s'" % func)
Ejemplo n.º 3
0
 def visit_Call(self, node):
     func = node.func.id
     args = map( self.visit, node.args )
     if functions.is_utility( func ):
         return functions.do_utility_func( func, args, self )
     elif functions.is_operation( func ):
         return OpenCall( args[0], func, args[1] if len(args) > 1 else None )
     elif functions.is_productivity( func ):
         return functions.do_productivity_func( func, args, self )
     else:
         raise ValueError( "Unsupported function: '%s'" % func )
     if node.func.id == 'linreg':
         self.out_dim = self.dim - 1
     elif node.func.id == 'mean_norm':
         self.out_dim = 1
     params=[ 'data' ]
     if self.weighted:
         params.append('weights')
     params.extend( [ 'size', 'result' ] )  
     func_name = self.mangle( node.func.id )
     self.desired_funcs.append( ( node.func.id, func_name, self.weighted, self.dim, self.dim ) )
     return cpp_ast.FunctionCall(cpp_ast.CName(func_name), params )