Make a string key out of many criteria.
5991
def make_key(*criteria):
    """"""
    criteria = [stringify(c) for c in criteria]
    criteria = [c for c in criteria if c is not None]
    if len(criteria):
        return ':'.join(criteria)
1091858
def makekey(self, *args):
        
        if len(args) > 1:
            args = args[:1] + (args[1].encode('utf-8'),) + args[2:]
        if len(args) == 3 and type(args[-1]) == str:
            # node.tag.string type keys
            return struct.pack(self.keyfmt[:1 + len(args)], b'.', *args[:-1]) + args[-1].encode('utf-8')
        elif len(args) == 3 and type(args[-1]) == type(-1) and args[-1] < 0:
            # negative values -> need lowercase fmt char
            return struct.pack(self.keyfmt[:1 + len(args)] + self.fmt.lower(), b'.', *args)
        else:
            # node.tag.value type keys
            return struct.pack(self.keyfmt[:2 + len(args)], b'.', *args)
449693
private String makeConverterKey(Class<?> fromClass, String syntax, Class<?> toClass) {
        StringBuilder key = new StringBuilder();
        if (syntax==null) {
            syntax="";
        }
        key.append(fromClass.getName()).append(KEY_SEP).append(syntax).append(KEY_SEP).append(toClass.getName());
        return key.toString();
    }
1224417
def _qualify_map(key, content):
    
    if not isinstance(key, basestring):
        return key, content

    min_len  = None
    max_len  = None
    modifier = []
    m        = RE_MATCH_CSTR(key)

    if not m:
        raise KeyError("Unable to parse, invalid key: %r" % key)

    if m.group(3) is not None:
        min_len = max_len = int(m.group(3))
    elif m.group(4) is not None:
        if m.group(4):
            min_len = int(m.group(4))
        else:
            min_len = 0
        if m.group(5):
            max_len = int(m.group(5))
    elif m.group(6) == '*':
        min_len = 0
    elif m.group(6) == '+':
        min_len = 1
    elif m.group(6) == '?':
        min_len = 0
        max_len = 1

    if m.group(7):
        modifier = m.group(7).split(',')

    if m.group(8) == '-':
        modifier.append('strip')

    if m.group(2) == '*':
        return m.group(1), OptionalNull(content, min_len, max_len, modifier)
    elif m.group(2) == '?':
        return m.group(1), Optional(content, min_len, max_len, modifier)
    elif m.group(2) == '+':
        return m.group(1), Mandatory(content, min_len, max_len, modifier)
    else:
        return m.group(1), Mandatory(content, min_len, max_len, modifier)
1232636
def gen_multi_key(self, values, db='default'):
        """"""
        db = settings.DB_CACHE_KEYS[db]
        if db and len(db) > 100:
            db = db[0:68] + self.gen_key(db[68:])
        return '%s_%s_multi_%s' % (self.prefix, db, self.gen_key(*values))
1103328
def fillkeys(Recs):
    
    keylist, OutRecs = [], []
    for rec in Recs:
        for key in list(rec.keys()):
            if key not in keylist:
                keylist.append(key)
    for rec in Recs:
        for key in keylist:
            if key not in list(rec.keys()):
                rec[key] = ""
        OutRecs.append(rec)
    return OutRecs, keylist
1171487
def pick(self, keys):
        '''
        
        '''
        subset = dict([(key, self.criteria[key]) for key in keys])
        return self.__class__(**subset)
416307
def _humanSortKey(s):
  """"""
  if isinstance(s, str):
    return [w.isdigit() and int(w) or w for w in re.split(r'(\d+)', s)]
  else:
    return s
1028447
def _construct_new_key(name, units=None):
    """"""
    to_replace = ["/", "\\", "*", "^", "#", " ", "\n", "\t", ",", ".", ")", "(", "'", "`", "-"]
    to_remove = ["$", "{", "}"]

    cat = name
    if units:
        cat = "_".join([name, units])
    for c in to_replace:
       cat = cat.replace(c, "_")
    for c in to_remove:
       cat = cat.replace(c, "")

    cat = re.sub('_+','_', cat)

    return cat
835515
def mapping_to_str(mapping):
    """"""
    result = ["<"]
    for i, (key, value) in enumerate(mapping.items()):
        if i > 0:
            result.append(",")
        result += [key, "=", serialize_for_header(key, value)]
    result += [">"]
    return "".join(result)
1003194
def maybe_encode_keys(self, keys):
        
        ret = {}
        for k, v in six.iteritems(keys):
            if is_dynamo_value(v):
                return keys
            elif not is_null(v):
                ret[k] = self.encode(v)
        return ret
42045
def filter(self, table, keypairs, filter_string):
        """"""
        query = filter_string.lower()
        return [keypair for keypair in keypairs
                if query in keypair.name.lower()]
293822
public Criteria and(String key) {
        checkComplete();
        return new Criteria(this.criteriaChain, ValueNode.toValueNode(prefixPath(key)));
    }
955053
private String processKey(String key) {
        AssertUtils.assertNotNull(key, "Key cannot be null");

        String result = null;

        if (this.isCaseSensitive() == false) {
            result = key.toLowerCase(Locale.ENGLISH);
        } else {
            result = key;
        }

        return result;
    }
443984
def stringify_compound_key(self, key):
        """"""
        if UNQUOTED_COMPOUND_KEY.match(key):
            return key
        return self.escape_string(key)
1011217
def keys(self, prefix=None):
        """"""
        query = Setting.query
        if prefix:
            query = query.filter(Setting.key.startswith(prefix))

        # don't use iteritems: 'value' require little processing whereas we only
        # want 'key'
        return [i[0] for i in query.yield_per(1000).values(Setting.key)]
742742
def natural_keys(input_str: str) -> List[Union[int, str]]:
    
    return [try_int_or_force_to_lower_case(substr) for substr in re.split(r'(\d+)', input_str)]