Look for mutation points in an expression and its children.
973138
def walk(fexp, tree)

      ftree = Ruote.compact_tree(@ps.current_tree(fexp))

      if ftree[0] != tree[0] || ftree[1] != tree[1]
        #
        # if there is anything different between the current tree and the
        # desired tree, let's force a re-apply

        register(MutationPoint.new(fexp.fei, tree, :re_apply))

      elsif ftree[2] == tree[2]
        #
        # else, if the tree children are the same, exit, there is nothing to do

        return

      else

        register(MutationPoint.new(fexp.fei, tree, :update))
          #
          # NOTE: maybe a switch for this mutation not to be added would
          #       be necessary...

        if fexp.is_concurrent?
          #
          # concurrent expressions follow a different heuristic

          walk_concurrence(fexp, ftree, tree)

        else
          #
          # all other expressions are considered sequence-like

          walk_sequence(fexp, ftree, tree)
        end
      end
    end
331054
private Expression checker(Data data) throws TemplateException {
	Expression expr = null;
	// String
	if ((expr = string(data)) != null) {
	    expr = subDynamic(data, expr, false, false);
	    data.mode = STATIC;// (expr instanceof Literal)?STATIC:DYNAMIC;// STATIC
	    return expr;
	}
	// Number
	if ((expr = number(data)) != null) {
	    expr = subDynamic(data, expr, false, false);
	    data.mode = STATIC;// (expr instanceof Literal)?STATIC:DYNAMIC;// STATIC
	    return expr;
	}
	// closure
	if ((expr = closure(data)) != null) {
	    data.mode = DYNAMIC;
	    return expr;
	}
	// lambda
	if ((expr = lambda(data)) != null) {
	    data.mode = DYNAMIC;
	    return expr;
	}

	// Dynamic
	if ((expr = dynamic(data)) != null) {
	    expr = newOp(data, expr);
	    expr = subDynamic(data, expr, true, false);
	    data.mode = DYNAMIC;
	    return expr;
	}
	// Sharp
	if ((expr = sharp(data)) != null) {
	    data.mode = DYNAMIC;
	    return expr;
	}
	// JSON
	if ((expr = json(data, JSON_ARRAY, '[', ']')) != null) {
	    expr = subDynamic(data, expr, false, false);
	    data.mode = DYNAMIC;
	    return expr;
	}
	if ((expr = json(data, JSON_STRUCT, '{', '}')) != null) {
	    expr = subDynamic(data, expr, false, false);
	    data.mode = DYNAMIC;
	    return expr;
	}
	// else Error
	throw new TemplateException(data.srcCode, "Syntax Error, Invalid Construct");
    }
387232
function findExpressionStatement(start, end) {
            let target = sourceCode.getNodeByRangeIndex(start)
            while (
                target &&
                target.range[1] <= end &&
                start <= target.range[0]
            ) {
                if (
                    target.type === "ExpressionStatement" &&
                    start === target.range[0] &&
                    target.range[1] === end
                ) {
                    return target
                }
                target = target.parent
            }
            return null
        }
506928
def summarize_mutation(mutation_name, event, inputs, outputs, isAsync=False):
    
    return dict(
        name=mutation_name,
        event=event,
        isAsync=isAsync,
        inputs=inputs,
        outputs=outputs,
    )
891185
private static void checkNesting(final BooleanExpression expression,
			final List<BooleanExpression> visitedExpressions) {
		if (visitedExpressions.contains(expression)) {
			// Unfortunately, we can't give much more information - even calling toString() will overflow the stack.
			throw new SyntaxException("An expression can not contain itself.");
		}

		visitedExpressions.add(expression);

		if (expression instanceof GroupExpression) {
			GroupExpression group = (GroupExpression) expression;
			for (BooleanExpression operand : group.getOperands()) {
				checkNesting(operand, visitedExpressions);
			}
		}
	}
41995
def _search_in_bases(type_):
    """"""
    found = False
    for base_type in type_.declaration.bases:
        try:
            found = internal_type_traits.get_by_name(
                base_type.related_class, "element_type")
        except runtime_errors.declaration_not_found_t:
            pass
        if found:
            return found
    raise RuntimeError(
        ("Unable to find 'element_type' declaration '%s'"
         "in type '%s'.") % type_.decl_string)
38085
def find_event_parent_with_event_child(self, parent_name, child_name):
        """"""
        G = self.G
        matches = []
        for n in G.node.keys():
            if G.node[n]['is_event'] and G.node[n]['type'] == parent_name:
                children = G.successors(n)
                for child in children:
                    if G.node[child]['is_event'] and \
                            G.node[child]['type'] == child_name:
                        matches.append((n, child))
                        break
        return list(set(matches))
149324
private boolean parseVariant(SequenceLocation sequenceLocation, String line) {
        boolean validVariant;
        String[] fields = line.split("\t", -1);
        String mutationCds = fields[17];

        if (mutationCds.contains(">")) {
            validVariant = parseSnv(mutationCds, sequenceLocation);
            if (!validVariant) {
                invalidSubstitutionLines++;
            }
        } else if (mutationCds.contains("del")) {
            validVariant = parseDeletion(mutationCds, sequenceLocation);
            if (!validVariant) {
                invalidDeletionLines++;
            }
        } else if (mutationCds.contains("ins")) {
            validVariant = parseInsertion(mutationCds, sequenceLocation);
            if (!validVariant) {
                invalidInsertionLines++;
            }
        } else if (mutationCds.contains("dup")) {
            validVariant = parseDuplication(mutationCds);
            if (!validVariant) {
                invalidDuplicationLines++;
            }
        } else {
            validVariant = false;
            invalidMutationCDSOtherReason++;
        }

        return validVariant;
    }
