Add given patterns to trace filter set or clear set if patterns is
    None.
187655
def trace_filter (patterns):
    """"""
    if patterns is None:
        _trace_filter.clear()
    else:
        _trace_filter.update(re.compile(pat) for pat in patterns)
598421
@Override
    public final void applyPattern(String pattern)
    {

        if (hasRegistry())
        {
            super.applyPattern(pattern);
            toPattern = super.toPattern();
            return;
        }

        ArrayList<Format> foundFormats = new ArrayList<Format>();
        ArrayList<String> foundDescriptions = new ArrayList<String>();
        StringBuilder stripCustom = new StringBuilder(pattern.length());

        ParsePosition pos = new ParsePosition(0);
        char[] c = pattern.toCharArray();
        int fmtCount = 0;

        while (pos.getIndex() < pattern.length())
        {

            char charType = c[pos.getIndex()];

            if (QUOTE == charType)
            {

                appendQuotedString(pattern, pos, stripCustom, true);
                continue;

            }

            if (START_FE == charType)
            {

                fmtCount++;
                seekNonWs(pattern, pos);
                int start = pos.getIndex();
                int index = readArgumentIndex(pattern, next(pos));
                stripCustom.append(START_FE).append(index);
                seekNonWs(pattern, pos);
                Format format = null;
                String formatDescription = null;
                if (c[pos.getIndex()] == START_FMT)
                {
                    formatDescription = parseFormatDescription(pattern, next(pos));
                    format = getFormat(formatDescription);
                    if (format == null)
                    {
                        stripCustom.append(START_FMT).append(formatDescription);
                    }
                }
                foundFormats.add(format);
                foundDescriptions.add(format == null ? null : formatDescription);

                Preconditions.checkState(foundFormats.size() == fmtCount);
                Preconditions.checkState(foundDescriptions.size() == fmtCount);

                if (c[pos.getIndex()] != END_FE)
                {
                    throw new IllegalArgumentException("Unreadable format element at position " + start);
                }

            }

            //$FALL-THROUGH$
            stripCustom.append(c[pos.getIndex()]);
            next(pos);

        }

        super.applyPattern(stripCustom.toString());

        toPattern = insertFormats(super.toPattern(), foundDescriptions);

        if (containsElements(foundFormats))
        {
            Format[] origFormats = getFormats();
            // only loop over what we know we have, as MessageFormat on Java 1.3
            // seems to provide an extra format element:
            Iterator<Format> it = foundFormats.iterator();
            for (int i = 0; it.hasNext(); i++)
            {
                Format f = it.next();
                if (f != null)
                {
                    origFormats[i] = f;
                }
            }
            super.setFormats(origFormats);
        }

    }
343192
def set_trace():
    """"""
    # https://github.com/nose-devs/nose/blob/master/nose/tools/nontrivial.py
    pdb.Pdb(stdout=sys.__stdout__).set_trace(sys._getframe().f_back)
551231
public void setPattern(Pattern regex)
    {
        this.re = regex;

        int memregCount, counterCount, lookaheadCount;
        if ((memregCount = regex.memregs) > 0) {
            MemReg[] memregs = new MemReg[memregCount];
            for (int i = 0; i < memregCount; i++) {
                memregs[i] = new MemReg(-1); //unlikely to SearchEntry, in this case we know memreg indices by definition
            }
            this.memregs = memregs;
        }

        if ((counterCount = regex.counters) > 0) counters = new int[counterCount];

        if ((lookaheadCount = regex.lookaheads) > 0) {
            LAEntry[] lookaheads = new LAEntry[lookaheadCount];
            for (int i = 0; i < lookaheadCount; i++) {
                lookaheads[i] = new LAEntry();
            }
            this.lookaheads = lookaheads;
        }

        this.memregCount = memregCount;
        this.counterCount = counterCount;
        this.lookaheadCount = lookaheadCount;

        first = new SearchEntry();
        defaultEntry = new SearchEntry();
        minQueueLength = regex.stringRepr.length() / 2;  // just evaluation!!!

    }
