def _CopyQueryOptionsToProtocolBuffer(query, offset, limit, number_found_accuracy, cursor, cursor_type, ids_only, returned_fields, snippeted_fields, returned_expressions, sort_options, params):
 if offset:
  params.set_offset(offset)
 params.set_limit(limit)
 params.set_matched_count_accuracy(number_found_accuracy)
 if cursor:
  params.set_cursor(cursor.encode('utf-8'))
 params.set_cursor_type(cursor_type)
 if ids_only:
  params.set_keys_only(ids_only)
 if (returned_fields or snippeted_fields or returned_expressions):
  field_spec_pb = params.mutable_field_spec()
  for field in returned_fields:
   field_spec_pb.add_name(field.encode('utf-8'))
  for snippeted_field in snippeted_fields:
   expression = (u'snippet(%s, %s)' % (_QuoteString(query), snippeted_field))
   _CopyFieldExpressionToProtocolBuffer(FieldExpression(name=snippeted_field, expression=expression.encode('utf-8')), field_spec_pb.add_expression())
  for expression in returned_expressions:
   _CopyFieldExpressionToProtocolBuffer(expression, field_spec_pb.add_expression())
 if (sort_options is not None):
  _CopySortOptionsToProtocolBuffer(sort_options, params)

def _CopyQueryOptionsToProtocolBuffer ( query , offset , limit , number_found_accuracy , cursor , cursor_type , ids_only , returned_fields , snippeted_fields , returned_expressions , sort_options , params ) : if offset : params . set_offset ( offset ) params . set_limit ( limit ) params . set_matched_count_accuracy ( number_found_accuracy ) if cursor : params . set_cursor ( cursor . encode ( 'utf-8' ) ) params . set_cursor_type ( cursor_type ) if ids_only : params . set_keys_only ( ids_only ) if ( returned_fields or snippeted_fields or returned_expressions ) : field_spec_pb = params . mutable_field_spec ( ) for field in returned_fields : field_spec_pb . add_name ( field . encode ( 'utf-8' ) ) for snippeted_field in snippeted_fields : expression = ( u'snippet(%s, %s)' % ( _QuoteString ( query ) , snippeted_field ) ) _CopyFieldExpressionToProtocolBuffer ( FieldExpression ( name = snippeted_field , expression = expression . encode ( 'utf-8' ) ) , field_spec_pb . add_expression ( ) ) for expression in returned_expressions : _CopyFieldExpressionToProtocolBuffer ( expression , field_spec_pb . add_expression ( ) ) if ( sort_options is not None ) : _CopySortOptionsToProtocolBuffer ( sort_options , params )
copies fields of queryoptions to params protobuf .