#NEWLINE# def _create_wrapper( self , n_pos , static_pairs , dynamic_keywords ) : #NEWLINE# #INDENT# static_pairs = tuple ( static_pairs ) #NEWLINE# key = ( n_pos , static_pairs , dynamic_keywords ) #NEWLINE# if ( key in self . wrappers ) : #NEWLINE# #INDENT# return self . wrappers [ key ] #NEWLINE# #UNINDENT# args = FormalArgs ( ) #NEWLINE# pos_vars = [ ] #NEWLINE# keyword_vars = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for i in xrange ( n_pos ) : #NEWLINE# #INDENT# if ( i < self . argcount ) : #NEWLINE# #INDENT# raw_name = self . varnames [ i ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# raw_name = ( 'input_%d' % i ) #NEWLINE# #UNINDENT# local_name = names . fresh ( raw_name ) #NEWLINE# args . add_positional ( local_name ) #NEWLINE# pos_vars . append ( Var ( local_name ) ) #NEWLINE# #UNINDENT# import ast_conversion #NEWLINE# for visible_name in dynamic_keywords : #NEWLINE# #INDENT# local_name = names . fresh ( visible_name ) #NEWLINE# args . add_positional ( local_name , visible_name ) #NEWLINE# keyword_vars [ visible_name ] = Var ( local_name ) #NEWLINE# if ( visible_name in self . defaults_dictionary ) : #NEWLINE# #INDENT# default_value = self . defaults_dictionary [ visible_name ] #NEWLINE# parakeet_value = ast_conversion . value_to_syntax ( default_value ) #NEWLINE# args . defaults [ local_name ] = parakeet_value #NEWLINE# #UNINDENT# #UNINDENT# for ( static_name , value ) in static_pairs : #NEWLINE# #INDENT# if isinstance ( value , Expr ) : #NEWLINE# #INDENT# assert isinstance ( value , Const ) #NEWLINE# keyword_vars [ static_name ] = value #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( value is not None ) : #NEWLINE# #INDENT# assert is_python_constant ( value ) , ( 'Unexpected type for static/staged value: %s : %s' % ( value , type ( value ) ) ) #NEWLINE# keyword_vars [ static_name ] = const ( value ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# result_expr = self . f ( * pos_vars , ** keyword_vars ) #NEWLINE# body = [ Return ( result_expr ) ] #NEWLINE# wrapper_name = ( '%s_wrapper_%d_%d' % ( self . name , n_pos , len ( dynamic_keywords ) ) ) #NEWLINE# wrapper_name = names . fresh ( wrapper_name ) #NEWLINE# untyped = UntypedFn ( name = wrapper_name , args = args , body = body ) #NEWLINE# self . wrappers [ key ] = untyped #NEWLINE# return untyped