def generate_addons(num, owner, app_name):
 post_save.disconnect(update_search_index, sender=Addon, dispatch_uid='addons.search.index')
 featured_categories = collections.defaultdict(int)
 user = generate_user(owner)
 app = APPS[app_name]
 default_icons = [x[0] for x in icons() if x[0].startswith('icon/')]
 for (name, category) in _yield_name_and_cat(num, app=app, type=ADDON_EXTENSION):
  icon_type = random.choice(default_icons)
  addon = create_addon(name=name, icon_type=icon_type, application=app)
  generate_addon_user_and_category(addon, user, category)
  generate_addon_preview(addon)
  generate_translations(addon)
  if (featured_categories[category] < 5):
   generate_collection(addon, app)
   featured_categories[category] += 1
  generate_ratings(addon, 5)

def generate_addons ( num , owner , app_name ) : post_save . disconnect ( update_search_index , sender = Addon , dispatch_uid = 'addons.search.index' ) featured_categories = collections . defaultdict ( int ) user = generate_user ( owner ) app = APPS [ app_name ] default_icons = [ x [ 0 ] for x in icons ( ) if x [ 0 ] . startswith ( 'icon/' ) ] for ( name , category ) in _yield_name_and_cat ( num , app = app , type = ADDON_EXTENSION ) : icon_type = random . choice ( default_icons ) addon = create_addon ( name = name , icon_type = icon_type , application = app ) generate_addon_user_and_category ( addon , user , category ) generate_addon_preview ( addon ) generate_translations ( addon ) if ( featured_categories [ category ] < 5 ) : generate_collection ( addon , app ) featured_categories [ category ] += 1 generate_ratings ( addon , 5 )
generate num addons for the given owner and app_name .