// ValueForKey gets the format value for a format key, used for filtering
558349
func (f Format) ValueForKey(key FormatKey) interface{} {
	switch key {
	case FormatItagKey:
		return f.Itag
	case FormatExtensionKey:
		return f.Extension
	case FormatResolutionKey:
		return f.Resolution
	case FormatVideoEncodingKey:
		return f.VideoEncoding
	case FormatAudioEncodingKey:
		return f.AudioEncoding
	case FormatAudioBitrateKey:
		return f.AudioBitrate
	default:
		if f.meta != nil {
			return f.meta[string(key)]
		}
		return nil
	}
}
1214598
func encodeKeyValue(key, value string, buf *bytes.Buffer) {
	encodeString(key, buf)
	encodeString(value, buf)
}
126145
func (l *LayoutHandler) For(d LayoutDescriptor, f Format) ([]string, error) {

	// We will get lots of requests for the same layouts, so avoid recalculations.
	key := layoutCacheKey{d, f.Name}
	l.mu.RLock()
	if cacheVal, found := l.cache[key]; found {
		l.mu.RUnlock()
		return cacheVal, nil
	}
	l.mu.RUnlock()

	layouts := resolvePageTemplate(d, f)

	layouts = prependTextPrefixIfNeeded(f, layouts...)
	layouts = helpers.UniqueStrings(layouts)

	l.mu.Lock()
	l.cache[key] = layouts
	l.mu.Unlock()

	return layouts, nil
}
111160
func (iter *Iterator) SeekForPrev(key []byte) {
	cKey := byteToChar(key)
	C.rocksdb_iter_seek_for_prev(iter.c, cKey, C.size_t(len(key)))
}
1287822
func nameOfKeyValue(ei *dosa.EntityInfo) (string, string) {
	keyName := ei.Def.Key.PartitionKeys[0]
	cols := ei.Def.Columns
	if cols[0].Name == keyName {
		return keyName, cols[1].Name
	}
	return keyName, cols[0].Name
}
746150
func (s *Session) Value(key string) interface{} {
	s.RLock()
	defer s.RUnlock()

	return s.data[key]
}
339964
func (s *Secret) Value(key string) (string, error) {
	v := s.d[key]
	if sv, ok := v.(string); ok {
		return sv, nil
	}
	return "", nil
}
802542
func encodeKeyValue(k, v string) (string, string) {
	k = strings.ToLower(k)
	if strings.HasSuffix(k, binHdrSuffix) {
		val := base64.StdEncoding.EncodeToString([]byte(v))
		v = string(val)
	}
	return k, v
}
1002047
func (itr *memDBIterator) Value() []byte {
	itr.assertIsValid()
	key := []byte(itr.keys[itr.cur])
	return itr.db.Get(key)
}
50080
func mIDFromKey(key string) uint16 {
	s := key[2:]
	i, err := strconv.Atoi(s)
	chkerr(err)
	return uint16(i)
}
415669
func (pc *PublicCertificates) CertificateForKey(key string) (*x509.Certificate, error) {
	// Use fast reader lock first.
	pc.lock.RLock()
	cert, ok := pc.cache[key]
	pc.lock.RUnlock()
	if ok {
		return cert, nil
	}

	// Grab the write lock and recheck the cache.
	pc.lock.Lock()
	defer pc.lock.Unlock()
	if cert, ok := pc.cache[key]; ok {
		return cert, nil
	}

	for _, cert := range pc.Certificates {
		if cert.KeyName == key {
			block, _ := pem.Decode([]byte(cert.X509CertificatePEM))
			if block == nil {
				return nil, fmt.Errorf("signature: the certificate %q is not PEM encoded", key)
			}
			cert, err := x509.ParseCertificate(block.Bytes)
			if err != nil {
				return nil, err
			}
			if pc.cache == nil {
				pc.cache = make(map[string]*x509.Certificate)
			}
			pc.cache[key] = cert
			return cert, nil
		}
	}

	return nil, fmt.Errorf("signature: no such certificate %q", key)
}
637186
func (c *Client) GetDataForKey(key string) (*decoder.FileDataEntry, bool) {
	return c.db.GetDataForKey(key)
}
358740
func (c *ClassifierDeserializer) GetAttributeForKey(key string) (Attribute, error) {
	b, err := c.GetBytesForKey(key)
	if err != nil {
		return nil, WrapError(err)
	}
	attr, err := DeserializeAttribute(b)
	if err != nil {
		return nil, WrapError(err)
	}
	return attr, nil
}
312479
func (k *Key) transformValue(val string) string {
	if k.s.f.ValueMapper != nil {
		val = k.s.f.ValueMapper(val)
	}

	// Fail-fast if no indicate char found for recursive value
	if !strings.Contains(val, "%") {
		return val
	}
	for i := 0; i < depthValues; i++ {
		vr := varPattern.FindString(val)
		if len(vr) == 0 {
			break
		}

		// Take off leading '%(' and trailing ')s'.
		noption := vr[2 : len(vr)-2]

		// Search in the same section.
		nk, err := k.s.GetKey(noption)
		if err != nil || k == nk {
			// Search again in default section.
			nk, _ = k.s.f.Section("").GetKey(noption)
		}

		// Substitute by new value and take off leading '%(' and trailing ')s'.
		val = strings.Replace(val, vr, nk.value, -1)
	}
	return val
}
768235
func (arc *ConfigFactory) GetValueByDI(dimensionInfo, key string) cast.Value {
	if arc.initSuccess == false {
		return nil
	}

	var confValue cast.Value
	val := arc.GetConfigurationByKeyAndDimensionInfo(dimensionInfo, key)
	if val == nil {
		confValue = cast.NewValue(nil, errors.New("key does not exist"))
	} else {
		confValue = cast.NewValue(val, nil)
	}

	return confValue
}
147598
func (f *Flash) Values(key string) []interface{} {
	if !f.Has(key) {
		return []interface{}{}
	}

	f.changed = true
	r := f.v[key]
	delete(f.v, key)
	return r
}
492385
func (c *ClassifierDeserializer) GetBytesForKey(key string) ([]byte, error) {
	return c.tarReader.GetNamedFile(key)
}