// Matches checks if the given buffer matches with some supported file type
548675
func Matches(buf []byte) bool {
	kind, _ := Match(buf)
	return kind != types.Unknown
}
980868
func (f verbFlag) Matches(v verbFlag) bool {
	if v == 0 {
		return false
	}
	return f&v == v
}
1174978
func (u Sequence) Matches(bytes []byte) bool {
	if len(bytes) < len(u) {
		return false
	}
	for i := 0; i < len(u); i++ {
		if !u[i].matches(bytes[i]) {
			return false
		}
	}
	return true
}
672178
func (lsel LabelSelector) Matches(l Labels) bool {
	for _, req := range lsel {
		if matches := req.Matches(l); !matches {
			return false
		}
	}
	return true
}
715964
func (t *docMatchTree) matches(cp *contentProvider, cost int, known map[matchTree]bool) (bool, bool) {
	return len(t.current) > 0, true
}
341887
func Matches(
	resourceQuota *corev1.ResourceQuota, item runtime.Object,
	matchFunc MatchingResourceNamesFunc, scopeFunc MatchesScopeFunc) (bool, error) {
	if resourceQuota == nil {
		return false, fmt.Errorf("expected non-nil quota")
	}
	// verify the quota matches on at least one resource
	matchResource := len(matchFunc(quota.ResourceNames(resourceQuota.Status.Hard))) > 0
	// by default, no scopes matches all
	matchScope := true
	for _, scope := range getScopeSelectorsFromQuota(resourceQuota) {
		innerMatch, err := scopeFunc(scope, item)
		if err != nil {
			return false, err
		}
		matchScope = matchScope && innerMatch
	}
	return matchResource && matchScope, nil
}
135025
func (p *trie) match(r *http.Request) *match {
	if p.root == nil {
		return nil
	}
	return p.root.match(p.mapper.newIter(r))
}
1182557
func Match(needles []string, source string, log *logrus.Entry) bool {
	classes, err := ReadClasses(source)
	if err != nil {
		log.Warnf("Could not parse classes file %s: %s", source, err)
		return false
	}

	matched := 0
	failed := 0

	for _, needle := range needles {
		if strings.HasPrefix(needle, "/") && strings.HasSuffix(needle, "/") {
			needle = strings.TrimPrefix(needle, "/")
			needle = strings.TrimSuffix(needle, "/")

			if hasClassMatching(needle, classes) {
				matched++
			} else {
				failed++
			}

			continue
		}

		if hasClass(needle, classes) {
			matched++
		} else {
			failed++
		}
	}

	return failed == 0 && matched > 0
}
1006907
func (c *Constraint) Match(whats ...string) bool {
	var match bool

	// full string match
	for _, what := range whats {
		// case insensitive compare
		if strings.EqualFold(c.exp, what) {
			match = true
			break
		}
	}

	switch c.operator {
	case eq:
		return match
	case noteq:
		return !match
	}

	return false
}
643712
func Match(payload FullPayloadInfo, pattern string) bool {
	pattern = strings.ToLower(pattern)

	switch {
	case strings.ToLower(payload.Name) == pattern:
		return true
	case strings.ToLower(payload.Type) == pattern:
		return true
	case strings.ToLower(payload.ID) == pattern:
		return true
	case strings.ToLower(payload.Status) == pattern:
		return true
	case strings.ToLower(payload.Unit) == pattern:
		return true
	case strings.ToLower(payload.Machine) == pattern:
		return true
	default:
		for _, tag := range payload.Labels {
			if strings.ToLower(tag) == pattern {
				return true
			}
		}
	}
	return false
}
1098129
func (t *Trie) Match(addr [16]byte) (bool, error) {
	current := t.root
	next := t.root
	for i := 0; i < 127; i++ {
		maskPosition := i % 8
		currentByte := i / 8

		left := (addr[currentByte] & singleBitMask[maskPosition]) == 0

		if left {
			next = current.children[0]
		} else {
			next = current.children[1]
		}

		if next == nil {
			return false, nil
		}

		if next.match {
			return true, nil
		}

		current = next
	}

	return false, nil
}
975205
func (l *lex) match(m string) bool {
	if !l.matchNoConsume(m) {
		return false
	}

	l.p += len(m)
	return true
}
631854
func (pm *PatternMatcher) Matches(file string) (bool, error) {
	matched := false
	file = filepath.FromSlash(file)
	parentPath := filepath.Dir(file)
	parentPathDirs := strings.Split(parentPath, string(os.PathSeparator))

	for _, pattern := range pm.patterns {
		negative := false

		if pattern.exclusion {
			negative = true
		}

		match, err := pattern.match(file)
		if err != nil {
			return false, err
		}

		if !match && parentPath != "." {
			// Check to see if the pattern matches one of our parent dirs.
			if len(pattern.dirs) <= len(parentPathDirs) {
				match, _ = pattern.match(strings.Join(parentPathDirs[:len(pattern.dirs)], string(os.PathSeparator)))
			}
		}

		if match {
			matched = !negative
		}
	}

	if matched {
		logrus.Debugf("Skipping excluded path: %s", file)
	}

	return matched, nil
}
221896
func Match(filters [][3]string, fw *choria.Framework, log *logrus.Entry) bool {
	matched := false
	var err error

	for _, filter := range filters {
		matched, err = HasFact(filter[0], filter[1], filter[2], fw.Config.FactSourceFile, log)
		if err != nil {
			log.Warnf("Failed to match fact '%#v': %s", filter, err)
			return false
		}

		if matched == false {
			log.Debugf("Failed to match fact filter '%#v'", filter)
			break
		}
	}

	return matched
}
503258
func (g *GlobPath) MatchString(path string) bool {
	if !g.HasSuperMeta {
		res, _ := filepath.Match(g.path, path)
		return res
	}
	return g.g.Match(path)
}
564367
func (p *JsonPairs) Match(k string) string {
	for _, j := range *p {
		if j.K == k {
			return j.V
		}
	}
	return ""
}
988417
func (r *readfile) Match(n ast.Node, c *gosec.Context) (*gosec.Issue, error) {
	if node := r.ContainsCallExpr(n, c, false); node != nil {
		for _, arg := range node.Args {
			// handles path joining functions in Arg
			// eg. os.Open(filepath.Join("/tmp/", file))
			if callExpr, ok := arg.(*ast.CallExpr); ok {
				if r.isJoinFunc(callExpr, c) {
					return gosec.NewIssue(c, n, r.ID(), r.What, r.Severity, r.Confidence), nil
				}
			}
			// handles binary string concatenation eg. ioutil.Readfile("/tmp/" + file + "/blob")
			if binExp, ok := arg.(*ast.BinaryExpr); ok {
				// resolve all found identities from the BinaryExpr
				if _, ok := gosec.FindVarIdentities(binExp, c); ok {
					return gosec.NewIssue(c, n, r.ID(), r.What, r.Severity, r.Confidence), nil
				}
			}

			if ident, ok := arg.(*ast.Ident); ok {
				obj := c.Info.ObjectOf(ident)
				if _, ok := obj.(*types.Var); ok && !gosec.TryResolve(ident, c) {
					return gosec.NewIssue(c, n, r.ID(), r.What, r.Severity, r.Confidence), nil
				}
			}
		}
	}
	return nil, nil
}