def _page_erase_program_double_buffer(self, progress_cb=_stub_progress):
        actual_page_erase_count = 0
        actual_page_erase_weight = 0
        progress = 0

        progress_cb(0.0)

        # Fill in same flag for all pages. This is done up front so we're not trying
        # to read from flash while simultaneously programming it.
        progress = self._scan_pages_for_same(progress_cb)

        # Set up page and buffer info.
        error_count = 0
        current_buf = 0
        next_buf = 1
        page, i = self._next_nonsame_page(0)

        # Make sure there are actually pages to program differently from current flash contents.
        if page is not None:
            # Load first page buffer
            self.flash.loadPageBuffer(current_buf, page.addr, page.data)

            while page is not None:
                assert page.same is not None

                # Kick off this page program.
                current_addr = page.addr
                current_weight = page.getEraseProgramWeight()
                self.flash.erasePage(current_addr)
                self.flash.startProgramPageWithBuffer(current_buf, current_addr) #, erase_page=True)
                actual_page_erase_count += 1
                actual_page_erase_weight += page.getEraseProgramWeight()

                # Get next page and load it.
                page, i = self._next_nonsame_page(i)
                if page is not None:
                    self.flash.loadPageBuffer(next_buf, page.addr, page.data)

                # Wait for the program to complete.
                result = self.flash.waitForCompletion()

                # check the return code
                if result != 0:
                    logging.error('programPage(0x%x) error: %i', current_addr, result)
                    error_count += 1
                    if error_count > self.max_errors:
                        logging.error("Too many page programming errors, aborting program operation")
                        break

                # Swap buffers.
                temp = current_buf
                current_buf = next_buf
                next_buf = temp

                # Update progress
                progress += current_weight
                if self.page_erase_weight > 0:
                    progress_cb(float(progress) / float(self.page_erase_weight))

        progress_cb(1.0)

        logging.debug("Estimated page erase count: %i", self.page_erase_count)
        logging.debug("Actual page erase count: %i", actual_page_erase_count)

        return FlashBuilder.FLASH_PAGE_ERASE
Checks if the layer is inside the packet.
dataset/ETHPy150Open mbedmicro/pyOCD/pyOCD/flash/flash_builder.py/FlashBuilder._page_erase_program_double_buffer--crossover with--dataset/ETHPy150Open KimiNewt/pyshark/src/pyshark/packet/packet.py/Packet.__contains__