Set specific operations
558064
public static <T> Set<T> intersection(Collection<T> parentCollection, Collection<T> removeFromCollection) {
        Set<T> results = new HashSet<>(parentCollection);
        results.retainAll(removeFromCollection);
        return results;
    }
1089982
function set(name, element, previous, attrs) {
  if (set.handlers[name]) {
    set.handlers[name](name, element, previous, attrs);
  } else if (attrs[name] != null && previous[name] !== attrs[name]) {
    element.setAttribute(name, attrs[name]);
  }
}
764027
def setting(self, opt, val):
        """"""
        opt = opt.encode()
        if isinstance(val, basestring):
            fluid_settings_setstr(self.settings, opt, val)
        elif isinstance(val, int):
            fluid_settings_setint(self.settings, opt, val)
        elif isinstance(val, float):
            fluid_settings_setnum(self.settings, opt, val)
562426
async def _setops(self, name, valu, editatom, init=False):
        '''
        
        '''
        prop = self.form.prop(name)
        if prop is None:

            if self.snap.strict:
                raise s_exc.NoSuchProp(name=name)

            await self.snap.warn(f'NoSuchProp: name={name}')
            return False

        if self.isrunt:
            if prop.info.get('ro'):
                raise s_exc.IsRuntForm(mesg='Cannot set read-only props on runt nodes',
                                       form=self.form.full, prop=name, valu=valu)
            return await self.snap.core.runRuntPropSet(self, prop, valu)

        curv = self.props.get(name)

        # normalize the property value...
        try:
            norm, info = prop.type.norm(valu)

        except Exception as e:
            mesg = f'Bad property value: {prop.full}={valu!r}'
            return await self.snap._raiseOnStrict(s_exc.BadPropValu, mesg, name=prop.name, valu=valu, emesg=str(e))

        # do we already have the value?
        if curv == norm:
            return False

        if curv is not None and not init:

            if prop.info.get('ro'):

                if self.snap.strict:
                    raise s_exc.ReadOnlyProp(name=prop.full)

                # not setting a set-once prop unless we are init...
                await self.snap.warn(f'ReadOnlyProp: name={prop.full}')
                return False

            # check for type specific merging...
            norm = prop.type.merge(curv, norm)
            if curv == norm:
                return False

        sops = prop.getSetOps(self.buid, norm)

        editatom.sops.extend(sops)

        # self.props[prop.name] = norm
        editatom.npvs.append((self, prop, curv, norm))

        # do we have any auto nodes to add?
        auto = self.snap.model.form(prop.type.name)
        if auto is not None:
            buid = s_common.buid((auto.name, norm))
            await self.snap._addNodeFnibOps((auto, norm, info, buid), editatom)

        # does the type think we have special auto nodes to add?
        # ( used only for adds which do not meet the above block )
        for autoname, autovalu in info.get('adds', ()):
            auto = self.snap.model.form(autoname)
            autonorm, autoinfo = auto.type.norm(autovalu)
            buid = s_common.buid((auto.name, autonorm))
            await self.snap._addNodeFnibOps((auto, autovalu, autoinfo, buid), editatom)

        # do we need to set any sub props?
        subs = info.get('subs')
        if subs is not None:

            for subname, subvalu in subs.items():

                full = prop.name + ':' + subname

                subprop = self.form.prop(full)
                if subprop is None:
                    continue

                await self._setops(full, subvalu, editatom, init=init)

        return True
735777
def item_set_goto(itemset, inputsymbol, productionset):
    """"""
    resultset = LR0ItemSet()
    for item in itemset.itemlist:
        if item.next_symbol() == inputsymbol:
            newitem = LR0Item(item.rule, item.position + 1)
            resultset.append_item(newitem)
    return _build_item_closure(resultset, productionset)
1205138
function setToPairs(set) {
    var index = -1,
        result = Array(set.size);

    set.forEach(function(value) {
      result[++index] = [value, value];
    });
    return result;
  }
1359985
def set(self, style={}):
        """"""
        _style = {}
        for attr in style:
            if attr in self.cmds and not style[attr] in self.cmds[attr]:
                print 'WARNING: ESC/POS PRINTING: ignoring invalid value: '+utfstr(style[attr])+' for style: '+utfstr(attr)
            else:
                self.stack[-1][attr] = self.enforce_type(attr, style[attr])
293600
def setIfMissing(self, key, value):
        """"""
        if self.get(key) is None:
            self.set(key, value)
        return self
247650
def _call_setnx(self, command, value):
        
        result = self._traverse_command(command, value)
        if self.indexable and value is not None and result:
            self.index(value)
        return result
350550
def _set_intvals(kws, keys):
        """"""
        for key in keys:
            if key in kws:
                kws[key] = int(kws[key])
474343
def set(self, value = True):
        """"""
        value = value in (True,1) or ( (isinstance(value, str) or (sys.version < '3' and isinstance(value, unicode))) and (value.lower() in ("1","yes","true","enabled"))) #pylint: disable=undefined-variable
        return super(BooleanParameter,self).set(value)
890815
void setu(String name, Object value) {
        try {
            set(name, value);
        } catch ( EvalError e ) {
            throw new InterpreterError("set: "+e, e);
        }
    }
185287
def set_to(cls, name, num):
        """"""
        if num < 0:
            raise CounterValueError('Counter[%s] can not be set to %s' % (
                                    name, num))
        else:
            counter = cls.collection.find_and_modify(
                {'name': name},
                {'$set': {'seq': num}},
                new=True,
                upsert=True
            )
            return counter['seq']
1298244
def set_functions(self, functions):
        """"""
        for func in functions:
            try:
                self.append_function(func)
            except (ValueError, AttributeError) as ex:
                log.error("'%s' is not a callable function: %s", func, ex)
                raise
683963
def set_state_batch(keys, values, namespace=None, ttl=3600*24*365):
    """"""

    keys, values = zip(*{k: v for k, v in zip(keys, values)}.items())

    if namespace:
        keys = ["{}:{}".format(namespace, key) for key in keys]

    return set_item_batch(keys, values, ttl)
533574
@SuppressWarnings("unchecked")
    public void setOps(final DBObject ops) {
        this.ops = (Map<String, Map<String, Object>>) ops;
    }
511112
def _setse(self, i):
        """"""
        if i > 0:
            u = (i * 2) - 1
        else:
            u = -2 * i
        self._setue(u)