<s> from __future__ import division <EOL> import copy <EOL> from vistrails . db . versions . v0_9_4 . domain import DBVistrail , DBAction , DBTag , DBModule , DBConnection , DBPortSpec , DBFunction , DBParameter , DBLocation , DBAdd , DBChange , DBDelete , DBAnnotation , DBPort , DBGroup , DBWorkflow , DBLog , DBAbstraction <EOL> def update_workflow ( old_obj , translate_dict ) : <EOL> return DBWorkflow . update_version ( old_obj . db_workflow , <EOL> translate_dict , DBWorkflow ( ) ) <EOL> def update_modules ( old_obj , trans_dict ) : <EOL> new_modules = [ ] <EOL> for obj in old_obj . db_modules : <EOL> if obj . vtType == '<STR_LIT>' : <EOL> new_modules . append ( DBModule . update_version ( obj , trans_dict ) ) <EOL> elif obj . vtType == '<STR_LIT>' : <EOL> new_modules . append ( DBAbstraction . update_version ( obj , <EOL> trans_dict ) ) <EOL> elif obj . vtType == '<STR_LIT>' : <EOL> new_modules . append ( DBGroup . update_version ( obj , trans_dict ) ) <EOL> return new_modules <EOL> def translateVistrail ( _vistrail ) : <EOL> def update_operations ( old_obj , trans_dict ) : <EOL> def update_abstractionRef ( old_obj , trans_dict ) : <EOL> def get_internal_version ( old_obj , trans_dict ) : <EOL> return str ( old_obj . db_version ) <EOL> def get_version ( old_obj , trans_dict ) : <EOL> return '<STR_LIT>' <EOL> new_dict = { '<STR_LIT>' : <EOL> { '<STR_LIT>' : get_internal_version , <EOL> '<STR_LIT:version>' : get_version } } <EOL> new_dict . update ( trans_dict ) <EOL> return DBAbstraction . update_version ( old_obj . db_data , new_dict ) <EOL> new_ops = [ ] <EOL> for obj in old_obj . db_operations : <EOL> if obj . vtType == '<STR_LIT>' : <EOL> if obj . db_what == '<STR_LIT>' : <EOL> trans_dict [ '<STR_LIT>' ] = { '<STR_LIT:data>' : update_abstractionRef } <EOL> new_op = DBAdd . update_version ( obj , trans_dict ) <EOL> new_op . db_what = '<STR_LIT>' <EOL> new_ops . append ( new_op ) <EOL> del trans_dict [ '<STR_LIT>' ] <EOL> else : <EOL> new_op = DBAdd . update_version ( obj , trans_dict ) <EOL> if obj . db_parentObjType == '<STR_LIT>' : <EOL> new_op . db_parentObjType = '<STR_LIT>' <EOL> new_ops . append ( new_op ) <EOL> elif obj . vtType == '<STR_LIT>' : <EOL> new_ops . append ( DBDelete . update_version ( obj , trans_dict ) ) <EOL> elif obj . vtType == '<STR_LIT>' : <EOL> if obj . db_what == '<STR_LIT>' : <EOL> trans_dict [ '<STR_LIT>' ] = { '<STR_LIT:data>' : update_abstractionRef } <EOL> new_op = DBChange . update_version ( obj , trans_dict ) <EOL> new_op . db_what = '<STR_LIT>' <EOL> new_ops . append ( new_op ) <EOL> del trans_dict [ '<STR_LIT>' ] <EOL> else : <EOL> new_op = DBChange . update_version ( obj , trans_dict ) <EOL> if obj . db_parentObjType == '<STR_LIT>' : <EOL> new_op . db_parentObjType = '<STR_LIT>' <EOL> new_ops . append ( new_op ) <EOL> return new_ops <EOL> translate_dict = { '<STR_LIT>' : { '<STR_LIT>' : update_workflow } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : update_operations } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : update_modules } } <EOL> vistrail = DBVistrail . update_version ( _vistrail , translate_dict ) <EOL> vistrail . db_version = '<STR_LIT>' <EOL> return vistrail <EOL> def translateWorkflow ( _workflow ) : <EOL> translate_dict = { '<STR_LIT>' : { '<STR_LIT>' : update_workflow } , <EOL> '<STR_LIT>' : { '<STR_LIT>' : update_modules } } <EOL> workflow = DBWorkflow . update_version ( _workflow , translate_dict ) <EOL> workflow . db_version = '<STR_LIT>' <EOL> return workflow <EOL> def translateLog ( _log ) : <EOL> translate_dict = { } <EOL> log = DBLog . update_version ( _log , translate_dict ) <EOL> log . db_version = '<STR_LIT>' <EOL> return log </s>
