def find_input(self, input_format): """ Find an input class for a given format input_format - see utils.input.dataformats """ input_cls = find_needed_input(input_format) return input_cls
def read_and_reformat(self, output_format, stream, stream_format): """ Reformat data according to needed formats """ #Find an appropriate input class input_cls = find_needed_input(stream_format) input_inst = input_cls() input_inst.read_input(stream) #find a formatter class and convert data formatter = find_needed_formatter(stream_format, output_format) formatter_inst = formatter() formatter_inst.read_input(input_inst.get_data(), stream_format) data = formatter_inst.get_data(output_format) return data