ABSTRACT OPERATIONS
164661
function addMatchers(sections, tree, resultSections, results, index){
	var hasAll = getChild(tree, WILDCARD_ALL);
	if(hasAll) addValue(resultSections.concat(WILDCARD_ALL), hasAll, results);

	var isEnd = index === sections.length;
	if(isEnd) {
		addValue(resultSections, tree, results);
		return;
	}

	var hasOne = getChild(tree, WILDCARD_ONE);
	if (hasOne) addMatchers(
		sections,
		hasOne,
		resultSections.concat(WILDCARD_ONE),
		results,
		index + 1
	);

	var section = sections[index];
	var hasSection = getChild(tree, section);
	if (hasSection) addMatchers(
		sections,
		hasSection,
		resultSections.concat(section),
		results,
		index + 1
	);
}
669352
def _bin_op(instance, opnode, op, other, context, reverse=False):
    
    if reverse:
        method_name = protocols.REFLECTED_BIN_OP_METHOD[op]
    else:
        method_name = protocols.BIN_OP_METHOD[op]
    return functools.partial(
        _invoke_binop_inference,
        instance=instance,
        op=op,
        opnode=opnode,
        other=other,
        context=context,
        method_name=method_name,
    )
245614
def __op(name, val, fmt=None, const=False, consume=0, produce=0):
    

    name = name.lower()

    # fmt can either be a str representing the struct to unpack, or a
    # callable to do more complex unpacking. If it's a str, create a
    # callable for it.
    if isinstance(fmt, str):
        fmt = partial(_unpack, compile_struct(fmt))

    operand = (name, val, fmt, consume, produce, const)

    assert(name not in __OPTABLE)
    assert(val not in __OPTABLE)

    __OPTABLE[name] = operand
    __OPTABLE[val] = operand

    return val
795755
def _handle_unary_op(self, node, scope, ctxt, stream):
        
        self._dlog("handling unary op {}".format(node.op))

        special_switch = {
            "parentof"            : self._handle_parentof,
            "exists"            : self._handle_exists,
            "function_exists"    : self._handle_function_exists,
            "p++"                : self._handle_post_plus_plus,
            "p--"                : self._handle_post_minus_minus,
        }

        switch = {
            # for ++i and --i
            "++":        lambda x,v: x.__iadd__(1),
            "--":        lambda x,v: x.__isub__(1),

            "~":        lambda x,v: ~x,
            "!":        lambda x,v: not x,
            "-":        lambda x,v: -x,
            "sizeof":    lambda x,v: (fields.UInt64()+x._pfp__width()),
            "startof":    lambda x,v: (fields.UInt64()+x._pfp__offset),
        }

        if node.op not in switch and node.op not in special_switch:
            raise errors.UnsupportedUnaryOperator(node.coord, node.op)

        if node.op in special_switch:
            return special_switch[node.op](node, scope, ctxt, stream)

        field = self._handle_node(node.expr, scope, ctxt, stream)
        if type(field) is type:
            field = field()
        res = switch[node.op](field, 1)
        if type(res) is bool:
            new_res = field.__class__()
            new_res._pfp__set_value(1 if res == True else 0)
            res = new_res
        return res
910277
def callable(self, nans=False):
        """"""
        jitfunc = nb.njit(self.func, nogil=True)

        def _loop(sortidx, group_idx, a, ret):
            size = len(ret)
            group_idx_srt = group_idx[sortidx]
            a_srt = a[sortidx]

            indices = step_indices(group_idx_srt)
            for i in range(len(indices) - 1):
                start_idx, stop_idx =  indices[i], indices[i + 1]
                ri = group_idx_srt[start_idx]
                if ri < 0:
                    raise ValueError("negative indices not supported")
                if ri >= size:
                    raise ValueError("one or more indices in group_idx are too large")
                ret[ri] = jitfunc(a_srt[start_idx:stop_idx])
        return nb.njit(_loop, nogil=True)
1192021
private static Map<Symbol, Aggregation> outputsAsInputs(Map<Symbol, Aggregation> assignments)
    {
        ImmutableMap.Builder<Symbol, Aggregation> builder = ImmutableMap.builder();
        for (Map.Entry<Symbol, Aggregation> entry : assignments.entrySet()) {
            Symbol output = entry.getKey();
            Aggregation aggregation = entry.getValue();
            checkState(!aggregation.getCall().getOrderBy().isPresent(), "Intermediate aggregation does not support ORDER BY");
            builder.put(
                    output,
                    new Aggregation(
                            new FunctionCall(aggregation.getCall().getName(), ImmutableList.of(output.toSymbolReference())),
                            aggregation.getFunctionHandle(),
                            Optional.empty()));  // No mask for INTERMEDIATE
        }
        return builder.build();
    }
