Sets key/values based on a mapping if none of the keys are already set.
        Mapping can be supplied as a single dictionary argument or as kwargs.
        Returns a boolean indicating if the operation was successful.
337806
async def msetnx(self, *args, **kwargs):
        
        if args:
            if len(args) != 1 or not isinstance(args[0], dict):
                raise RedisError('MSETNX requires **kwargs or a single '
                                 'dict arg')
            kwargs.update(args[0])
        items = []
        for pair in iteritems(kwargs):
            items.extend(pair)
        return await self.execute_command('MSETNX', *items)
1314634
def set(self, key, value):
        
        db = self.open()
        try:
            db[key] = value
        finally:
            db.close()
615605
def set(self, key, value):
        
        logger.debug("Settings %s -> %s" % (key, value))
        if key in self.DEFAULTS:
            vtype = type(self.DEFAULTS[key])
        else:
            vtype = type(value)

        if vtype not in self.VALID_KEY_TYPES:
            logger.warn("Invalid key type: %s" % vtype)
            return False

        #for gconf refer to the full key path
        key = self._fix_key(key)

        if vtype is bool:
            self._client.set_bool(key, value)
        elif vtype is str:
            self._client.set_string(key, value)
        elif vtype is int:
            self._client.set_int(key, value)
        elif vtype in (list, tuple):
            #Save every value as a string
            strvalues = [str(i) for i in value]
            #self._client.set_list(key, gconf.VALUE_STRING, strvalues)

        return True
1016812
def is_set(self, key):
        """"""
        data = self.model.get_data()
        return isinstance(data[key], set)
1190300
def set(self, key, value, *, flags=None):
        
        self.append({
            "Verb": "set",
            "Key": key,
            "Value": encode_value(value, flags, base64=True).decode("utf-8"),
            "Flags": flags
        })
        return self
694927
def set(self, instance, value, **kw):
        
        return self._set(instance, value, **kw)
706817
def set_value_for_key(self, key, value):
        
        if key in self.options:
            self.options[key]['value'] = value
1163094
def set(self, **kwargs):
        
        if len(kwargs)==0: return self
        
        # Set settings
        for k in list(kwargs.keys()): self[k] = kwargs[k]
        
        # Plot if we're supposed to.
        if self['autoplot'] and not self._initializing: self.plot()

        return self
584046
def set(self, key, value):
        
        k = self._real_key(key.lower())
        self._override[k] = value
158847
def set(self, key: Any, value: Any) -> None:
        
        if key is not None:
            self[key] = value
639314
def set(self, key: str, value: Any) -> None:
        
        wc = self._write_cache()
        if key in wc:
            s = wc[key]
        else:
            s = self._type(object=self._obj, key=key)
        s.value = self._serialize(value)
        s.save()
        self._cache()[key] = s.value
        wc[key] = s
        self._flush_external_cache()
497616
def setnx(self, key, value):
        """"""
        return self.set(key, value, nx=True)
845185
def update(self, mapping):
        """"""
        return self.api.mset(dict((key, self.prepare_value(value))
                                for key, value in mapping.items()))
80705
def from_mapping(self, *mapping, **kwargs):
        
        mappings = []
        if len(mapping) == 1:
            if hasattr(mapping[0], 'items'):
                mappings.append(mapping[0].items())
            else:
                mappings.append(mapping[0])
        elif len(mapping) > 1:
            raise TypeError('expected at most 1 positional argument, got %d' % len(mapping))

        mappings.append(kwargs.items())
        for mapping in mappings:
            for key, value in mapping:
                if key.isupper():
                    self[key] = value
        return True
559411
def set(self, instance, value, **kw):  # noqa
        
        ref = []
        # The value is an UID
        if api.is_uid(value):
            ref.append(value)

        # The value is a dictionary, get the UIDs.
        if u.is_dict(value):
            ref = ref.append(value.get("uid"))

        # The value is already an object
        if api.is_at_content(value):
            ref.append(value)

        # The value is a list
        if u.is_list(value):
            for item in value:
                # uid
                if api.is_uid(item):
                    ref.append(item)
                # dict (catalog query)
                elif u.is_dict(item):
                    # If there is UID of objects, just use it.
                    uid = item.get('uid', None)
                    if uid:
                        ref.append(uid)

        # Handle non multi valued fields
        if not self.multi_valued:
            if len(ref) > 1:
                raise ValueError("Multiple values given for single valued "
                                 "field {}".format(repr(self.field)))
            else:
                ref = ref[0]

        return self._set(instance, ref, **kw)
521406
def set_many(self, mapping, timeout=None):
        
        for key, value in _items(mapping):
            self.set(key, value, timeout)
774518
def set_attribute(self, key, value):
        
        if not isinstance(key, str) or not isinstance(value, str):
            raise ValueError("The arguments 'key' and 'value' must both be "
                             "strings. Instead they are {} and {}.".format(
                                 key, value))
        self.extra_data[key] = value