Custom extract from AstMerge's implementation for a particular case `(merge l r TRUE FALSE [] [] 'auto' )`
177857
Frame merge(Frame l, Frame r, int[] byLeft, int[] byRite) {
      boolean allLeft = true;
      // See comments in the original implementation in AstMerge.java
      new GCForceTask().doAllNodes();

      int ncols = byLeft.length;
      l.moveFirst(byLeft);
      r.moveFirst(byRite);

      int[][] id_maps = new int[ncols][];
      for (int i = 0; i < ncols; i++) {
        Vec lv = l.vec(i);
        Vec rv = r.vec(i);

        if (lv.isCategorical()) {
          assert rv.isCategorical();
          id_maps[i] = CategoricalWrappedVec.computeMap(lv.domain(), rv.domain());
        }
      }
      int cols[] = new int[ncols];
      for (int i = 0; i < ncols; i++) cols[i] = i;
      return register(Merge.merge(l, r, cols, cols, allLeft, id_maps));
    }
17410
function extract(
  pattern /* : string */,
  babelPlugins /* : Array<string> */ = []
) /* : string */ {
  const srcPaths = glob.sync(pattern, { absolute: true });
  const relativeSrcPaths = glob.sync(pattern);
  const contents = srcPaths.map(p => fs.readFileSync(p, 'utf-8'));
  const reqBabelPlugins = babelPlugins.map(b =>
    require.resolve(`babel-plugin-${b}`)
  );
  const messages = contents
    .map(content =>
      babel.transform(content, {
        presets: [require.resolve('babel-preset-react-app')],
        plugins: [
          require.resolve('babel-plugin-react-intl'),
          ...reqBabelPlugins,
        ],
        babelrc: false,
      })
    )
    .map(R.path(['metadata', 'react-intl', 'messages']));

  const result = R.zipWith(
    (m, r) => m.map(R.assoc('filepath', r)),
    messages,
    relativeSrcPaths
  )
    .filter(R.complement(R.isEmpty))
    .reduce(R.concat, []);

  return result;
}
594082
function merge(docset, customTags) {
  doc_ast.linenr = docset["linenr"];

  // useful for applying global NS items to the proper NS
  docset["original_name"] = docset["code"].name;
  docset["comment"] = doc_ast.detect(docset["tagname"], docset["comment"], customTags);
  
  return Merger.merge(docset);
}
1352188
function extractSubset(path, drizzle) {
  const pathBits = splitPath(path);
  const results = R.path(pathBits, drizzle);
  return results;
}
1241348
def _expand_autotag(atag, container):
    
    if atag.tag != "auto":
        return

    if "names" in atag.attrib:
        i = -1
        for name in re.split("[\s,]+", atag.attrib["names"]):
            if name[0] == '^':
                name = name[1::]
                insert = True
                i += 1
            else:
                insert = False
                
            for child in atag:
                dupe = child.copy()
                for attr, value in dupe.items():
                    dupe.attrib[attr] = value.replace("$", name)

                if insert:
                    container.insert(i, dupe)
                else:
                    container.append(dupe)            
    else:
        from fortpy.msg import warn
        warn("'names' is a required attribute of the <auto> tag.")
439241
private void extractFeatures(Set<EntityFeature> features, boolean normalFeature,
		List<Glyph> list)
	{
		for (EntityFeature feature : features) {
			if (feature instanceof ModificationFeature || feature instanceof FragmentFeature) {
				Glyph stvar = factory.createGlyph();
				stvar.setClazz(GlyphClazz.STATE_VARIABLE.getClazz());
				Glyph.State state = featStrGen.createStateVar(feature, factory);
				if (state != null) {
					// Add a "!" in front of NOT features
					if (!normalFeature) {
						state.setValue("!" + state.getValue());
					}
					stvar.setState(state);
					list.add(stvar);
				}
			}
		}
	}