681541
function addFiles(pattern, cb){
    glob(pattern, function(err, files){
      if(err) throw err;

      async.each(files, readFile, function(err){
        if(err) throw err;
        if(cb) cb();
      });
    });
  }
669544
@Deprecated
    protected void setTraceSpec(String s) {
        if (s != null) {
            TraceSpecification ts = new TraceSpecification(s, null, false);
            setTraceSpec(ts);
        }
    }
176431
function isNotAPattern(pattern) {
  let set = new Minimatch(pattern).set;
  if (set.length > 1) {
    return false;
  }

  for (let j = 0; j < set[0].length; j++) {
    if (typeof set[0][j] !== 'string') {
      return false;
    }
  }

  return true;
}
1048471
@Deprecated
    public void setPattern(Pattern pattern) {
        patterns = new ArrayList<Pattern>(1);
        patterns.add(pattern);
    }
1065712
def _add_filters(self, **filters):
        """"""
        for key, value in filters.items():
            if self._field_is_pk(key):
                pk = self.cls.get_field('pk').normalize(value)
                self._lazy_collection['pks'].add(pk)
            else:
                # store the info to call the index later, in ``_prepare_sets``
                # (to avoid doing extra work if the collection is never called)
                index, suffix, extra_field_parts = self._parse_filter_key(key)
                parsed_filter = ParsedFilter(index, suffix, extra_field_parts, value)
                self._lazy_collection['sets'].append(parsed_filter)

        return self
1312604
protected void setStopPattern (String pattern)
    {
        _stopMatcher = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE).matcher("");
    }
1262496
def addPattern(self, word, vector):
        
        if word in self.patterns:
            raise NetworkError('Pattern key already in use. Call delPattern to free key.', word)
        else:
            self.patterns[word] = vector
659439
function replaceWithPatterns( src, patterns ){
    return _.reduce(
        patterns,
        function( replacedCode, replacement, pattern ){
            return replacedCode.replace( new RegExp( pattern, "gi" ), replacement, "gi" );
        },
        src
    );
}
252765
public void addModeForPattern(String pattern, Integer mode) {
        System.out.println(String.format("*** Recording pattern \"%s\" with mode %o", pattern, mode));
        patternToModeMap.put(pattern, mode);
    }
427596
@SuppressWarnings("UnusedDeclaration")
    public void setPatterns(Iterable<AccountPatternData> patterns) {
        this.patterns.clear();
        for (AccountPatternData data : patterns) {
            this.patterns.add(new AccountPatternData(data));
        }
    }
547498
@Nonnull
	public DataBuilder appendOperatingSystemPattern(@Nonnull final OperatingSystemPattern pattern) {
		Check.notNull(pattern, "pattern");

		if (!operatingSystemPatterns.containsKey(pattern.getId())) {
			operatingSystemPatterns.put(pattern.getId(), new TreeSet<OperatingSystemPattern>(OS_PATTERN_COMPARATOR));
		}

		operatingSystemPatterns.get(pattern.getId()).add(pattern);
		return this;
	}
534002
private void patternFilter(PatternDescrBuilder<?> pattern) throws RecognitionException {
        //        if ( input.LA( 1 ) == DRL6Lexer.PIPE ) {
        //            while ( input.LA( 1 ) == DRL6Lexer.PIPE ) {
        //                match( input,
        //                       DRL6Lexer.PIPE,
        //                       null,
        //                       null,
        //                       DroolsEditorType.SYMBOL );
        //                if ( state.failed ) return;
        //
        //                filterDef( pattern );
        //                if ( state.failed ) return;
        //            }
        //        } else {
        match(input,
                DRL6Lexer.ID,
                DroolsSoftKeywords.OVER,
                null,
                DroolsEditorType.KEYWORD);
        if (state.failed)
            return;

        filterDef(pattern);
        if (state.failed)
            return;
        //        }
    }
310907
protected List<Object> filterAttributeValuesByPattern(final Set<Object> attributeValues, final Pattern pattern) {
        return attributeValues.stream().filter(v -> RegexUtils.matches(pattern, v.toString(), completeMatch)).collect(Collectors.toList());
    }