def convert(self): conv_obj = self.__converter_cls() input_dict = dict( [(d.format, d.file) for d in self.__input_data_list] ) output_tup = zip(self.__output_format_list, self.output_filename_list) conv_obj.set_input_dict( input_dict ) conv_obj.set_output_dict( dict(output_tup) ) # run converter command and get files fn_dict = conv_obj.run_convert() odata_list = [] for fmt, fn in output_tup: odata = Data( inpd.project, type=inpd.type) odata.format = fmt if os.path.exists(fn): odata.filename = fn else: raise ConverterCommandException() odata_list.append( odata ) self.__output_data_list = odata_list
def convert(self): conv_cls1, conv_cls2 = self.__converter_cls_list # parser parser = conv_cls1() file_dict = dict([(d.format, d.file) for d in self.__input_data_list]) parser.set_file_dict( file_dict ) # formatter formatter = conv_cls2() formatter.set_ndo( parser.get_ndo() ) file_dict = formatter.get_file_dict() odata_list = [] for out_fmt in self.__output_format_list: odata = Data( inpd.project, type=inpd.type) odata.format = out_fmt file = file_dict[out_fn] if file: odata.file = file else: raise FormatterError() odata_list.append( odata ) self.__output_data_list = odata_list
def convert(self): inp_d_list = self.__input_data_list out_f_list = self.__output_filename_list for d, file in zip(inp_d_list, out_f_list): odata = Data( d.project, type=d.type) odata.format = d.format odata.file = file self.__output_data_list.append(odata)
def convert(self): inp_d_list = self.__input_data_list file_dict = dict([(d.format, d.file) for d in self.__input_data_list]) parser = self.__parser_cls() parser.set_file_dict( file_dict ) odata = Data( inp_d_list[0].project, type=inp_d_list[0].type) odata.format = 'NagaraData' odata.ndo = parser.get_ndo() self.__output_data = odata
def convert(self): inpd = self.__input_data formatter = self.__formatter_cls() formatter.set_ndo( inpd.ndo ) file_dict = formatter.get_file_dict() odata_list = [] for out_fmt in self.__output_format_list: odata = Data( inpd.project, type=inpd.type) odata.format = out_fmt file = file_dict[out_fn] if file: odata.file = file else: raise FormatterError() odata_list.append( odata ) self.__output_data_list = odata_list