// NewBypassPatterns creates and initializes a new Bypass using matcher patterns as its match rules.
// The rules will be reversed if the reverse is true.
974688
func NewBypassPatterns(reversed bool, patterns ...string) *Bypass {
	var matchers []Matcher
	for _, pattern := range patterns {
		if m := NewMatcher(pattern); m != nil {
			matchers = append(matchers, m)
		}
	}
	bp := NewBypass(reversed)
	bp.AddMatchers(matchers...)
	return bp
}
603793
func (p *parser) collectPatterns() ([]string, []string, bool) {
	noCommonFilter := false
	watch := []string{}
	exclude := []string{}

	vals := p.collect(itemBareString, itemQuotedString)
	for _, v := range vals {
		switch v.typ {
		case itemBareString:
			if v.val[0] == '!' {
				exclude = append(exclude, v.val[1:])
			} else {
				if v.val == "+noignore" {
					noCommonFilter = true
				} else {
					watch = append(watch, v.val)
				}
			}
		case itemQuotedString:
			if v.val[0] == '!' {
				exclude = append(exclude, unquote(v.val[1:]))
			} else {
				watch = append(watch, unquote(v.val))
			}
		}
	}
	if len(watch) == 0 {
		watch = nil
	}
	if len(exclude) == 0 {
		exclude = nil
	}
	return watch, exclude, noCommonFilter
}
1160247
func (s *ListRegexPatternSetsOutput) SetRegexPatternSets(v []*RegexPatternSetSummary) *ListRegexPatternSetsOutput {
	s.RegexPatternSets = v
	return s
}
817575
func MatchPattern(pattern string) MatcherFunc {
	r := regexp.MustCompile(pattern)
	return func(candidate string) bool {
		return r.MatchString(candidate)
	}
}
1048342
func NewMatchPhrasePrefixQuery(name string, value interface{}) *MatchPhrasePrefixQuery {
	return &MatchPhrasePrefixQuery{name: name, value: value}
}
705019
func NewPatchPrefilter(ctx *middleware.Context, handler PatchPrefilterHandler) *PatchPrefilter {
	return &PatchPrefilter{Context: ctx, Handler: handler}
}
588897
func NewMatcher(pattern string) Matcher {
	if pattern == "" {
		return nil
	}
	if ip := net.ParseIP(pattern); ip != nil {
		return IPMatcher(ip)
	}
	if _, inet, err := net.ParseCIDR(pattern); err == nil {
		return CIDRMatcher(inet)
	}
	return DomainMatcher(pattern)
}
322296
func NewMplsBosField(mplsBos uint8) *MatchField {
	f := new(MatchField)
	f.Class = OXM_CLASS_OPENFLOW_BASIC
	f.Field = OXM_FIELD_MPLS_BOS
	f.HasMask = false

	mplsBosField := new(MplsBosField)
	mplsBosField.MplsBos = mplsBos
	f.Value = mplsBosField
	f.Length = uint8(mplsBosField.Len())
	return f
}
228564
func NewCipher(passphrase []byte, salt []byte, version Version) (*Cipher, error) {
	return NewCipherWithRng(passphrase, salt, version, NewCryptoRandGenerator())
}
1148757
func (g *Grok) AddPatternsFromMap(m map[string]string) error {
	g.patternsGuard.Lock()
	defer g.patternsGuard.Unlock()

	for name, pattern := range m {
		g.rawPattern[name] = pattern
	}
	return g.buildPatterns()
}
235244
func (eg *exampleGenerator) generateValidatedPatternExample() interface{} {
	if !eg.hasPatternValidation() {
		return false
	}
	pattern := eg.a.Validation.Pattern
	example, err := regen.Generate(pattern)
	if err != nil {
		return eg.r.faker.Name()
	}
	return example
}
754537
func hasPattern(patterns []string, matchStr string) bool {
	for _, pattern := range patterns {
		if ok := wildcard.MatchSimple(pattern, matchStr); ok {
			return true
		}
	}
	return false
}
415541
func (c *Network) SetBypassServiceWorker(bypass bool) (*gcdmessage.ChromeResponse, error) {
	var v NetworkSetBypassServiceWorkerParams
	v.Bypass = bypass
	return c.SetBypassServiceWorkerWithParams(&v)
}
598528
func (bp *Bypass) AddMatchers(matchers ...Matcher) {
	bp.mux.Lock()
	defer bp.mux.Unlock()

	bp.matchers = append(bp.matchers, matchers...)
}
141431
func (s *UpdateIntegrationInput) SetPassthroughBehavior(v string) *UpdateIntegrationInput {
	s.PassthroughBehavior = &v
	return s
}
317698
func New(pat string) *Pattern {
	p := &Pattern{raw: pat}

	if strings.HasSuffix(pat, "/*") {
		pat = pat[:len(pat)-1]
		p.wildcard = true
	}

	matches := patternRe.FindAllStringSubmatchIndex(pat, -1)
	numMatches := len(matches)
	p.pats = make(patNames, numMatches)
	p.breaks = make([]byte, numMatches)
	p.literals = make([]string, numMatches+1)

	n := 0
	for i, match := range matches {
		a, b := match[2], match[3]
		p.literals[i] = pat[n : a-1] // Need to leave off the colon
		p.pats[i].name = pattern.Variable(pat[a:b])
		p.pats[i].idx = i
		if b == len(pat) {
			p.breaks[i] = '/'
		} else {
			p.breaks[i] = pat[b]
		}
		n = b
	}
	p.literals[numMatches] = pat[n:]

	sort.Sort(p.pats)

	return p
}
695182
func MustPattern(p Pattern, err error) Pattern {
	if err != nil {
		grpclog.Fatalf("Pattern initialization failed: %v", err)
	}
	return p
}