// ProducesFor gets the mediatypes for the operation
429957
func (s *Spec) ProducesFor(operation *spec.Operation) []string {
	if len(operation.Produces) == 0 {
		prod := make(map[string]struct{}, len(s.spec.Produces))
		for _, k := range s.spec.Produces {
			prod[k] = struct{}{}
		}
		return s.structMapKeys(prod)
	}

	prod := make(map[string]struct{}, len(operation.Produces))
	for _, c := range operation.Produces {
		prod[c] = struct{}{}
	}
	return s.structMapKeys(prod)
}
834095
func (m *MediaType) Encode(v interface{}) (*bytes.Buffer, error) {
	if v == nil {
		return nil, fmt.Errorf("Nothing to encode")
	}

	buf := new(bytes.Buffer)
	enc, err := m.Encoder(buf)
	if err != nil {
		return buf, err
	}

	return buf, enc.Encode(v)
}
725282
func (m *MockPackageCompiler) For(arg0 []job.Job, arg1 ui.Stage) ([]installation.CompiledPackageRef, error) {
	ret := m.ctrl.Call(m, "For", arg0, arg1)
	ret0, _ := ret[0].([]installation.CompiledPackageRef)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
857119
func (prod *Benchmark) Produce(workers *sync.WaitGroup) {
	prod.MessageControlLoop(prod.null)
}
799482
func NegotiateOutputMediaType(req *http.Request, ns runtime.NegotiatedSerializer, restrictions EndpointRestrictions) (MediaTypeOptions, runtime.SerializerInfo, error) {
	mediaType, ok := NegotiateMediaTypeOptions(req.Header.Get("Accept"), ns.SupportedMediaTypes(), restrictions)
	if !ok {
		supported, _ := MediaTypesForSerializer(ns)
		return mediaType, runtime.SerializerInfo{}, NewNotAcceptableError(supported)
	}
	// TODO: move into resthandler
	info := mediaType.Accepted
	if (mediaType.Pretty || isPrettyPrint(req)) && info.PrettySerializer != nil {
		info.Serializer = info.PrettySerializer
	}
	return mediaType, info, nil
}
956724
func (m *ArrayMap) For(visitor func(key int, value T) (broken bool)) {
	for key, value := range m.data {
		if m.validFlags.Get(key) {
			if visitor(key, value) {
				break
			}
		}
	}
}
1186975
func (m MultiRESTMapper) KindFor(resource unversioned.GroupVersionResource) (gvk unversioned.GroupVersionKind, err error) {
	for _, t := range m {
		gvk, err = t.KindFor(resource)
		if err == nil {
			return
		}
	}
	return
}
75958
func (w *WebService) Produces(contentTypes ...string) *WebService {
	w.produces = contentTypes
	return w
}
894545
func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource) (GenericInformer, error) {
	switch resource {
	// Group=example.apiserver.code-generator.k8s.io, Version=v1
	case v1.SchemeGroupVersion.WithResource("testtypes"):
		return &genericInformer{resource: resource.GroupResource(), informer: f.Example().V1().TestTypes().Informer()}, nil

		// Group=example.test.apiserver.code-generator.k8s.io, Version=v1
	case example2v1.SchemeGroupVersion.WithResource("testtypes"):
		return &genericInformer{resource: resource.GroupResource(), informer: f.SecondExample().V1().TestTypes().Informer()}, nil

	}

	return nil, fmt.Errorf("no informer found for %v", resource)
}
415179
func (s *Spec) ParametersFor(operationID string) []spec.Parameter {
	return s.SafeParametersFor(operationID, nil)
}
815136
func Mediatype(b []byte) []byte {
	j := 0
	start := 0
	inString := false
	for i, c := range b {
		if !inString && parse.IsWhitespace(c) {
			if start != 0 {
				j += copy(b[j:], b[start:i])
			} else {
				j += i
			}
			start = i + 1
		} else if c == '"' {
			inString = !inString
		}
	}
	if start != 0 {
		j += copy(b[j:], b[start:])
		return parse.ToLower(b[:j])
	}
	return parse.ToLower(b)
}
1091722
func SerializerInfoForMediaType(types []SerializerInfo, mediaType string) (SerializerInfo, bool) {
	for _, info := range types {
		if info.MediaType == mediaType {
			return info, true
		}
	}
	for _, info := range types {
		if len(info.MediaType) == 0 {
			return info, true
		}
	}
	return SerializerInfo{}, false
}
763857
func AnnotationFor(obj runtime.Object, key string) string {
	objectMeta, err := meta.Accessor(obj)
	if err != nil {
		return ""
	}
	if objectMeta == nil || reflect.ValueOf(objectMeta).IsNil() {
		return ""
	}
	return objectMeta.GetAnnotations()[key]
}
167246
func (e ShortcutExpander) KindFor(resource unversioned.GroupVersionResource) (unversioned.GroupVersionKind, error) {
	resource = expandResourceShortcut(resource)
	return e.RESTMapper.KindFor(resource)
}
380799
func WriterFor(w io.Writer) WriterFunc {
	return func(b []byte) error {
		n, err := w.Write(b)
		if err == nil && n != len(b) {
			return io.ErrShortWrite
		}
		return err
	}
}
475198
func (prod *AwsFirehose) Produce(workers *sync.WaitGroup) {
	defer prod.WorkerDone()

	prod.AddMainWorker(workers)
	prod.initFirehoseClient()
	prod.BatchMessageLoop(workers, prod.sendBatch)
}
945847
func (m model) GenerateSQLFromFizz(content string, f fizz.Translator) string {
	content, err := fizz.AString(content, f)
	if err != nil {
		return ""
	}
	return content
}