def ProtoToIndexDefinition(proto):
 properties = []
 proto_index = proto.definition()
 for prop_proto in proto_index.property_list():
  prop_definition = Property(name=prop_proto.name())
  if (prop_proto.mode() == entity_pb.Index_Property.GEOSPATIAL):
   prop_definition.mode = 'geospatial'
  elif (prop_proto.direction() == entity_pb.Index_Property.DESCENDING):
   prop_definition.direction = 'desc'
  elif (prop_proto.direction() == entity_pb.Index_Property.ASCENDING):
   prop_definition.direction = 'asc'
  properties.append(prop_definition)
 index = Index(kind=proto_index.entity_type(), properties=properties)
 if proto_index.ancestor():
  index.ancestor = True
 return index

def ProtoToIndexDefinition ( proto ) : properties = [ ] proto_index = proto . definition ( ) for prop_proto in proto_index . property_list ( ) : prop_definition = Property ( name = prop_proto . name ( ) ) if ( prop_proto . mode ( ) == entity_pb . Index_Property . GEOSPATIAL ) : prop_definition . mode = 'geospatial' elif ( prop_proto . direction ( ) == entity_pb . Index_Property . DESCENDING ) : prop_definition . direction = 'desc' elif ( prop_proto . direction ( ) == entity_pb . Index_Property . ASCENDING ) : prop_definition . direction = 'asc' properties . append ( prop_definition ) index = Index ( kind = proto_index . entity_type ( ) , properties = properties ) if proto_index . ancestor ( ) : index . ancestor = True return index
transform individual index protocol buffer to index definition .