def create_parser(self, file_handle): """ This function creates a Vel3dKWfpStcParser parser. """ parser = Vel3dKWfpStcParser(self.config, file_handle, self.exception_callback) return parser
def parse(basePythonCodePath, sourceFilePath, particleDataHdlrObj): config.add_configuration(os.path.join(basePythonCodePath, 'res', 'config', 'mi-logging.yml')) log = get_logger() parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.vel3d_k_wfp_stc', DataSetDriverConfigKeys.PARTICLE_CLASS: ['Vel3dKWfpStcMetadataParticle', 'Vel3dKWfpStcInstrumentParticle'] } def exception_callback(exception): log.debug("ERROR: %r", exception) particleDataHdlrObj.setParticleDataCaptureFailure() with open(sourceFilePath, 'rb') as stream_handle: parser = Vel3dKWfpStcParser(parser_config, stream_handle, exception_callback) driver = DataSetDriver(parser, particleDataHdlrObj) driver.processFileStream() return particleDataHdlrObj
def create_parser(self, file_handle, new_state): """ This function creates a Vel3dKWfpStcParser parser. """ if new_state is None: new_state = self.state parser = Vel3dKWfpStcParser(self.config, new_state, file_handle, self.state_callback, self.pub_callback, self.exception_callback) return parser
def parse(unused, source_file_path, particle_data_handler): parser_config = { DataSetDriverConfigKeys.PARTICLE_MODULE: 'mi.dataset.parser.vel3d_k_wfp_stc', DataSetDriverConfigKeys.PARTICLE_CLASS: ['Vel3dKWfpStcMetadataParticle', 'Vel3dKWfpStcInstrumentParticle'] } def exception_callback(exception): log.debug("ERROR: %r", exception) particle_data_handler.setParticleDataCaptureFailure() with open(source_file_path, 'rb') as stream_handle: parser = Vel3dKWfpStcParser(parser_config, stream_handle, exception_callback) driver = DataSetDriver(parser, particle_data_handler) driver.processFileStream() return particle_data_handler
def build_vel3d_k_wfp_stc_parser(self, parser_state, file_handle): """ Build and return the vel3d_k_wfp_stc parser. """ config = self._parser_config config.update({ 'particle_module': 'mi.dataset.parser.vel3d_k_wfp_stc', 'particle_class': [ 'Vel3dKWfpStcMetadataParticle', 'Vel3dKWfpStcInstrumentDataParticle' ] }) parser = Vel3dKWfpStcParser( config, parser_state, file_handle, lambda state, ingested: self._save_parser_state( state, DataTypeKey.VEL3D_K_WFP_STC, ingested), self._data_callback, self._sample_exception_callback) return parser