def _yield_name_and_cat(num, app=None, type=None):
 categories = generate_categories(app=app, type=type)
 if (num > len(generate_names())):
  base_names = islice(cycle(generate_names()), num)
  addons = ['{name} {i}'.format(name=name, i=i) for (i, name) in enumerate(base_names)]
 else:
  addons = random.sample(generate_names(), num)
 num_cats = len(categories)
 for (i, addon_name) in enumerate(addons):
  cat = categories[(i % num_cats)]
  (yield (addon_name, cat))

def _yield_name_and_cat ( num , app = None , type = None ) : categories = generate_categories ( app = app , type = type ) if ( num > len ( generate_names ( ) ) ) : base_names = islice ( cycle ( generate_names ( ) ) , num ) addons = [ '{name} {i}' . format ( name = name , i = i ) for ( i , name ) in enumerate ( base_names ) ] else : addons = random . sample ( generate_names ( ) , num ) num_cats = len ( categories ) for ( i , addon_name ) in enumerate ( addons ) : cat = categories [ ( i % num_cats ) ] ( yield ( addon_name , cat ) )
yield num tuples of for the given app and type .