// WriteScorePairArray write score-member pair array resp
763346
func WriteScorePairArray(members [][]byte, scores []float64, withScores bool, buf *goetty.ByteBuf) {
	buf.WriteByte('*')
	if len(members) == 0 || len(scores) == 0 {
		buf.Write(NullArray)
		buf.Write(Delims)
	} else {
		if withScores {
			buf.Write(goetty.StringToSlice(strconv.Itoa(len(members) * 2)))
			buf.Write(Delims)
		} else {
			buf.Write(goetty.StringToSlice(strconv.Itoa(len(members))))
			buf.Write(Delims)

		}

		for i := 0; i < len(members); i++ {
			WriteBulk(members[i], buf)

			if withScores {
				WriteBulk(goetty.FormatFloat64ToBytes(scores[i]), buf)
			}
		}
	}
}
907348
func writeCopyPartErr(ctx context.Context, w http.ResponseWriter, err error, url *url.URL, browser bool) {
	switch err {
	case errInvalidRange:
		writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidCopyPartRange), url, browser)
		return
	case errInvalidRangeSource:
		writeErrorResponse(ctx, w, errorCodes.ToAPIErr(ErrInvalidCopyPartRangeSource), url, browser)
		return
	default:
		writeErrorResponse(ctx, w, toAPIError(ctx, err), url, browser)
		return
	}
}
1057006
func (w *Writer) WriteArray(count int) {
	w.b = AppendArray(w.b, count)
}
464492
func (s *VppDriverOperState) Write() error {
	key := fmt.Sprintf(vppOperPath, s.ID)
	return s.StateDriver.WriteState(key, s, json.Marshal)
}
773595
func (w *Writer) WriteAll(data [][]string) error {
	err := w.w.WriteAll(data)
	if err != nil {
		return err
	}
	w.r = len(data)
	return nil
}
532501
func (rw *responseWriter) WritePayload(c int, p []byte) error {
	_, err := rw.w.Write(p)
	return err
}
1116167
func (w *asyncUdsWriter) write(data []byte) (int, error) {
	conn, err := w.ensureConnection()
	if err != nil {
		return 0, err
	}

	conn.SetWriteDeadline(time.Now().Add(w.writeTimeout))
	n, err := conn.Write(data)

	if e, isNetworkErr := err.(net.Error); !isNetworkErr || !e.Temporary() {
		// err is not temporary, Statsd server disconnected, retry connecting at next packet
		w.unsetConnection()
		return 0, e
	}

	return n, err
}
62706
func (s *Score) WriteString(w io.Writer) {
	// check if calling func paniced before calling this
	if r := recover(); r != nil {
		// reset score for paniced functions
		s.Score = 0
	}
	fmt.Fprintf(w, "%v\n", s)
}
1062644
func (e entityMsgPackAccess) Write(resp *restful.Response, status int, v interface{}) error {
	if v == nil {
		resp.WriteHeader(status)
		// do not write a nil representation
		return nil
	}
	resp.WriteHeader(status)
	return msgpack.NewEncoder(resp).Encode(v)
}
552590
func (r *Response) WriteHeaderAndJson(status int, value interface{}, contentType string) error {
	return writeJSON(r, status, contentType, value)
}
190835
func (r *Response) WriteAsJson(value interface{}) error {
	return writeJSON(r, http.StatusOK, MIME_JSON, value)
}
385804
func (p *PlaybackDevice) Write(buffer interface{}) (samples int, err error) {
	bufferType := reflect.TypeOf(buffer)
	if !(bufferType.Kind() == reflect.Array ||
		bufferType.Kind() == reflect.Slice) {
		return 0, errors.New("Write requires an array type")
	}

	sizeError := errors.New("Write requires a matching sample size")
	switch bufferType.Elem().Kind() {
	case reflect.Int8:
		if p.formatSampleSize() != 1 {
			return 0, sizeError
		}
	case reflect.Int16:
		if p.formatSampleSize() != 2 {
			return 0, sizeError
		}
	case reflect.Int32, reflect.Float32:
		if p.formatSampleSize() != 4 {
			return 0, sizeError
		}
	case reflect.Float64:
		if p.formatSampleSize() != 8 {
			return 0, sizeError
		}
	default:
		return 0, errors.New("Write does not support this format")
	}

	val := reflect.ValueOf(buffer)
	length := val.Len()
	sliceData := val.Slice(0, length)

	var frames = C.snd_pcm_uframes_t(length / p.Channels)
	bufPtr := unsafe.Pointer(sliceData.Index(0).Addr().Pointer())

	ret := C.snd_pcm_writei(p.h, bufPtr, frames)
	if ret == -C.EPIPE {
		C.snd_pcm_prepare(p.h)
		return 0, ErrUnderrun
	} else if ret < 0 {
		return 0, createError("write error", C.int(ret))
	}
	samples = int(ret) * p.Channels
	return
}
812613
func (e *Engine) WriteValues(values map[string][]Value) error {
	e.mu.RLock()
	defer e.mu.RUnlock()

	if err := e.Cache.WriteMulti(values); err != nil {
		return err
	}

	return nil
}
447914
func (d *state) Write(p []byte) (written int, err error) {
	if d.state != spongeAbsorbing {
		panic("sha3: write to sponge after read")
	}
	if d.buf == nil {
		d.buf = d.storage[:0]
	}
	written = len(p)

	for len(p) > 0 {
		if len(d.buf) == 0 && len(p) >= d.rate {
			// The fast path; absorb a full "rate" bytes of input and apply the permutation.
			xorIn(d, p[:d.rate])
			p = p[d.rate:]
			keccakF1600(&d.a)
		} else {
			// The slow path; buffer the input until we can fill the sponge, and then xor it in.
			todo := d.rate - len(d.buf)
			if todo > len(p) {
				todo = len(p)
			}
			d.buf = append(d.buf, p[:todo]...)
			p = p[todo:]

			// If the sponge is full, apply the permutation.
			if len(d.buf) == d.rate {
				d.permute()
			}
		}
	}

	return
}
352977
func (rwops *RWops) WriteBE64(value uint64) uint {
	if rwops == nil {
		return 0
	}
	return uint(C.SDL_WriteBE64(rwops.cptr(), C.Uint64(value)))
}
73226
func (p *PCA9685Driver) PwmWrite(pin string, val byte) (err error) {
	i, err := strconv.Atoi(pin)
	if err != nil {
		return
	}
	v := gobot.ToScale(gobot.FromScale(float64(val), 0, 255), 0, 4096)
	return p.SetPWM(i, 0, uint16(v))
}
912519
func (p *PointsWriter) WritePoints(ctx context.Context, points []models.Point) error {
	p.mu.Lock()
	p.Points = append(p.Points, points...)
	err := p.Err
	p.mu.Unlock()
	return err
}