<s> from __future__ import division <EOL> from vistrails . core . vistrail . location import Location <EOL> import vistrails . db . services . action <EOL> def create_action ( op_list ) : <EOL> if len ( op_list ) > <NUM_LIT:0> : <EOL> from vistrails . core . vistrail . action import Action <EOL> action = vistrails . db . services . action . create_action ( op_list ) <EOL> Action . convert ( action ) <EOL> return action <EOL> return None <EOL> def create_action_from_ops ( ops , simplify = False ) : <EOL> if len ( ops ) > <NUM_LIT:0> : <EOL> from vistrails . core . vistrail . action import Action <EOL> action = vistrails . db . services . action . create_action_from_ops ( ops , simplify ) <EOL> Action . convert ( action ) <EOL> return action <EOL> return None <EOL> def merge_actions ( action_list ) : <EOL> ops = [ ] <EOL> for action in action_list : <EOL> ops . extend ( action . operations ) <EOL> return create_action_from_ops ( ops , True ) <EOL> def create_paste_action ( pipeline , id_scope , id_remap = None ) : <EOL> action_list = [ ] <EOL> if id_remap is None : <EOL> id_remap = { } <EOL> for module in pipeline . modules . itervalues ( ) : <EOL> module = module . do_copy ( True , id_scope , id_remap ) <EOL> action_list . append ( ( '<STR_LIT>' , module ) ) <EOL> for connection in pipeline . connections . itervalues ( ) : <EOL> connection = connection . do_copy ( True , id_scope , id_remap ) <EOL> action_list . append ( ( '<STR_LIT>' , connection ) ) <EOL> action = create_action ( action_list ) <EOL> for ( child , _ , _ ) in action . db_children ( ) : <EOL> child . is_dirty = True <EOL> return action </s>
