def populate_option_groups_with_options(assignments, indexed_options):
 for (opt_group, opt_dest_list) in assignments.items():
  new_options = []
  for option_dest in assignments[opt_group]:
   for option in indexed_options[option_dest]:
    new_options.append(option)
  opt_group.add_options(new_options)
  opt_group.option_list = sorted(opt_group.option_list, key=(lambda item: item.get_opt_string()))

def populate_option_groups_with_options ( assignments , indexed_options ) : for ( opt_group , opt_dest_list ) in assignments . items ( ) : new_options = [ ] for option_dest in assignments [ opt_group ] : for option in indexed_options [ option_dest ] : new_options . append ( option ) opt_group . add_options ( new_options ) opt_group . option_list = sorted ( opt_group . option_list , key = ( lambda item : item . get_opt_string ( ) ) )
given a dictionary mapping :py:class:optiongroup and :py:class:optionparser objects to a list of strings represention option dests .