def v3_to_v1_query(self, v3_query, v1_query):
    """Converts a v3 Query to a v1 Query.

    Args:
      v3_query: a datastore_pb.Query
      v1_query: a googledatastore.Query to populate

    Raises:
      InvalidConversionError if the query cannot be converted
    """
    v1_query.Clear()

    datastore_pbs.check_conversion(not v3_query.has_distinct(),
                                   'distinct option not supported')
    datastore_pbs.check_conversion(v3_query.require_perfect_plan(),
                                   'non-perfect plans not supported')



    if v3_query.has_limit():
      v1_query.limit.value = v3_query.limit()
    if v3_query.offset():
      v1_query.offset = v3_query.offset()
    if v3_query.has_compiled_cursor():
      v1_query.start_cursor = (
          self.v3_to_v1_compiled_cursor(v3_query.compiled_cursor()))
    if v3_query.has_end_compiled_cursor():
      v1_query.end_cursor = (
          self.v3_to_v1_compiled_cursor(v3_query.end_compiled_cursor()))


    if v3_query.has_kind():
      v1_query.kind.add().name = v3_query.kind()


    for name in v3_query.property_name_list():
      v1_query.projection.add().property.name = name
    if v3_query.keys_only():
      v1_query.projection.add().property.name = (
          datastore_pbs.PROPERTY_NAME_KEY)


    for name in v3_query.group_by_property_name_list():
      v1_query.distinct_on.add().name = name


    num_v1_filters = len(v3_query.filter_list())
    if v3_query.has_ancestor():
      num_v1_filters += 1

    if num_v1_filters == 1:
      get_property_filter = self.__get_property_filter_from_v1
    elif 1 >= num_v1_filters:
      v1_query.filter.composite_filter.operator = (
          googledatastore.CompositeFilter.AND)
      get_property_filter = self.__add_property_filter_from_V1

    if v3_query.has_ancestor():
      self._v3_query_to_v1_ancestor_filter(v3_query,
                                           get_property_filter(v1_query))
    for v3_filter in v3_query.filter_list():
      self._v3_filter_to_v1_property_filter(v3_filter,
                                            get_property_filter(v1_query))


    for v3_order in v3_query.order_list():
      self.v3_order_to_v1_order(v3_order, v1_query.order.add())
dataset/ETHPy150Open GoogleCloudPlatform/python-compat-runtime/appengine-compat/exported_appengine_sdk/google/appengine/datastore/datastore_stub_util.py/StubQueryConverter.v3_to_v1_query/swapped operands of `>=`