コード例 #1
0
def _prepare_column_name(pattern, column_names):
    for column_name in column_names:
        match = pattern.match(normalize_key(
            column_name, separate_camel_case=True, separate_letter_digit=True))
        if match:
            return column_name, match.groups()
    return None, ()
コード例 #2
0
def get_tool_name(path):
    file_name = basename(path)
    base_name = splitext(file_name)[0]
    return normalize_key(base_name,
                         word_separator='-',
                         separate_camel_case=True,
                         separate_letter_digit=True)
コード例 #3
0
def normalize_arguments(normalization_functions, g):
    errors = []
    # Normalize columns
    for k, v in g.items():
        if not hasattr(v, 'columns'):
            continue
        v.columns = [normalize_key(x, '_') for x in v.columns]
    # Normalize tables
    for normalize_argument in normalization_functions:
        try:
            g.update(compute(normalize_argument, g))
        except ValidationError as e:
            print(e)
            errors.append(e)
    # Make decision
    if errors:
        raise InfrastructurePlanningError('could not normalize arguments')
    return g
コード例 #4
0
 def _singular(Class):
     key = getattr(Class, "__name__", Class.__class__.__name__)
     return normalize_key(key, word_separator="_", separate_camel_case=True)