// FindBehavior locates a specific behavior by path
486554
func (rules *Rules) FindBehavior(path string) (*Behavior, error) {
	if len(path) <= 1 {
		return nil, ErrorMap[ErrInvalidPath]
	}

	rule, err := rules.FindParentRule(path)
	if err != nil {
		return nil, err
	}

	sep := "/"
	segments := strings.Split(path, sep)
	behaviorName := strings.ToLower(segments[len(segments)-1])
	for _, behavior := range rule.Behaviors {
		if strings.ToLower(behavior.Name) == behaviorName {
			return behavior, nil
		}
	}

	return nil, ErrorMap[ErrBehaviorNotFound]
}
121711
func (n *node) FindCaseInsensitivePath(path string, fixTrailingSlash bool) ([]byte, bool) {
	return n.findCaseInsensitivePathRec(
		path,
		toLower(path),
		make([]byte, zero, len(path)+one), // preallocate enough memory for new path
		[4]byte{},                         // empty rune buffer
		fixTrailingSlash,
	)
}
18354
func (s *Integration) SetPassthroughBehavior(v string) *Integration {
	s.PassthroughBehavior = &v
	return s
}
1156114
func watchFind(ctx *findContext) {
	// Watch is not enabled, return quickly.
	if !ctx.watch {
		return
	}
	params := watchParams{
		recursive: true,
		events:    []string{"put"},
	}
	watchObj, err := ctx.clnt.Watch(params)
	fatalIf(err.Trace(ctx.targetAlias), "Cannot watch with given params.")

	// Enables users to kill using the control + c
	trapCh := signalTrap(os.Interrupt, syscall.SIGTERM)

	// Loop until user CTRL-C the command line.
	for {
		select {
		case <-trapCh:
			console.Println()
			close(watchObj.doneChan)
			return
		case event, ok := <-watchObj.Events():
			if !ok {
				return
			}

			time, e := time.Parse(time.RFC3339, event.Time)
			if e != nil {
				errorIf(probe.NewError(e).Trace(event.Time), "Unable to parse event time.")
				continue
			}

			find(ctx, contentMessage{
				Key:  getAliasedPath(ctx, event.Path),
				Time: time,
				Size: event.Size,
			})

		case err, ok := <-watchObj.Errors():
			if !ok {
				return
			}
			errorIf(err, "Unable to watch for events.")
			return
		}
	}
}
17906
func (remote *RemoteDebugger) SetDownloadBehavior(behavior DownloadBehavior, downloadPath string) error {
	params := Params{"behavior": behavior}
	if len(downloadPath) > 0 {
		params["downloadPath"] = downloadPath
	}

	_, err := remote.SendRequest("Page.setDownloadBehavior", params)
	return err
}
839161
func progressBehavior(state *nstyle.WidgetStates, in *Input, r rect.Rect, maxval int, value int, modifiable bool) int {
	if !modifiable {
		*state = nstyle.WidgetStateInactive
		return value
	}

	exitstate := basicWidgetStateControl(state, in, r)

	if *state == nstyle.WidgetStateActive {
		if !in.Mouse.Down(mouse.ButtonLeft) {
			*state = exitstate
		} else {
			ratio := maxFloat(0, float64(in.Mouse.Pos.X-r.X)) / float64(r.W)
			value = int(float64(maxval) * ratio)
			if value < 0 {
				value = 0
			}
		}
	}

	if maxval > 0 && value > maxval {
		value = maxval
	}
	return value
}
1084663
func (m *MockManager) FindCurrent() ([]instance.Instance, error) {
	ret := m.ctrl.Call(m, "FindCurrent")
	ret0, _ := ret[0].([]instance.Instance)
	ret1, _ := ret[1].(error)
	return ret0, ret1
}
11241
func (s *InputSettings) SetSourceEndBehavior(v string) *InputSettings {
	s.SourceEndBehavior = &v
	return s
}
400002
func NewSetDownloadBehaviorArgs(behavior string) *SetDownloadBehaviorArgs {
	args := new(SetDownloadBehaviorArgs)
	args.Behavior = behavior
	return args
}
846691
func (s *VideoDescription) SetScalingBehavior(v string) *VideoDescription {
	s.ScalingBehavior = &v
	return s
}
298960
func (s *CreateSimulationJobOutput) SetFailureBehavior(v string) *CreateSimulationJobOutput {
	s.FailureBehavior = &v
	return s
}
405378
func FindMethod(recvType reflect.Type, funcVal reflect.Value) *reflect.Method {
	// It is not possible to get the name of the method from the Func.
	// Instead, compare it to each method of the Controller.
	for i := 0; i < recvType.NumMethod(); i++ {
		method := recvType.Method(i)
		if method.Func.Pointer() == funcVal.Pointer() {
			return &method
		}
	}
	return nil
}
297209
func (rules *Rules) FindParentRule(path string) (*Rule, error) {
	sep := "/"
	segments := strings.Split(strings.ToLower(strings.TrimPrefix(path, sep)), sep)
	parentPath := strings.Join(segments[0:len(segments)-1], sep)

	return rules.FindRule(parentPath)
}
482905
func (s *MsSmoothGroupSettings) SetStreamManifestBehavior(v string) *MsSmoothGroupSettings {
	s.StreamManifestBehavior = &v
	return s
}
963981
func (p properties) findBestMatch(withVerOnly bool) string {
	n := 2
	if withVerOnly {
		n = 1
	}
	for i := 0; i < n; i++ {
		for k, v := range p {
			switch k {
			case Chrome, Firefox, Safari, "Version", "Mobile", "Mobile Safari", "Mozilla", "AppleWebKit", "Windows NT", "Windows Phone OS", Android, "Macintosh", Linux, "GSA":
			default:
				if i == 0 {
					if v != "" { // in first check, only return  keys with value
						return k
					}
				} else {
					return k
				}
			}
		}
	}
	return ""
}
484678
def getBehavior(name, id=None):
    
    name = name.upper()
    if name in __behaviorRegistry:
        if id:
            for n, behavior in __behaviorRegistry[name]:
                if n == id:
                    return behavior

        return __behaviorRegistry[name][0][1]
    return None
1119420
func (ct *ClaimTree) FindActive(ownerID *identity.ID, t primitive.KeyType) (*apitypes.PublicKeySegment, error) {
	for _, pks := range ct.PublicKeys {
		if *pks.PublicKey.Body.OwnerID != *ownerID {
			continue
		}

		if pks.PublicKey.Body.KeyType != t {
			continue
		}

		if pks.Revoked() {
			continue
		}

		return &pks, nil
	}

	return nil, ErrMissingKeyForOwner
}