original_docstring: Parse queries which only allow filters and ascending-orders on __key__.
  
    Raises exceptions for illegal queries.
    Args:
      filters: the normalized filters of a query.
      orders: the normalized orders of a query.
    Returns:
       The key range (a ValueRange over datastore_types.Key) requested in the
       query.
    
docstring: Parse queries which only allow filters and ascending-orders on __key__.
  Raises exceptions for illegal queries.
docstring_tokens: Parse queries which only allow filters and ascending - orders on __key__ . Raises exceptions for illegal queries .
code: def ParseKeyFilteredQuery(filters, orders):
    """Parse queries which only allow filters and ascending-orders on __key__.
  
    Raises exceptions for illegal queries.
    Args:
      filters: the normalized filters of a query.
      orders: the normalized orders of a query.
    Returns:
       The key range (a ValueRange over datastore_types.Key) requested in the
       query.
    """
  
    remaining_filters = []
    key_range = ValueRange()
    key_prop = datastore_types.KEY_SPECIAL_PROPERTY
    for f in filters:
      op = f.op()
      if not (f.property_size() == 1 and
              f.property(0).name() == key_prop and
              not (op == datastore_pb.Query_Filter.IN or
                   op == datastore_pb.Query_Filter.EXISTS)):
        remaining_filters.append(f)
        continue
  
      val = f.property(0).value()
      Check(val.has_referencevalue(), '__key__ kind must be compared to a key')
      limit = datastore_types.FromReferenceProperty(val)
      key_range.Update(op, limit)
  
  
    remaining_orders = []
    for o in orders:
      if not (o.direction() == datastore_pb.Query_Order.ASCENDING and
              o.property() == datastore_types.KEY_SPECIAL_PROPERTY):
        remaining_orders.append(o)
      else:
        break
  
  
  
    Check(not remaining_filters,
          'Only comparison filters on ' + key_prop + ' supported')
    Check(not remaining_orders,
          'Only ascending order on ' + key_prop + ' supported')
  
    return key_range
code_tokens: def ParseKeyFilteredQuery ( filters , orders ) : remaining_filters = [ ] key_range = ValueRange ( ) key_prop = datastore_types . KEY_SPECIAL_PROPERTY for f in filters : op = f . op ( ) if not ( f . property_size ( ) == 1 and f . property ( 0 ) . name ( ) == key_prop and not ( op == datastore_pb . Query_Filter . IN or op == datastore_pb . Query_Filter . EXISTS ) ) : remaining_filters . append ( f ) continue val = f . property ( 0 ) . value ( ) Check ( val . has_referencevalue ( ) , '__key__ kind must be compared to a key' ) limit = datastore_types . FromReferenceProperty ( val ) key_range . Update ( op , limit ) remaining_orders = [ ] for o in orders : if not ( o . direction ( ) == datastore_pb . Query_Order . ASCENDING and o . property ( ) == datastore_types . KEY_SPECIAL_PROPERTY ) : remaining_orders . append ( o ) else : break Check ( not remaining_filters , 'Only comparison filters on ' + key_prop + ' supported' ) Check ( not remaining_orders , 'Only ascending order on ' + key_prop + ' supported' ) return key_range
short_docstring: Parse queries which only allow filters and ascending-orders on __key__.
short_docstring_tokens: Parse queries which only allow filters and ascending - orders on __key__ .
comment: """Parse queries which only allow filters and ascending-orders on __key__.
  
    Raises exceptions for illegal queries.
    Args:
      filters: the normalized filters of a query.
      orders: the normalized orders of a query.
    Returns:
       The key range (a ValueRange over datastore_types.Key) requested in the
       query.
    """