#NEWLINE# @ gen . coroutine #NEWLINE# def _CreateNewEpisodesAndPosts( self , new_ep_dicts , new_ids ) : #NEWLINE# #INDENT# 'Creates new episodes and posts within those episodes based on a list returned by\n    _CheckCopySources.\n\n    If an episode or post id does not exist in "new_ids", it is not created. The "new_ids"\n    set is created by _CheckCopyTargets.\n    ' #NEWLINE# tasks = [ ] #NEWLINE# for new_ep_dict in deepcopy ( new_ep_dicts ) : #NEWLINE# #INDENT# ep_id = new_ep_dict [ 'episode_id' ] #NEWLINE# ph_ids = [ ph_id for ph_id in new_ep_dict . pop ( 'photo_ids' ) if ( Post . ConstructPostId ( ep_id , ph_id ) in new_ids ) ] #NEWLINE# if ( ep_id in new_ids ) : #NEWLINE# #INDENT# tasks . append ( gen . Task ( Episode . CreateNew , self . _client , ** new_ep_dict ) ) #NEWLINE# #UNINDENT# for ph_id in ph_ids : #NEWLINE# #INDENT# post = Post . CreateFromKeywords ( episode_id = ep_id , photo_id = ph_id ) #NEWLINE# post . labels . remove ( Post . UNSHARED ) #NEWLINE# post . labels . remove ( Post . REMOVED ) #NEWLINE# tasks . append ( gen . Task ( post . Update , self . _client ) ) #NEWLINE# #UNINDENT# #UNINDENT# ( yield tasks )