def _PopulateQueryResult(self, result, count, offset, compile, first_result):
    Check(offset >= 0, 'Offset must be >= 0')

    offset = min(offset, self.__count - self.__offset)
    limited_offset = min(offset, _MAX_QUERY_OFFSET)
    if limited_offset:
      self.__offset += limited_offset
      result.set_skipped_results(limited_offset)

    if compile and result.skipped_results() > 0:
      self._EncodeCompiledCursor(
          self.__results[self.__offset - 1].entity,
          result.mutable_skipped_results_compiled_cursor())
    if offset == limited_offset and count:

      if _MAXIMUM_RESULTS > count:
        count = _MAXIMUM_RESULTS
      results = self.__results[self.__offset:self.__offset + count]
      count = len(results)
      self.__offset += count





      records = [LoadRecord(record, self.keys_only, self.property_names)
                 for record in results]
      entities = [record.entity for record in records]
      versions = [record.metadata.updated_version() for record in records
                  if record.metadata.has_updated_version()]

      result.result_list().extend(entities)
      if len(versions) == len(entities):
        result.version_list().extend(versions)

      if compile:
        for record in results:
          self._EncodeCompiledCursor(record.entity,
                                     result.add_result_compiled_cursor())

    if self.__offset:

      self.__last_result = self.__results[self.__offset - 1].entity

    result.set_more_results(self.__offset < self.__count)
    self._PopulateResultMetadata(result, compile,
                                 first_result, self.__last_result)
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_stub_util.py/ListCursor._PopulateQueryResult/swapped operands of `>`