def __create_zip_archive(self): # Creates and fills the zip archive (adds files). self.add_info('Writes files into zip stream ...') self.__zip_stream = StringIO() zip_map = dict() zip_map[self.WORKLIST_FILE_NAME] = self.__worklist_stream zip_map[self.REPORT_FILE_NAME] = self.__report_stream create_zip_archive(zip_stream=self.__zip_stream, stream_map=zip_map)
def __summarize_streams(self): # Reads the zip streams and generates a new common archive. self.add_debug('Summarize zip archives ...') zip_map = dict() for zip_stream in self.__zip_streams: file_map = read_zip_archive(zip_stream) for fn, stream in file_map.iteritems(): zip_map[fn] = stream final_stream = StringIO() create_zip_archive(final_stream, zip_map) return final_stream
def __print_worklists(self): # Called in printing mode (:attr:`MODE_PRINT_WORKLISTS`). Non-rack # worklist for the same worklist label are merged by default. stream_map = self.__run_serial_writer() if not self.has_errors(): merge_map = self._merge_streams(stream_map) rack_transfer_stream = self._get_rack_transfer_stream(stream_map) if not self.has_errors(): file_map = self._get_file_map(merge_map, rack_transfer_stream) if not self.has_errors(): zip_stream = StringIO() create_zip_archive(zip_stream, file_map) self.return_value = zip_stream self.add_info('Serial working print completed.')