def _ParsePCIDeviceTestData(self, test_data): """Given test_data dictionary, parse it using PCIDevicesInfoParser.""" parser = linux_file_parser.PCIDevicesInfoParser() pathspecs = [] file_objs = [] # Populate stats, file_ojbs, kb_ojbs lists needed by the parser. for filename, data in iteritems(test_data): pathspec = rdf_paths.PathSpec(path=filename, pathtype="OS") file_obj = io.BytesIO(data) pathspecs.append(pathspec) file_objs.append(file_obj) return list(parser.ParseFiles(None, pathspecs, file_objs))
def _ParsePCIDeviceTestData(self, test_data): """Given test_data dictionary, parse it using PCIDevicesInfoParser.""" parser = linux_file_parser.PCIDevicesInfoParser() stats = [] file_objs = [] kb_objs = [] # Populate stats, file_ojbs, kb_ojbs lists needed by the parser. for filename, data in iteritems(test_data): pathspec = rdf_paths.PathSpec(path=filename, pathtype="OS") stat = rdf_client_fs.StatEntry(pathspec=pathspec) file_obj = io.BytesIO(data) stats.append(stat) file_objs.append(file_obj) kb_objs.append(None) return list(parser.ParseMultiple(stats, file_objs, kb_objs))