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, ()
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)
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
def _singular(Class): key = getattr(Class, "__name__", Class.__class__.__name__) return normalize_key(key, word_separator="_", separate_camel_case=True)