69345
private LinkedHashSet<Formula> condenseOperandsAnd(final Collection<? extends Formula> operands) {
    final LinkedHashSet<Formula> ops = new LinkedHashSet<>();
    this.cnfCheck = true;
    for (final Formula form : operands)
      if (form.type() == AND) {
        for (final Formula f : ((NAryOperator) form).operands) {
          this.addFormulaAnd(ops, f);
          if (!this.formulaAdditionResult[0])
            return null;
          if (!this.formulaAdditionResult[1])
            this.cnfCheck = false;
        }
      } else {
        this.addFormulaAnd(ops, form);
        if (!this.formulaAdditionResult[0])
          return null;
        if (!this.formulaAdditionResult[1])
          this.cnfCheck = false;
      }
    return ops;
  }
1127475
def method(func):
    """"""
    attr = abc.abstractmethod(func)
    attr.__imethod__ = True
    return attr
1003783
function(fI, fD, F, alg, rules) {        
        if (!alg) alg = ReasoningEngine.incremental;
        return alg(fI, fD, F, rules);
    }
172791
def build_operation_chain(stack)
      empty_op = EmptyOperation.new(nil)

      stack.reverse.reduce(empty_op) do |next_op, current_op|
        klass, args, block = current_op

        if Class === klass
          klass.new(next_op, *args, &block)
        elsif Proc === klass
          lambda do |env|
            next_op.call(klass.call(env, *args))
          end
        else
          raise StandardError, "Invalid operation, doesn't respond to `call`: #{klass.inspect}"
        end
      end
    end
1053850
def abstracts(self, key, value):
    """"""
    result = []

    source = force_single_element(value.get('9'))

    for a_value in force_list(value.get('a')):
        result.append({
            'source': source,
            'value': a_value,
        })

    return result
347301
function Operation(spec, options, fn) {
  if (typeof options === 'function') {
    fn = [].slice.call(arguments).slice(1);
    options = {};
  } else if (Array.isArray(options)) {
    fn = options;
    options = {};
  } else if (!Array.isArray(fn)) {
    fn = [].slice.call(arguments).slice(2);
  }

  if (!(this instanceof Operation)) {
    return new Operation(spec, options, fn);
  }

  if (typeof spec !== 'object') {
    throw new Error('operation spec must be an object');
  }

  debug('create operation', spec);

  this.spec = spec;
  this.options = options || {};
  this.fn = fn;
  this.middleware = {};
}
858905
def operations(nsteps):
        ''''''
        return {'A': 1 + nsteps,
                'M': 2 + nsteps,
                'Ml': 2 + nsteps,
                'Mr': 1 + nsteps,
                'ip_B': 2 + nsteps + nsteps*(nsteps+1)/2,
                'axpy': 4 + 2*nsteps + nsteps*(nsteps+1)/2
                }
596728
def t_op(self, s):
        '

        # Operators need to be further classified since the grammar requires this
        if s in ('<', '>', '==', '>=', '<=', '<>', '!='):
            self.add_token('COMP_OP', s)
        elif s in ('+=', '-=', '*=', '/=', '%=', '&=', '|=', '^=', '<<=', '>>=', '**=',
                   '//='):
            self.add_token('AUGASSIGN', s)
        elif s in self.UNOP2NAME.keys():
            self.add_token(self.UNOP2NAME[s], s)
        elif s in ('|', '^', '&', '<<', '>>', '**', '/', '%', '//'):
            # These are  *ONLY* binary operators. Operators which are exclusively or
            # can be unary operators were handled previously
            self.add_token('BINOP', s)
        elif s == '=':
            self.add_token('EQUAL', s)
        else:
            print("Internal error: Unknown operator %s" % s)
            raise SystemExit
475690
def clean_abstract(abstract, remove_tags=['xref', 'ext-link', 'inline-formula', 'mml:*']):
    
    if remove_tags:
        for tag_name in remove_tags:
            abstract = utils.remove_tag(tag_name, abstract)
    return abstract
235202
def binary_operation_logical(self, rule, left, right, **kwargs):
        
        return self.evaluate_binop_logical(rule.operation, left, right, **kwargs)
919965
function inResult(event, operation) {
  switch (event.type) {
    case NORMAL:
      switch (operation) {
        case INTERSECTION:
          return !event.otherInOut;
        case UNION:
          return event.otherInOut;
        case DIFFERENCE:
          // return (event.isSubject && !event.otherInOut) ||
          //         (!event.isSubject && event.otherInOut);
          return (event.isSubject && event.otherInOut) ||
                  (!event.isSubject && !event.otherInOut);
        case XOR:
          return true;
      }
      break;
    case SAME_TRANSITION:
      return operation === INTERSECTION || operation === UNION;
    case DIFFERENT_TRANSITION:
      return operation === DIFFERENCE;
    case NON_CONTRIBUTING:
      return false;
  }
  return false;
}