#NEWLINE# def gen_params( raw_params ) : #NEWLINE# #INDENT# "\n    Generator that yields tuples of (name, default_value) for each parameter in the list\n    If no default is given, then it is default_value is None (not Leaf(token.NAME, 'None'))\n    " #NEWLINE# assert ( ( raw_params [ 0 ] . type == token . STAR ) and ( len ( raw_params ) > 2 ) ) #NEWLINE# curr_idx = 2 #NEWLINE# max_idx = len ( name ) #NEWLINE# while ( curr_idx < max_idx ) : #NEWLINE# #INDENT# curr_item = raw_params [ curr_idx ] #NEWLINE# prev_item = curr_item . prev_sibling #NEWLINE# if ( curr_item . type != token . NAME ) : #NEWLINE# #INDENT# curr_idx += 1 #NEWLINE# continue #NEWLINE# #UNINDENT# if ( ( prev_item is not None ) and ( prev_item . type == token . DOUBLESTAR ) ) : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# name = curr_item . value #NEWLINE# nxt = curr_item . next_sibling #NEWLINE# if ( ( nxt is not None ) and ( nxt . type == token . EQUAL ) ) : #NEWLINE# #INDENT# default_value = nxt . next_sibling #NEWLINE# curr_idx += 2 #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# default_value = None #NEWLINE# #UNINDENT# ( yield ( name , default_value ) ) #NEWLINE# curr_idx += 1