// Find attempts to find a Python interpreter matching the supplied version
// using PATH.
//
// In order to accommodate multiple configurations on operating systems, Find
// will attempt to identify versions that appear on the path
327051
func Find(c context.Context, vers Version, lookPath LookPathFunc) (*Interpreter, error) {
	// pythonM.m, pythonM, python
	searches := make([]string, 0, 3)
	pv := vers
	pv.Patch = 0
	if pv.Minor > 0 {
		searches = append(searches, pv.PythonBase())
		pv.Minor = 0
	}
	if pv.Major > 0 {
		searches = append(searches, pv.PythonBase())
		pv.Major = 0
	}
	searches = append(searches, pv.PythonBase())

	lookErrs := errors.NewLazyMultiError(len(searches))
	for i, s := range searches {
		interp, err := findInterpreter(c, s, vers, lookPath)
		if err == nil {
			// Resolve to absolute path.
			if err := filesystem.AbsPath(&interp.Python); err != nil {
				return nil, errors.Annotate(err, "could not get absolute path for: %q", interp.Python).Err()
			}

			return interp, nil
		}

		logging.WithError(err).Debugf(c, "Could not find Python for: %q.", s)
		lookErrs.Assign(i, err)
	}

	// No Python interpreter could be identified.
	return nil, errors.Annotate(lookErrs.Get(), "no Python found").Err()
}
198015
func (t *Tree) Find(key interface{}) interface{} {
	if key != nil && t.root != nil {
		d := &findData{key, t.compare}
		node := d.finder(t.root)
		if node != nil {
			return node.value
		}
	}

	return nil
}
1176018
func (v *TreeVertex) Find(id string) *TreeVertex {
	if v.Id == id {
		return v
	}
	for _, u := range v.Descendants {
		if r := u.Find(id); r != nil {
			return r
		}
	}
	return nil
}
441977
func (r *Repo) Find(ctx context.Context, id uuid.UUID) (eh.Entity, error) {
	sess := r.session.Copy()
	defer sess.Close()

	if r.factoryFn == nil {
		return nil, eh.RepoError{
			Err:       ErrModelNotSet,
			Namespace: eh.NamespaceFromContext(ctx),
		}
	}

	entity := r.factoryFn()
	err := sess.DB(r.dbName(ctx)).C(r.collection).FindId(id).One(entity)
	if err != nil {
		return nil, eh.RepoError{
			Err:       eh.ErrEntityNotFound,
			BaseErr:   err,
			Namespace: eh.NamespaceFromContext(ctx),
		}
	}

	return entity, nil
}
187790
func (eng *engine) Find(keys KeyList, container TableListContainer, opts ...GetOption) error {
	s := eng.newSession()
	defer s.Close()
	action, err := s.find(keys, container, s.applyGetOption(opts), nil)
	if err != nil {
		return s.catch("Find: "+action, err)
	}
	return nil
}
776832
func (f *Finder) Find(
	ctx context.Context, ipath ...string) ([]FindResult, error) {

	if len(ipath) == 0 {
		ipath = []string{""}
	}
	var result []FindResult
	for _, p := range ipath {
		results, err := f.find(ctx, p)
		if err != nil {
			return nil, err
		}
		result = append(result, results...)
	}
	return result, nil
}
1373439
func (e *Archive) Find(c *fi.Context) (*Archive, error) {
	// We write a marker file to prevent re-execution
	localStateFile := path.Join(localArchiveStateDir, e.Name)
	stateBytes, err := ioutil.ReadFile(localStateFile)
	if err != nil {
		if os.IsNotExist(err) {
			stateBytes = nil
		} else {
			glog.Warningf("error reading archive state %s: %v", localStateFile, err)
			// We can just reinstall
			return nil, nil
		}
	}

	if stateBytes == nil {
		// No marker file found, assume archive not installed
		return nil, nil
	}

	state := &Archive{}
	if err := json.Unmarshal(stateBytes, state); err != nil {
		glog.Warningf("error unmarshaling archive state %s: %v", localStateFile, err)
		// We can just reinstall
		return nil, nil
	}

	if state.Hash == e.Hash && state.TargetDir == e.TargetDir {
		return state, nil
	}

	// Existing version is different, force a reinstall
	return nil, nil
}
129741
func (e *Error) Find(ie interface{}) int {
	if ie == nil {
		return -1
	}
	deep := 0
	for err := e; err != nil; err = err.next {
		if err.Equal(ie) {
			return deep
		}
		deep = deep + 1
	}
	return -1
}
947533
func (bol Boolean) Find(path Ref) (Value, error) {
	if len(path) == 0 {
		return bol, nil
	}
	return nil, fmt.Errorf("find: not found")
}
893916
func (n *node) find(path string, po Params) (handler HandlersChain, p Params, handlerName string) {

	p = po

walk: // Outer loop for walking the tree
	for {
		if len(path) > len(n.path) {

			if path[:len(n.path)] == n.path {
				path = path[len(n.path):]

				// If this node does not have a wildcard (param or catchAll)
				// child,  we can just look up the next child node and continue
				// to walk down the tree
				if !n.wildChild {
					c := path[0]
					for i := 0; i < len(n.indices); i++ {
						if c == n.indices[i] {
							n = n.children[i]
							continue walk
						}
					}

					return
				}

				// handle wildcard child
				n = n.children[0]
				switch n.nType {
				case hasParams:

					// find param end (either '/' or path end)
					end := 0
					for end < len(path) && path[end] != slashByte {
						end++
					}

					// save param value
					i := len(p)
					p = p[:i+1] // expand slice within preallocated capacity
					p[i].Key = n.path[1:]
					p[i].Value = path[:end]

					// we need to go deeper!
					if end < len(path) {
						if len(n.children) > 0 {
							path = path[end:]
							n = n.children[0]
							continue walk
						}

						return
					}

					if n.handler != nil {
						handler = n.handler.chain
						handlerName = n.handler.handlerName
						return
					} else if len(n.children) == 1 {
						// No handle found. Check if a handle for this path
						n = n.children[0]
					}

					return

				case matchesAny:

					// save param value
					i := len(p)
					p = p[:i+1] // expand slice within preallocated capacity
					p[i].Key = WildcardParam
					p[i].Value = path[1:]

					handler = n.handler.chain
					handlerName = n.handler.handlerName
					return

					// can't happen, but left here in case I'm wrong
					// default:
					// 	panic("invalid node type")
				}
			}

		} else if path == n.path {

			// We should have reached the node containing the handle.
			// Check if this node has a handle registered.
			if n.handler != nil {
				if handler, handlerName = n.handler.chain, n.handler.handlerName; handler != nil {
					return
				}
			}
		}

		// Nothing found
		return
	}
}
165202
func Find(source string, targets []string) []string {
	return find(source, targets, noop)
}
632884
func (g *group) Find(rs []rune) []Entity {
	g.RLock()
	ents := find(rs, []*group{g})
	g.RUnlock()
	return ents[g.name]
}
772460
func (e *MirrorKeystore) Find(c *fi.Context) (*MirrorKeystore, error) {
	if vfsKeystore, ok := c.Keystore.(*fi.VFSCAStore); ok {
		if vfsKeystore.VFSPath().Path() == e.MirrorPath.Path() {
			return e, nil
		}
	}

	// TODO: implement Find so that we aren't always mirroring
	glog.V(2).Infof("MirrorKeystore::Find not implemented; always copying (inefficient)")
	return nil, nil
}
1212347
func find(file string, paths []string) string {
	for _, dir := range paths {
		p := join(dir, file)
		if _, err := os.Stat(p); err != nil {
			continue
		}
		return p
	}
	return ""
}
30500
func (t *StringTree) Find(key string) string {
	v := t.Tree.Find(key)
	if v != nil {
		return v.(string)
	}
	return ""
}
1252366
func find(db *gorm.DB, scope scope, v interface{}) error {
	return scope.scope(db).Find(v).Error
}
923270
func (c *Configuration) Find(val string) string {
	output, _ := c.gitConfig(val)
	return output
}