295243
private Node tryOptimizeNameDeclaration(Node subtree) {
    checkState(NodeUtil.isNameDeclaration(subtree));
    Node left = subtree.getFirstChild();
    if (left.isDestructuringLhs() && left.hasTwoChildren()) {
      Node pattern = left.getFirstChild();
      if (!pattern.hasChildren()) {
        // `var [] = foo();` becomes `foo();`
        Node value = left.getSecondChild();
        subtree.replaceWith(IR.exprResult(value.detach()).srcref(value));
        reportChangeToEnclosingScope(value);
      }
    }
    return subtree;
  }
265431
function getMatchingElementFromMutation  (mutation, selector)
{
	let {
		type,
		target,
		addedNodes
	} = mutation;

	if (type === 'attributes' && target.matches(selector))
	{
		return target;
	}

	if (type === 'childList')
	{
		for (let addedNode of addedNodes)
		{
			if (typeof addedNode.matches === 'function' && addedNode.matches(selector))
			{
				return addedNode;
			}
		}

		return target.querySelector(selector);
	}

	return null;
}
111496
def mutations(self, nbr, strength):
		'''
		
		'''
		for i in range(nbr):
			self.mutation(strength)
857370
def summarize_crud_mutation(method, model, isAsync=False):
    

    # create the approrpriate action type
    action_type = get_crud_action(method=method, model=model)
    # the name of the mutation
    name = crud_mutation_name(model=model, action=method)
    # a mapping of methods to input factories
    input_map = {
        'create': create_mutation_inputs,
        'update': update_mutation_inputs,
        'delete': delete_mutation_inputs,
    }
    # a mappting of methods to output factories
    output_map = {
        'create': create_mutation_outputs,
        'update': update_mutation_outputs,
        'delete': delete_mutation_outputs,
    }
    # the inputs for the mutation
    inputs = input_map[method](model)
    # the mutation outputs
    outputs = output_map[method](model)

    # return the appropriate summary
    return summarize_mutation(
        mutation_name=name,
        event=action_type,
        isAsync=isAsync,
        inputs=inputs,
        outputs=outputs
    )
281734
public void doMutation(PermutationSolution<T> solution) {
    int permutationLength ;
    permutationLength = solution.getNumberOfVariables() ;

    if ((permutationLength != 0) && (permutationLength != 1)) {
      if (mutationRandomGenerator.getRandomValue() < mutationProbability) {
        int pos1 = positionRandomGenerator.getRandomValue(0, permutationLength - 1);
        int pos2 = positionRandomGenerator.getRandomValue(0, permutationLength - 1);

        while (pos1 == pos2) {
          if (pos1 == (permutationLength - 1))
            pos2 = positionRandomGenerator.getRandomValue(0, permutationLength - 2);
          else
            pos2 = positionRandomGenerator.getRandomValue(pos1, permutationLength - 1);
        }

        T temp = solution.getVariableValue(pos1);
        solution.setVariableValue(pos1, solution.getVariableValue(pos2));
        solution.setVariableValue(pos2, temp);
      }
    }
  }
1240832
private void findAllTVEs(
            AbstractExpression expr, List<TupleValueExpression> tveList) {
        if (!isNewtoColumnList(m_aggResultColumns, expr)) {
            return;
        }

        if (expr instanceof TupleValueExpression) {
            tveList.add((TupleValueExpression) expr.clone());
            return;
        }

        if ( expr.getLeft() != null) {
            findAllTVEs(expr.getLeft(), tveList);
        }

        if (expr.getRight() != null) {
            findAllTVEs(expr.getRight(), tveList);
        }

        if (expr.getArgs() != null) {
            for (AbstractExpression ae: expr.getArgs()) {
                findAllTVEs(ae, tveList);
            }
        }
    }
1001061
private Stream<ImmutableExpression> extractEqualities(ImmutableSubstitution<ImmutableTerm> substitution,
                                                          ImmutableSet<Variable> leftVariables) {
        return substitution.getImmutableMap().entrySet().stream()
                .filter(e -> leftVariables.contains(e.getKey()) || leftVariables.contains(e.getValue()))
                .map(e -> termFactory.getImmutableExpression(EQ, e.getKey(), e.getValue()));
    }
859207
def findall(self, name, recursive=False):
        """"""
        if self.children is not None:
            for child in self.children:
                if child.name == name:
                    yield child
                if recursive:
                    for atom in child.findall(name, True):
                        yield atom
1277473
def find_prototypes(code):
    

    prots = []
    lines = code.split('\n')
    for line in lines:
        m = re.match("\s*" + re_func_prot, line)
        if m is not None:
            rtype, name, args = m.groups()[:3]
            if args == 'void' or args.strip() == '':
                args = []
            else:
                args = [tuple(arg.strip().split(' '))
                        for arg in args.split(',')]
            prots.append((name, args, rtype))

    return prots