369347
function compileExtractionResult(orderedFiles, extractions) {
  const extractedVariables = { global: {} };

  orderedFiles.map(filename => {
    const globalFileVariables = extractions[filename].variables.global;

    Object.keys(globalFileVariables).map(variableKey => {
      globalFileVariables[variableKey].forEach(extractedVariable => {
        let variable = extractedVariables.global[variableKey];
        let currentVariableSources = [];
        let currentVariableDeclarations = [];

        if(variable) {
          currentVariableSources = variable.sources;
          currentVariableDeclarations = variable.declarations;
        }

        const hasOnlyDefaults = currentVariableDeclarations.every(declaration => declaration.flags.default);
        const currentIsDefault = extractedVariable.declaration.flags.default;

        if(currentVariableDeclarations.length === 0 || !currentIsDefault || hasOnlyDefaults) {
          variable = extractedVariables.global[variableKey] = Object.assign({}, extractedVariable.value);
        }
        variable.sources = currentVariableSources.indexOf(filename) < 0 ? [...currentVariableSources, filename] : currentVariableSources;
        variable.declarations = [...currentVariableDeclarations, {
          expression: extractedVariable.declaration.expression,
          flags: extractedVariable.declaration.flags,
          in: filename,
          position: extractedVariable.declaration.position,
        }];
      });
    });
  });

  return extractedVariables;
}
998113
function combineDepends( depends ) {
   var deps, items;

    deps = [];

    _.each(depends, function(ex) {
        items = [];
        switch (ex.type) {
            case 'Literal':
                items = _.map(ex.value.split(','), function(v) {
                    return v.trim();
                });
                break;
            case 'ArrayExpression':
                items = _.map(ex.elements, function(v) {
                    return v.value.trim();
                });
                break;
        }

        deps = _.union(deps, items)
    });

    return deps;
}
1316734
function extractor(input) {
  var ast;
  var defaultMessages = {};

  if (typeof input === "string") {

    // input as a filename.
    if ((/\.js$/i).test(input) && !(/\n/).test(input)) {
      input = fs.readFileSync(input);
    }

    // input as a file content.
    ast = esprima.parse(input);

  // input as an AST.
  } else {
    ast = input;
  }

  // Traverse AST and perform transforms.
  traverse(ast, function(node) {
    transforms.forEach(function(visitor) {
      if (visitor.test(node)) {
        visitor.transform(node);
      }
    });
  });

  // Traverse AST and collect default messages.
  traverse(ast, function(node) {
    extend(defaultMessages, visitors.filter(function(visitor) {
      return visitor.test(node);
    }).reduce(function(defaultMessages, visitor) {
      var aux = visitor.getDefaultMessage(node);
      defaultMessages[aux.path] = aux.message;
      return defaultMessages;
    }, {}));
  });

  return defaultMessages;
}
465744
function extractJavadoc(str) {
  var lines = str
    .replace(/^[ \t]+|[ \t]+$/g, '') // Trim whitespace.
    .split('\n').map(function (line, i) {
      return i ? line.replace(/^\s*\*\s?/, '') : line;
    });
  while (!lines[0]) {
    lines.shift();
  }
  while (!lines[lines.length - 1]) {
    lines.pop();
  }
  return lines.join('\n');
}
382322
function merge(config, extension, separator, whitelist) {
    whitelist = whitelist || [];
    separator = separator || ":";

    Object
        .keys(extension)
        .filter(function (key) {
            return !whitelist.length || whitelist.indexOf(key) !== -1;
        })
        .forEach(function (key) {
            applyKey(config, key.split(separator), extension[key]);
        });

    return config;
}
132286
function extractFromRow(row, context, asString)
{
  var map    = row._arrayProcessedColumns;
  var values = row.values;

  // get the value
  var columnIndex = this.getIndex();
  var ret = values[columnIndex];

  // if we want the value as a string, and the column is of type variant, and we
  // haven't already processed the value before, we don't need to process the
  // value, so only process if none of the aforementioned conditions are true
  if (!(asString && this.isVariant() && !map[columnIndex]))
  {
    // if the column value has not been processed yet, process it, put it back
    // in the values array, and remember that the value has been processed
    if (!map[columnIndex])
    {
      if (ret !== null)
      {
        ret = values[columnIndex] =
            context.convert(values[columnIndex], this, context);
      }
      map[columnIndex] = true;
    }

    // use the appropriate extraction function depending on whether
    // we want the value or a string representation of the value
    var extractFn = !asString ? context.toValue : context.toString;
    ret = extractFn(ret);
  }

  return ret;
}
707833
private String performSplitting(String source, String splitString, String indexString)
        throws TransformationOperationException {
        Integer index = parseIntString(indexString, false, 0);
        Matcher matcher = generateMatcher(splitString, source);
        for (int i = 0; i <= index; i++) {
            matcher.find();
        }
        String value = matcher.group();
        if (value == null) {
            getLogger().warn("No result for given regex and index. The empty string will be taken instead.");
            value = "";
        }
        return value;
    }
441402
function autoBox(object, model, data) {
    if (!object) {
      return isArray(data) ? model.collection(data, true) : model.instance(data);
    }
    if (isArray(data) && isArray(object)) {
      return model.collection(data, true);
    }
    if (data && JSON.stringify(data).length > 3) {
      deepExtend(object, data);
      object.$original.sync(data);
    }
    return object;
  }
1138202
def alt_parser(patterns):
    
    from reparse.util import remove_lower_overlapping
    get_first = lambda items: [i[0] for i in items]
    get_second = lambda items: [i[1] for i in items]

    def parse(line):
        output = []
        for pattern in patterns:
            results = pattern.scan(line)
            if results and any(results):
                output.append((pattern.order, results))
        return get_first(reduce(remove_lower_overlapping, get_second(sorted(output)), []))

    return parse
640814
public Collection<SQLSegment> extract(final SQLAST ast) {
        Collection<SQLSegment> result = new LinkedList<>();
        Preconditions.checkState(ast.getSQLStatementRule().isPresent());
        Map<ParserRuleContext, Integer> parameterMarkerIndexes = getParameterMarkerIndexes(ast.getParserRuleContext());
        for (SQLSegmentExtractor each : ast.getSQLStatementRule().get().getExtractors()) {
            if (each instanceof OptionalSQLSegmentExtractor) {
                Optional<? extends SQLSegment> sqlSegment = ((OptionalSQLSegmentExtractor) each).extract(ast.getParserRuleContext(), parameterMarkerIndexes);
                if (sqlSegment.isPresent()) {
                    result.add(sqlSegment.get());
                }
            } else if (each instanceof CollectionSQLSegmentExtractor) {
                result.addAll(((CollectionSQLSegmentExtractor) each).extract(ast.getParserRuleContext(), parameterMarkerIndexes));
            }
        }
        return result;
    }
1280588
def eval_to_ast(self, e, n, extra_constraints=(), exact=None):
        
        return [ ast.bv.BVV(v, e.size()) for v in self.eval(e, n, extra_constraints=extra_constraints, exact=exact) ]