Logic for scattering a variable.
514997
def _do_scatter_var(v, parallel):
    
    # For batches, scatter records only at the top level (double nested)
    if parallel.startswith("batch") and workflow.is_cwl_record(v):
        return (tz.get_in(["type", "type"], v) == "array" and
                tz.get_in(["type", "type", "type"], v) == "array")
    # Otherwise, scatter arrays
    else:
        return (tz.get_in(["type", "type"], v) == "array")
619379
def _call(self, x, out=None):
        """"""
        if out is None:
            return self.operator(x * self.vector)
        else:
            tmp = self.domain.element()
            x.multiply(self.vector, out=tmp)
            self.operator(tmp, out=out)
520350
def _transform(self, var):
        '''  '''
        self.collection.variables.pop(var.name)
        return var.values
1134670
private static String getFreeVariable(Expression2 expression, int index, Scope scope) {
    Expression2 sub = expression.getSubexpression(index);
    if (sub.isConstant()) {
      String constant = sub.getConstant();
      if (!constant.equals(LAMBDA) && !scope.isBound(constant)) {
        return sub.getConstant();
      } 
    }
    return null;
  }
978225
public void freeVariables(SyntacticItem e, Set<WyalFile.VariableDeclaration> freeVars) {
		if (e instanceof Expr.VariableAccess) {
			Expr.VariableAccess va = (Expr.VariableAccess) e;
			freeVars.add(va.getVariableDeclaration());
		} else if (e instanceof Expr.Quantifier) {
			Expr.Quantifier q = (Expr.Quantifier) e;
			freeVariables(q.getBody(), freeVars);
			// Remove any bound variables
			for (WyalFile.VariableDeclaration vd : q.getParameters()) {
				freeVars.remove(vd);
			}
		} else {
			for (int i = 0; i != e.size(); ++i) {
				SyntacticItem item = e.get(i);
				if (item != null) {
					freeVariables(item, freeVars);
				}
			}
		}
	}
36204
function gather (variable, node) {
  if (node.parent) {
    let values = []
    for (let n of Object.values(node.parent.nodes)) {
      if (n.type === 'decl' && n.prop === `$${variable}`) {
        values.push(n.value)
      }
    }
    values.reverse()
    let parentValues = node.parent.parent ? gather(variable, node.parent) : null
    if (parentValues) {
      values = values.concat(parentValues)
    }
    return values
  }
  return null
}
739930
def defvars(self):
    """"""
    for f in self.body:
        if (hasattr(f, '_ctype')
                and f._name != ''
                and not isinstance(f._ctype, FuncType)
                and f._ctype._storage != Storages.TYPEDEF):
            yield f
684323
def noise_uniform(self, lower_bound, upper_bound):
        """"""
        assert upper_bound > lower_bound
        nu = self.sym.sym('nu_{:d}'.format(len(self.scope['nu'])))
        self.scope['nu'].append(nu)
        return lower_bound + nu*(upper_bound - lower_bound)
667472
def __set_target_variables_aux (manager, rule_or_module, ps):
    
    assert isinstance(rule_or_module, basestring)
    assert isinstance(ps, property_set.PropertySet)
    result = []

    for f in __flags.get(rule_or_module, []):

        if not f.condition or find_satisfied_condition (f.condition, ps):
            processed = []
            for v in f.values:
                # The value might be <feature-name> so needs special
                # treatment.
                processed += __handle_flag_value (manager, v, ps)

            for r in processed:
                result.append ((f.variable_name, r))

    # strip away last dot separated part and recurse.
    next = __re_split_last_segment.match(rule_or_module)

    if next:
        result.extend(__set_target_variables_aux(
            manager, next.group(1), ps))

    return result
552831
def _calc_T_var(self,X) -> int:
        """"""
        shape = X.shape
        tensor_rank: int = len(shape)
        if tensor_rank == 0:
            return 1
        if tensor_rank == 1:
            return shape[0]
        if tensor_rank == 2:
            if shape[1] > 1:
                raise ValueError('Initial value of a variable must have dimension T*1.')
            return shape[0]
