schematools.naming module
- schematools.naming.toCamelCase(ident: str, first_upper=False) str
Convert an identifier to camelCase format.
Word boundaries are determined by: - numbers - underscore characters - whitespace characters (this violates the concept of identifiers,
but we handle it nevertheless)
A camelCased identifier, when it starts with a letter, it will start with a lower cased letter.
Empty strings are not allowed. They will raise an
ValueError
exception.Examples:
>>> toCamelCase("dataset_table_schema") 'datasetTableSchema' >>> toCamelCase("dataset table schema") 'datasetTableSchema' >>> toCamelCase("fu_33_bar") 'fu33Bar' >>> toCamelCase("fu_33bar") 'fu33Bar' >>> toCamelCase("fu_33Bar") 'fu33Bar' >>> toCamelCase("33_fu_bar") '33FuBar'
- Parameters
ident – The identifier to be converted.
- Returns
The identifier in camelCase format.
- Raises
ValueError – If
indent
is an empty string.
- schematools.naming.to_snake_case(ident: str) str
Convert an identifier to snake_case format.
Empty strings are not allowed. They will raise an
ValueError
exception.- Parameters
ident – The identifier to be converted.
- Returns
The identifier in snake_case foramt.
- Raises
ValueError – If
ident
is an empty string.