#NEWLINE# def to_dict( self ) : #NEWLINE# #INDENT# '\n        Serialize the DSL object to plain dict\n        ' #NEWLINE# d = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( pname , value ) in iteritems ( self . _params ) : #NEWLINE# #INDENT# pinfo = self . _param_defs . get ( pname ) #NEWLINE# if ( pinfo and ( 'type' in pinfo ) ) : #NEWLINE# #INDENT# if ( value in ( { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , [ ] ) ) : #NEWLINE# #INDENT# continue #NEWLINE# #UNINDENT# if pinfo . get ( 'multi' ) : #NEWLINE# #INDENT# value = list ( map ( ( lambda x : x . to_dict ( ) ) , value ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if pinfo . get ( 'hash' ) : #NEWLINE# #INDENT# value = dict ( ( ( k , v . to_dict ( ) ) for ( k , v ) in iteritems ( value ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# value = value . to_dict ( ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# if hasattr ( value , 'to_dict' ) : #NEWLINE# #INDENT# value = value . to_dict ( ) #NEWLINE# #UNINDENT# #UNINDENT# d [ pname ] = pinfo #NEWLINE# #UNINDENT# return { #NEWLINE# #INDENT# self . name : d , #NEWLINE# #UNINDENT# }