// shouldNamePass returns true if the metric should pass, false if should drop
// based on the drop/pass filter parameters
971742
func (f *Filter) shouldNamePass(key string) bool {
	pass := func(f *Filter) bool {
		if f.namePass.Match(key) {
			return true
		}
		return false
	}

	drop := func(f *Filter) bool {
		if f.nameDrop.Match(key) {
			return false
		}
		return true
	}

	if f.namePass != nil && f.nameDrop != nil {
		return pass(f) && drop(f)
	} else if f.namePass != nil {
		return pass(f)
	} else if f.nameDrop != nil {
		return drop(f)
	}

	return true
}
132599
func FilterByIssuer(iss string) (CertificateFilter, error) {
	issFilter, err := regexp.Compile(iss)
	if err != nil {
		return nil, err
	}

	return func(cm *CertificateMetadata) bool {
		return issFilter.MatchString(cm.Issuer)
	}, nil
}
117909
func (n *NodeInfo) Filter(pod *v1.Pod) bool {
	if pod.Spec.NodeName != n.node.Name {
		return true
	}
	for _, p := range n.pods {
		if p.Name == pod.Name && p.Namespace == pod.Namespace {
			return true
		}
	}
	return false
}
780375
func (s Style) ShouldDrawDot() bool {
	return (!s.DotColor.IsZero() && s.DotWidth > 0) || s.DotColorProvider != nil || s.DotWidthProvider != nil
}
292645
func methodFilter(name string) (bool, error) {
	if ok, _ := regexp.MatchString("^Test", name); !ok {
		return false, nil
	}
	return regexp.MatchString(*matchMethod, name)
}
542507
func (f *FilteredForwarder) FilterMetricName(metricName string) bool {
	denied := false
	for _, a := range f.deny {
		if a.Match([]byte(metricName)) {
			denied = true
			break
		}
	}
	found := false
	for _, a := range f.allow {
		if a.Match([]byte(metricName)) {
			denied = false
			found = true
			break
		}
	}
	return found || (len(f.allow) == 0 && !denied)
}
817352
func (f *Filter) Select(metric telegraf.Metric) bool {
	if !f.isActive {
		return true
	}

	if !f.shouldNamePass(metric.Name()) {
		return false
	}

	if !f.shouldTagsPass(metric.TagList()) {
		return false
	}

	return true
}
1108631
func filterNonPassing(nodes structs.CheckServiceNodes) structs.CheckServiceNodes {
	n := len(nodes)

	// Make a copy of the cached nodes rather than operating on the cache directly
	out := append(nodes[:0:0], nodes...)

OUTER:
	for i := 0; i < n; i++ {
		node := out[i]
		for _, check := range node.Checks {
			if check.Status != api.HealthPassing {
				out[i], out[n-1] = out[n-1], structs.CheckServiceNode{}
				n--
				i--
				continue OUTER
			}
		}
	}
	return out[:n]
}
72213
func (p pluginHandlerWithNamespaceLabelConditions) shouldRunAdmission(attr admission.Attributes) bool {
	namespaceName := attr.GetNamespace()
	if len(namespaceName) == 0 && attr.GetResource().Resource != "namespaces" {
		// cluster scoped resources always run admission
		return true
	}
	namespaceLabels, err := p.getNamespaceLabels(attr)
	if err != nil {
		// default to running the hook so we don't leak namespace existence information
		return true
	}
	// TODO: adding an LRU cache to cache the match decision
	return p.namespaceSelector.Matches(labels.Set(namespaceLabels))
}
207322
func (k *Kubernetes) filteredNamespaceExists(namespace string) bool {
	ns, err := k.APIConn.GetNamespaceByName(namespace)
	if err != nil {
		return false
	}
	return ns.ObjectMeta.Name == namespace
}
298720
func (b *BulkAction) ShouldPrint() bool {
	return b.Output != "" && b.Output != "name" && b.Output != "compact"
}
223258
func (s *Server) shouldTrackSubscriptions() bool {
	return (s.opts.Cluster.Port != 0 || s.opts.Gateway.Port != 0)
}
1193879
func (a *Webhook) ShouldCallHook(h *v1beta1.Webhook, attr admission.Attributes) (bool, *apierrors.StatusError) {
	var matches bool
	for _, r := range h.Rules {
		m := rules.Matcher{Rule: r, Attr: attr}
		if m.Matches() {
			matches = true
			break
		}
	}
	if !matches {
		return false, nil
	}

	return a.namespaceMatcher.MatchNamespaceSelector(h, attr)
}
897353
func HasPassPromptFunc(ctx context.Context) bool {
	ppf, ok := ctx.Value(ctxKeyPassPromptFunc).(PassPromptFunc)
	return ok && ppf != nil
}
82534
func GzipAsset(name string) ([]byte, error) {
	cannonicalName := strings.Replace(name, "\\", "/", -1)
	if f, ok := _gzipbindata[cannonicalName]; ok {
		a, err := f()
		if err != nil {
			return nil, fmt.Errorf("GzipAsset %s can't read by error: %v", name, err)
		}
		return a.bytes, nil
	}
	return nil, &os.PathError{Op: "open", Path: name, Err: os.ErrNotExist}
}
520040
func (n *Notification) ShouldNotify(oldStatus, newStatus buildbucketpb.Status) bool {
	switch {
	case newStatus == buildbucketpb.Status_STATUS_UNSPECIFIED:
		panic("new status must always be valid")
	case n.OnSuccess && newStatus == buildbucketpb.Status_SUCCESS:
	case n.OnFailure && newStatus == buildbucketpb.Status_FAILURE:
	case n.OnChange && oldStatus != buildbucketpb.Status_STATUS_UNSPECIFIED && newStatus != oldStatus:
	case n.OnNewFailure && newStatus == buildbucketpb.Status_FAILURE && oldStatus != buildbucketpb.Status_FAILURE:

	default:
		return false
	}
	return true
}
840593
func (l Logger) ShouldLog(path string) bool {
	for _, exc := range l.Exceptions {
		if Path(path).Matches(exc) {
			return false
		}
	}
	return true
}