Replaces vector with patterns. Used for loading inputs or
        targets from a file and still preserving patterns.
439740
def patternVector(self, vector):
        
        if not self.patterned: return vector
        if type(vector) == int:
            if self.getWord(vector) != '':
                return self.getWord(vector)
            else:
                return vector
        elif type(vector) == float:
            if self.getWord(vector) != '':
                return self.getWord(vector)
            else:
                return vector
        elif type(vector) == str:
            return vector
        elif type(vector) == list:
            if self.getWord(vector) != '':
                return self.getWord(vector)
        # should be a list
        vec = []
        for v in vector:
            if self.getWord(v) != '':
                retval = self.getWord(v)
                vec.append( retval )
            else:
                retval = self.patternVector(v)
                vec.append( retval )                
        return vec
1198905
def pattern_convert(grammar, raw_node_info):
    """"""
    type, value, context, children = raw_node_info
    if children or type in grammar.number2symbol:
        return pytree.Node(type, children, context=context)
    else:
        return pytree.Leaf(type, value, context=context)
1296191
def zip_patterns(self, patterns):
        
        suffix = self.root.value

        if suffix is not None:
            # We are in a conditional tree.
            new_patterns = {}
            for key in patterns.keys():
                new_patterns[tuple(sorted(list(key) + [suffix]))] = patterns[key]

            return new_patterns

        return patterns
348583
def _simplify(elements):
        """"""
        simplified = []
        previous = None
        for element in elements:
            if element == "..":
                raise FormicError("Invalid glob:"
                                  " Cannot have '..' in a glob: {0}".format(
                                      "/".join(elements)))
            elif element == ".":
                # . in a path does not do anything
                pass
            elif element == "**" and previous == "**":
                # Remove repeated "**"s
                pass
            else:
                simplified.append(os.path.normcase(element))
                previous = element

        if simplified[-1] == "":
            # Trailing slash shorthand for /**
            simplified[-1] = "**"

        # Ensure the pattern either:
        #  * Starts with a "**", or
        #  * Starts with the first real element of the glob
        if simplified[0] == "":
            # "" means the pattern started with a slash.
            del simplified[0]
        else:
            if simplified[0] != "**":
                simplified.insert(0, "**")

        return simplified
359486
def replace(code, pattern, goal):
    """"""
    finder = similarfinder.RawSimilarFinder(code)
    matches = list(finder.get_matches(pattern))
    ast = patchedast.get_patched_ast(code)
    lines = codeanalyze.SourceLinesAdapter(code)
    template = similarfinder.CodeTemplate(goal)
    computer = _ChangeComputer(code, ast, lines, template, matches)
    result = computer.get_changed()
    if result is None:
        return code
    return result
25004
function replace(pattern, placeholders) {
  /* Support function pattern */
  if (typeof pattern === 'function') {
    return pattern(placeholders)
  }
  for (let prop in placeholders) {
    if (placeholders.hasOwnProperty(prop)) {
      pattern = pattern.replace(prop, placeholders[prop]);
    }
  }
  return pattern;
}
868885
def load(self, patterns, dirs, ignore=None):
        
        for path in self.find_files(patterns=patterns, dirs=dirs, ignore=ignore):
            data = self.read_file(path=path)
            if data:
                self.paths[path] = data
543357
def dump(file_name, pattern):
    
    db = XonoticDB.load_path(file_name)
    items = sorted(db.filter(pattern), key=lambda x: natural_sort_key(x[0]))
    for k, v in items:
        click.echo('%s: %s' % (k, v))
555547
def apply_replacements(output)
      replace_patterns.reduce(output) do |output, replacement_pattern|
        replacement_pattern.replace(output)
      end
    end
650601
private final boolean matchPattern(byte[][] patterns, int bufferIndex)
   {
      boolean match = false;
      for (byte[] pattern : patterns)
      {
         int index = 0;
         match = true;
         for (byte b : pattern)
         {
            if (b != m_buffer[bufferIndex + index])
            {
               match = false;
               break;
            }
            ++index;
         }
         if (match)
         {
            break;
         }
      }
      return match;
   }
914195
private static void vectorSwap(PagesIndex pagesIndex, int from, int l, int s)
    {
        for (int i = 0; i < s; i++, from++, l++) {
            pagesIndex.swap(from, l);
        }
    }
227528
def prep_patterns(filenames):
    """"""

    patterns = []

    for filename in filenames:
        try:
            with open(filename) as file:
                patterns += [l.rstrip('\n') for l in file]
        except:  # pylint: disable=W0702
            LOGGER.error("Unable to load pattern file '%s'" % filename)
            sys.exit(1)

    if patterns:
        # return a set to eliminate duplicates
        return set(patterns)
    else:
        LOGGER.error('No terms were loaded')
        sys.exit(1)
912180
def insert_pattern(self, pattern, index):
        

        LOGGER.debug("> Inserting '{0}' at '{1}' index.".format(pattern, index))

        self.remove_pattern(pattern)

        self.beginInsertRows(self.get_node_index(self.root_node), index, index)
        pattern_node = PatternNode(name=pattern)
        self.root_node.insert_child(pattern_node, index)
        self.endInsertRows()
        self.pattern_inserted.emit(pattern_node)
        return True
1252421
def loadTargetsFromFile(self, filename, cols = None, everyNrows = 1,
                            delim = ' ', checkEven = 1):
        
        self.targets = self.loadVectors(filename, cols, everyNrows,
                                        delim, checkEven)
806537
function replacer(match, file, line, col) {
		line = parseInt(line, 10);
		col = parseInt(col, 10);

		for (var i = 0; i < responses.length; i++) {
			var meta = responses[i].meta;
			var sourcemap = meta && meta.sourcemaps && meta.sourcemaps[file];

			if (!sourcemap) {
				continue;
			}

			var smc = new SourceMapConsumer(sourcemap);
			var pos = smc.originalPositionFor({ line: line, column: col });

			if (pos) {
				return pos.name + ' (' + file + ':' + pos.line + ':' + pos.column + ')';
			}
		}

		return match;
	}
95034
function () {
    var pattern = /\{(\d+)\}/g;
    //safer way to convert a pseudo array to an object array
    var args = Array.prototype.slice.call(arguments);
    var s = args.shift();
    return s.replace(pattern, function(c, d) {
      var replacement = args[d] ;
      if (lib.isNull(replacement)) {
        replacement = "";
      }
      return replacement;
    });
  }
600022
static public InputStream replaceEnv(InputStream source) throws IOException, SubstitutionException {
	String template = streamToString(source);
	String replaced = StringUtil.substituteWithEnvironment(template);
	System.err.println(template);
	System.err.println(replaced);
	return new ByteArrayInputStream(replaced.getBytes());
    }