#NEWLINE# def _convert_FunctionDef( self , n ) : #NEWLINE# #INDENT# c = self . _convert #NEWLINE# args = n . args #NEWLINE# arg_nodes = [ c ( x ) for x in args . args ] #NEWLINE# for ( i , default ) in enumerate ( reversed ( args . defaults ) ) : #NEWLINE# #INDENT# arg_node = arg_nodes [ ( ( - 1 ) - i ) ] #NEWLINE# if isinstance ( arg_node , Tuple ) : #NEWLINE# #INDENT# raise RuntimeError ( 'Tuple arguments in function def not supported.' ) #NEWLINE# #UNINDENT# arg_node . value_node = c ( default ) #NEWLINE# #UNINDENT# if ( pyversion < ( 3 , ) ) : #NEWLINE# #INDENT# kwarg_nodes = [ ] #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# kwarg_nodes = [ c ( x ) for x in args . kwonlyargs ] #NEWLINE# for ( i , default ) in enumerate ( reversed ( args . kw_defaults ) ) : #NEWLINE# #INDENT# kwarg_nodes [ ( ( - 1 ) - i ) ] . value_node = c ( default ) #NEWLINE# #UNINDENT# #UNINDENT# if ( pyversion < ( 3 , ) ) : #NEWLINE# #INDENT# args_node = ( Arg ( args . vararg , None , None ) if args . vararg else None ) #NEWLINE# kwargs_node = ( Arg ( args . kwarg , None , None ) if args . kwarg else None ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( pyversion < ( 3 , 4 ) ) : #NEWLINE# #INDENT# args_node = kwargs_node = None #NEWLINE# if args . vararg : #NEWLINE# #INDENT# args_node = Arg ( args . vararg , None , c ( args . varargannotation ) ) #NEWLINE# #UNINDENT# if args . kwarg : #NEWLINE# #INDENT# kwargs_node = Arg ( args . kwarg , None , c ( args . kwargannotation ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# args_node = c ( args . vararg ) #NEWLINE# kwargs_node = c ( args . kwarg ) #NEWLINE# #UNINDENT# #UNINDENT# returns = ( None if ( pyversion < ( 3 , ) ) else c ( n . returns ) ) #NEWLINE# node = FunctionDef ( n . name , [ c ( x ) for x in n . decorator_list ] , returns , arg_nodes , kwarg_nodes , args_node , kwargs_node , [ ] ) #NEWLINE# if docheck : #NEWLINE# #INDENT# assert isinstance ( node . args_node , ( NoneType , Arg ) ) #NEWLINE# assert isinstance ( node . kwargs_node , ( NoneType , Arg ) ) #NEWLINE# for x in ( node . arg_nodes + node . kwarg_nodes ) : #NEWLINE# #INDENT# assert isinstance ( x , Arg ) #NEWLINE# #UNINDENT# #UNINDENT# self . _stack . append ( ( node . body_nodes , n . body ) ) #NEWLINE# return node