Normalize a camelCase descriptor to something more readable.

    i.e. 'camelCase' or 'CamelCase' becomes 'Camel Case'
779600
def normalize_camel_case(name):
    
    normalized = re.sub('([a-z])([A-Z])',
                        lambda match: ' '.join([match.group(1), match.group(2)]),
                        name)
    return normalized[0].upper() + normalized[1:]
158105
def de_camel(s, separator="_", _lowercase=True):
    
    s = re.sub(r"([a-z0-9])([A-Z])", "\\1%s\\2" % separator, s)
    s = re.sub(r"([A-Z])([A-Z][a-z])", "\\1%s\\2" % separator, s)
    return s.lower() if _lowercase else s
225642
def normalize(input, case_mapping=protocol.DEFAULT_CASE_MAPPING):
    
    if case_mapping not in protocol.CASE_MAPPINGS:
        raise pydle.protocol.ProtocolViolation('Unknown case mapping ({})'.format(case_mapping))

    input = input.lower()

    if case_mapping in ('rfc1459', 'rfc1459-strict'):
        input = input.replace('{', '[').replace('}', ']').replace('|', '\\')
    if case_mapping == 'rfc1459':
        input = input.replace('~', '^')

    return input
793673
def normalize_header(name, existing=[]):
    
    name = re.sub('\W+', '', name, flags=re.UNICODE).lower()
    # TODO handle multiple columns with the same name.
    return name
1069477
def camelize(string, lower = false)
      string = string.to_s.gsub(/(?:^|_)(.)/) { Regexp.last_match(1).upcase }
      string = string[0].chr.downcase + string[1..-1] if lower
      string
    end
811914
def from_camel_case(s):
    

    def convert(match):
        return ('_' if match.groups()[0] else '') + match.group(0).lower()

    if not re.match(r'[A-Z][a-zA-Z0-9]*', s):
        raise DataJointError(
            'ClassName must be alphanumeric in CamelCase, begin with a capital letter')
    return re.sub(r'(\B[A-Z])|(\b[A-Z])', convert, s)
573876
def normalize_keys(suspect, snake_case=True):
    
    if not isinstance(suspect, dict):
        raise TypeError('you must pass a dict.')

    for key in list(suspect):
        if not isinstance(key, six.string_types):
            continue

        if snake_case:
            s1 = first_cap_re.sub(r'\1_\2', key)
            new_key = all_cap_re.sub(r'\1_\2', s1).lower()  # .replace('-', '_')
        else:
            new_key = key.lower()

        value = suspect.pop(key)
        if isinstance(value, dict):
            suspect[new_key] = normalize_keys(value, snake_case)
        elif isinstance(value, list):
            for i in range(0, len(value)):
                if isinstance(value[i], dict):
                    normalize_keys(value[i], snake_case)

            suspect[new_key] = value
        else:
            suspect[new_key] = value

    return suspect
398988
def camelcase_to_spaces(content):
    
    camelcase_boundry = '(((?<=[a-z])[A-Z])|([A-Z](?![A-Z]|$)))'
    content = re.sub(camelcase_boundry, ' \\1', content).strip()
    return ' '.join(content.split('_')).title()
1113533
def lower_camel_case_from_underscores(string):
    """"""
    components = string.split('_')
    string = components[0]
    for component in components[1:]:
        string += component[0].upper() + component[1:]
    return string
943689
function camelCase(str, delim) {
        var delims = delim || ['_', '.', '-'];

        if (!_.isArray(delims)) {
            delims = [delims];
        }

        _.each(delims, function (adelim) {
            var codeParts = str.split(adelim);
            var i, codePart;

            for (i = 1; i < codeParts.length; i++) {
                codePart = codeParts[i];
                codeParts[i] = codePart.substring(0, 1).toUpperCase() + codePart.substring(1);
            }

            str = codeParts.join('');
        });

        return str;
    }
474260
def normalize(name):
    """"""

    # Name should not contain some specials chars (issue #1068)
    ret = name.replace(':', '')
    ret = ret.replace('%', '')
    ret = ret.replace(' ', '_')

    return ret
362627
def normalize(pw):
    
    pw_lower = pw.lower()
    return ''.join(helper.L33T.get(c, c) for c in pw_lower)
348414
function dashToCamelCase(dashCase) {
    if (!dashCase) { return dashCase; }

    var parts = dashCase.split('-');
    var camelCase = parts[0];
    var part;

    for (var i = 1; i < parts.length; i++) {
        part = parts[i];
        camelCase += part.substring(0, 1).toUpperCase() + part.substring(1);
    }

    return camelCase;
}
729433
def class_case(string):
    
    if not string:
        return string
    string = string.replace(' ', '_').replace('-', '_')
    parts = de_camel(string, '_', _lowercase=False).split('_')
    rv = ''
    while parts:
        part = parts.pop(0)
        rv += part.title() or '_'
        if part:
            break
    return rv + ''.join([part if part.isupper() else part.title()
                         for part in parts])
815945
def nameify(self, camelsplit=False, ascii=True, sep='-'):
        """"""
        s = String(str(self))  # immutable
        if camelsplit == True:
            s = s.camelsplit()
        s = s.hyphenify(ascii=ascii).replace('-', sep)
        if len(s) == 0 or re.match("[A-Za-z_]", s[0]) is None:
            s = "_" + s
        return String(s)
161064
def to_snake_case(camel_case):
  """"""
  if not re.match(r"^[A-Za-z_]\w*$", camel_case):
    raise ValueError(
        "Input string %s is not a valid Python identifier." % camel_case)

  # Add underscore at word start and ends.
  underscored = re.sub(r"([A-Z][a-z])", r"_\1", camel_case)
  underscored = re.sub(r"([a-z])([A-Z])", r"\1_\2", underscored)
  # Add underscore before alphanumeric chunks.
  underscored = re.sub(r"([a-z])([0-9][^_]*)", r"\1_\2", underscored)
  # Remove any underscores at start or end of name and convert to lowercase.
  return underscored.strip("_").lower()
417774
def underscore_to_camelcase(underscore_string)
      underscore_string = underscore_string.gsub(/(_)/,' ').split(' ').each { |word| word.capitalize! }.join("") unless underscore_string.match(/_/).nil?
      underscore_string = underscore_string if underscore_string.match(/_/).nil?
      return underscore_string
    end