108863
def _get_value(self, var):
        """"""
        return self._problem._p.get_value(self._problem._variables[var])
1362582
def xor(*variables):
    '''
    
    '''
    sum_ = False
    for value in variables:
        sum_ = sum_ ^ bool(value)
    return sum_
1365468
function(d_o, c_o, b_o, a_o) { 
        //convert everything to text
        var a = a_o.text(), b = b_o.text(), c = c_o.text(), d = d_o.text(); 
        var d0s = '({1})^2-3*({0})*({2})',
            d0 = _.parse(format(d0s, a, b, c)),
            Q = _.parse(format('((2*({1})^3-9*({0})*({1})*({2})+27*({0})^2*({3}))^2-4*(({1})^2-3*({0})*({2}))^3)^(1/2)', a, b, c, d)),
            C = _.parse(format('((1/2)*(({4})+2*({1})^3-9*({0})*({1})*({2})+27*({0})^2*({3})))^(1/3)', a, b, c, d, Q));
        //check if C equals 0
        var scope = {};
        //populate the scope object
        variables(C).map(function(x) {
            scope[x] = 1;
        });
        
        var Ct = core.Utils.block('PARSE2NUMBER', function() {
            return _.parse(C, scope);
        });
        
        if(Number(d0) === 0 && Number(Ct) === 0) //negate Q such that C != 0
            C = _.parse(format('((1/2)*(-({4})+2*({1})^3-9*({0})*({1})*({2})+27*({0})^2*({3})))^(1/3)', a, b, c, d, Q));

        var xs = [
            '-(b/(3*a))-C/(3*a)-(((b^2-3*a*c))/(3*a*C))',
            '-(b/(3*a))+(C*(1+i*sqrt(3)))/(6*a)+((1-i*sqrt(3))*(b^2-3*a*c))/(6*a*C)'.replace(/i/g, core.Settings.IMAGINARY),
            '-(b/(3*a))+(C*(1-i*sqrt(3)))/(6*a)+((1+i*sqrt(3))*(b^2-3*a*c))/(6*a*C)'.replace(/i/g, core.Settings.IMAGINARY)
        ];
        
        

        return xs.map(function(e, i) { 
            var o = { a: a_o.clone(), b: b_o.clone(), c: c_o.clone(), d: d_o.clone(), C: C.clone()};
            return _.parse(e, o);
        });
    }
1297001
def _expect_vars(vs=None):
        """"""
        if vs is None:
            return list()
        elif isinstance(vs, Variable):
            return [vs]
        else:
            checked = list()
            # Will raise TypeError if vs is not iterable
            for v in vs:
                if isinstance(v, Variable):
                    checked.append(v)
                else:
                    fstr = "expected Variable, got {0.__name__}"
                    raise TypeError(fstr.format(type(v)))
            return checked
515194
def variables(
            self,
            name=None,
            function=None,
            decl_type=None,
            header_dir=None,
            header_file=None,
            recursive=None,
            allow_empty=None):

        """"""
        return (
            self._find_multiple(
                self._impl_matchers[
                    scopedef_t.variable],
                name=name,
                function=function,
                decl_type=decl_type,
                header_dir=header_dir,
                header_file=header_file,
                recursive=recursive,
                allow_empty=allow_empty)
        )
1080623
def var(self, ddof=1, *args, **kwargs):
        
        nv.validate_groupby_func('var', args, kwargs)
        if ddof == 1:
            try:
                return self._cython_agg_general('var', **kwargs)
            except Exception:
                f = lambda x: x.var(ddof=ddof, **kwargs)
                with _group_selection_context(self):
                    return self._python_agg_general(f)
        else:
            f = lambda x: x.var(ddof=ddof, **kwargs)
            with _group_selection_context(self):
                return self._python_agg_general(f)
545217
def xcoord(self):
        """"""
        v = next(self.raw_data.psy.iter_base_variables)
        return self.decoder.get_x(v, coords=self.data.coords)