Checks the key dosnt already exist, adds alternate names to a seperate list

        Future
            - format input and add units
            - logging
338467
def addParam(self, key, value, attrib=None):
        

        if key in self.rejectTags:
            return False  # TODO Replace with exception

        # Temporary code to handle the seperation tag than can occur several times with different units.
        # TODO code a full multi unit solution (github issue #1)
        if key == 'separation':
            if attrib is None:
                return False  # reject seperations without a unit
            try:
                if not attrib['unit'] == 'AU':
                    return False  # reject for now
            except KeyError:  # a seperation attribute exists but not one for units
                return False

        if key in self.params:  # if already exists

            if key == 'name':
                try:  # if flagged as a primary or popular name use this one, an option should be made to use either
                    if attrib['type'] == 'pri':  # first names or popular names.
                        oldname = self.params['name']
                        self.params['altnames'].append(oldname)
                        self.params['name'] = value
                    else:
                        self.params['altnames'].append(value)
                except (KeyError, TypeError):  # KeyError = no type key in attrib dict, TypeError = not a dict
                    self.params['altnames'].append(value)
            elif key == 'list':
                self.params['list'].append(value)
            else:
                try:
                    name = self.params['name']
                except KeyError:
                    name = 'Unnamed'
                print('rejected duplicate {0}: {1} in {2}'.format(key, value, name))  # TODO: log rejected value
                return False  # TODO Replace with exception

        else:  # If the key doesn't already exist and isn't rejected

            # Some tags have no value but a upperlimit in the attributes
            if value is None and attrib is not None:
                try:
                    value = attrib['upperlimit']
                except KeyError:
                    try:
                        value = attrib['lowerlimit']
                    except KeyError:
                        return False

            if key == 'rightascension':
                value = _ra_string_to_unit(value)
            elif key == 'declination':
                value = _dec_string_to_unit(value)
            elif key in self._defaultUnits:
                try:
                    value = float(value) * self._defaultUnits[key]
                except:
                    print('caught an error with {0} - {1}'.format(key, value))
            self.params[key] = value
1347618
def _additional(self, idents, kwargs):
        ''''''
        if kwargs:
            for name, value in list(kwargs.items()):
                if not isinstance(value, list):
                    raise ValueError('Additional arguments must be lists of \
same length as idents')
                for i in range(len(value)):
                    self[idents[i]][name] = value[i]
1354340
def create_keys_in():
    
    keys = Group(
        Optional(Suppress("("))
        + value
        + Optional(Suppress(",") + value)
        + Optional(Suppress(")"))
    )
    return (Suppress(upkey("keys") + upkey("in")) + delimitedList(keys)).setResultsName(
        "keys_in"
    )
1336750
def add(self, key, val):
        
        key_lower = key.lower()
        new_vals = key, val
        # Keep the common case aka no item present as fast as possible
        vals = _dict_setdefault(self, key_lower, new_vals)
        if new_vals is not vals:
            # new_vals was not inserted, as there was a previous one
            if isinstance(vals, list):
                # If already several items got inserted, we have a list
                vals.append(val)
            else:
                # vals should be a tuple then, i.e. only one item so far
                # Need to convert the tuple to list for further extension
                _dict_setitem(self, key_lower, [vals[0], vals[1], val])
418253
def add_new_key(self, code, name):
        """"""
        device_json = {"code": code, "name": name}
        return self.api_interface.create_lock_key(self, device_json)
278436
private static void appendParam(final OmdbParameters params, final Param key, StringBuilder sb) {
        if (params.has(key)) {
            sb.append(DELIMITER_SUBSEQUENT).append(key.getValue()).append(params.get(key));
        }
    }
529020
def unique(self, key=None):
        
        if key is None:
            seen = set()
            seen_add = seen.add

            return self.__class__([x for x in self.items if not (x in seen or seen_add(x))])

        key = self._value_retriever(key)

        exists = []

        def _check(item):
            id_ = key(item)
            if id_ in exists:
                return True

            exists.append(id_)

        return self.reject(_check)
466635
def key_list(items=None):
    '''
    
    '''
    if items is None:
        items = []

    ret = {}
    if items and isinstance(items, list):
        for item in items:
            if 'name' in item:
                # added for consistency with old code
                if 'id' not in item:
                    item['id'] = item['name']
                ret[item['name']] = item
    return ret
82234
def key_exists_in_list_or_dict(key, lst_or_dct):
    """"""
    if isinstance(lst_or_dct, dict) and key in lst_or_dct:
        return True
    elif isinstance(lst_or_dct, list):
        min_i, max_i = 0, len(lst_or_dct)
        if min_i <= key < max_i:
            return True
    return False
1262492
function rename(key, newkey, req) {
  var val = this.getKey(key);
  this.delKey(key);
  this.setKey(newkey, val);
  return OK;
}
1262622
def append!(errors, attr, key, val)
      return unless val.present?

      errors ||= {}
      errors[attr] ||= {}
      errors[attr][key] = val
    end
1122246
def add_subkey(self, subkey):
        
        if self.key.lower() == 'atoms' or not self.has_subkey(subkey):
            self.subkeys.append(subkey)
913793
def add(self, key, value):
        
        self._data.setdefault(key.lower(), []).append((key, value))
1276946
def key_exists(self, namespace, key):
        

        return namespace in self.__data and key in self.__data[namespace]
1211187
def get_existing_keys(self, events):
        """"""
        data = [e[self.key] for e in events]
        ss = ','.join(['%s' for _ in data])
        query = 'SELECT %s FROM %s WHERE %s IN (%s)' % (self.key, self.table, self.key, ss)
        cursor = self.conn.conn.cursor()
        cursor.execute(query, data)
        LOG.info("%s (data: %s)", query, data)
        existing = [r[0] for r in cursor.fetchall()]
        LOG.info("Existing IDs: %s" % existing)
        return set(existing)
1001275
public synchronized void
addTrustedKey(DNSKEYRecord key) {
	Name name = key.getName();
	List list = (List) trustedKeys.get(name);
	if (list == null)
		trustedKeys.put(name, list = new LinkedList());
	list.add(key);
}
554174
private boolean checkIfKeyExists(String key)
    {
        if (aggregationsKeySet == null)
        {
            aggregationsKeySet = new HashSet<String>();
        }
        return aggregationsKeySet.add(key);
    }