// isTopicAPIKey returns true if kind is apiKey message type which contains a
// topic in its request.
495122
func isTopicAPIKey(kind int16) bool {
	switch kind {
	case api.ProduceKey,
		api.FetchKey,
		api.OffsetsKey,
		api.MetadataKey,
		api.LeaderAndIsr,
		api.StopReplica,
		api.UpdateMetadata,
		api.OffsetCommitKey,
		api.OffsetFetchKey,
		api.CreateTopicsKey,
		api.DeleteTopicsKey,
		api.DeleteRecordsKey,
		api.OffsetForLeaderEpochKey,
		api.AddPartitionsToTxnKey,
		api.WriteTxnMarkersKey,
		api.TxnOffsetCommitKey,
		api.AlterReplicaLogDirsKey,
		api.DescribeLogDirsKey,
		api.CreatePartitionsKey:

		return true
	}
	return false
}
42640
func (o *outerJoinEliminator) isInnerJoinKeysContainUniqueKey(innerPlan LogicalPlan, joinKeys *expression.Schema) (bool, error) {
	for _, keyInfo := range innerPlan.Schema().Keys {
		joinKeysContainKeyInfo := true
		for _, col := range keyInfo {
			columnName := &ast.ColumnName{Schema: col.DBName, Table: col.TblName, Name: col.ColName}
			c, err := joinKeys.FindColumn(columnName)
			if err != nil {
				return false, err
			}
			if c == nil {
				joinKeysContainKeyInfo = false
				break
			}
		}
		if joinKeysContainKeyInfo {
			return true, nil
		}
	}
	return false, nil
}
852931
func (app *App) IsPublicRequest(request *http.Request) bool {
	return request.Host == app.Config.PublicAPIHost
}
331633
func ParseDeviceTopic(topic string) (*DeviceTopic, error) {
	pattern := regexp.MustCompile("^([0-9a-z](?:[_-]?[0-9a-z]){1,35}|\\+)/(devices)/([0-9a-z](?:[_-]?[0-9a-z]){1,35}|\\+)/(events|up|down)([0-9a-z/]+)?$")
	matches := pattern.FindStringSubmatch(topic)
	if len(matches) < 5 {
		return nil, fmt.Errorf("Invalid topic format")
	}
	var appID string
	if matches[1] != simpleWildcard {
		appID = matches[1]
	}
	var devID string
	if matches[3] != simpleWildcard {
		devID = matches[3]
	}
	topicType := DeviceTopicType(matches[4])
	deviceTopic := &DeviceTopic{appID, devID, topicType, ""}
	if (topicType == DeviceUplink || topicType == DeviceEvents) && len(matches) > 5 {
		deviceTopic.Field = strings.Trim(matches[5], "/")
	}
	return deviceTopic, nil
}
25570
func parseTopicsIntoMap(out map[string]interface{}, fields abi.Arguments, topics []common.Hash) error {
	// Sanity check that the fields and topics match up
	if len(fields) != len(topics) {
		return errors.New("topic/field count mismatch")
	}
	// Iterate over all the fields and reconstruct them from topics
	for _, arg := range fields {
		if !arg.Indexed {
			return errors.New("non-indexed field in topic reconstruction")
		}

		switch arg.Type.T {
		case abi.BoolTy:
			out[arg.Name] = topics[0][common.HashLength-1] == 1
		case abi.IntTy, abi.UintTy:
			num := new(big.Int).SetBytes(topics[0][:])
			out[arg.Name] = num
		case abi.AddressTy:
			var addr common.Address
			copy(addr[:], topics[0][common.HashLength-common.AddressLength:])
			out[arg.Name] = addr
		case abi.HashTy:
			out[arg.Name] = topics[0]
		case abi.FixedBytesTy:
			out[arg.Name] = topics[0][:]
		case abi.StringTy, abi.BytesTy, abi.SliceTy, abi.ArrayTy:
			// Array types (including strings and bytes) have their keccak256 hashes stored in the topic- not a hash
			// whose bytes can be decoded to the actual value- so the best we can do is retrieve that hash
			out[arg.Name] = topics[0]
		case abi.FunctionTy:
			if garbage := binary.BigEndian.Uint64(topics[0][0:8]); garbage != 0 {
				return fmt.Errorf("bind: got improperly encoded function type, got %v", topics[0].Bytes())
			}
			var tmp [24]byte
			copy(tmp[:], topics[0][8:32])
			out[arg.Name] = tmp
		default: // Not handling tuples
			return fmt.Errorf("unsupported indexed type: %v", arg.Type)
		}

		topics = topics[1:]
	}

	return nil
}
812470
func BytesToTopic(b []byte) (t TopicType) {
	sz := TopicLength
	if x := len(b); x < TopicLength {
		sz = x
	}
	for i := 0; i < sz; i++ {
		t[i] = b[i]
	}
	return t
}
174457
func (s *UpdateIntegrationResponseOutput) SetIntegrationResponseKey(v string) *UpdateIntegrationResponseOutput {
	s.IntegrationResponseKey = &v
	return s
}
63182
func (limiter *Limiter) GetIPKey(r *http.Request) string {
	return limiter.GetIPWithMask(r).String()
}
323504
func ikeyRange(icmp db.Comparer, f0, f1 []fileMetadata) (smallest, largest internalKey) {
	first := true
	for _, f := range [2][]fileMetadata{f0, f1} {
		for _, meta := range f {
			if first {
				first = false
				smallest, largest = meta.smallest, meta.largest
				continue
			}
			if icmp.Compare(meta.smallest, smallest) < 0 {
				smallest = meta.smallest
			}
			if icmp.Compare(meta.largest, largest) > 0 {
				largest = meta.largest
			}
		}
	}
	return smallest, largest
}
230981
func (s *UpdateApiKeyInput) SetApiKey(v string) *UpdateApiKeyInput {
	s.ApiKey = &v
	return s
}
477453
func (md *RootMetadataV3) IsValidRekeyRequest(
	codec kbfscodec.Codec, prevBareMd RootMetadata,
	user keybase1.UID, prevExtra, extra ExtraMetadata) (
	bool, error) {
	if !md.IsWriterMetadataCopiedSet() {
		// Not a copy.
		return false, nil
	}
	prevMd, ok := prevBareMd.(*RootMetadataV3)
	if !ok {
		// Not the same type so not a copy.
		return false, nil
	}
	prevExtraV3, ok := prevExtra.(*ExtraMetadataV3)
	if !ok {
		return false, errors.New("Invalid previous extra metadata")
	}
	extraV3, ok := extra.(*ExtraMetadataV3)
	if !ok {
		return false, errors.New("Invalid extra metadata")
	}
	writerEqual, err := kbfscodec.Equal(
		codec, md.WriterMetadata, prevMd.WriterMetadata)
	if err != nil {
		return false, err
	}
	if !writerEqual {
		// Copy mismatch.
		return false, nil
	}
	onlyUserRKeysChanged, err := md.haveOnlyUserRKeysChanged(
		codec, prevMd, user, prevExtraV3.rkb, extraV3.rkb)
	if err != nil {
		return false, err
	}
	if !onlyUserRKeysChanged {
		// Keys outside of this user's reader key set have changed.
		return false, nil
	}
	return true, nil
}
1265580
func (s *GetIntegrationResponseOutput) SetIntegrationResponseKey(v string) *GetIntegrationResponseOutput {
	s.IntegrationResponseKey = &v
	return s
}
1187999
func (pdfa *ParametricDFA) isPrefixSink(state ParametricState, queryLen uint32) bool {
	if state.isDeadEnd() {
		return true
	}

	remOffset := queryLen - state.offset
	if remOffset < pdfa.diameter {
		stateDistances := pdfa.distance[pdfa.diameter*state.shapeID:]
		prefixDistance := stateDistances[remOffset]
		if prefixDistance > pdfa.maxDistance {
			return false
		}

		for _, d := range stateDistances {
			if d < prefixDistance {
				return false
			}
		}
		return true
	}
	return false
}
926357
func IsBuiltInFlagTypeKey(env string) bool {
	switch string(env) {
	case configs.IsSecretFilteringKey,
		configs.CIModeEnvKey,
		configs.PRModeEnvKey,
		configs.DebugModeEnvKey,
		configs.LogLevelEnvKey,
		configs.PullRequestIDEnvKey:
		return true
	default:
		return false
	}
}
266142
func (s *CreateIntegrationResponseOutput) SetIntegrationResponseKey(v string) *CreateIntegrationResponseOutput {
	s.IntegrationResponseKey = &v
	return s
}
770719
func (s *CreateApiMappingOutput) SetApiMappingKey(v string) *CreateApiMappingOutput {
	s.ApiMappingKey = &v
	return s
}
73452
func (tf tFiles) lessByKey(icmp *iComparer, i, j int) bool {
	a, b := tf[i], tf[j]
	n := icmp.Compare(a.imin, b.imin)
	if n == 0 {
		return a.fd.Num < b.fd.Num
	}
	return n < 0
}