Utils¶
Utility methods and helpers.
-
utils.
to_camel_case
(string)¶ Converts a string from snake_case to camelCase.
- Parameters
string (str) – string in snake_case notation
- Returns
string converted to camelCase
- Return type
str
-
utils.
to_snake_case
(string)¶ Converts a string from camelCase to snake_case.
- Parameters
string (str) – string in camelCase notation
- Returns
string converted to snake_case
- Return type
str
-
utils.
truncate_long_string
(string, max_len)¶ Truncates the given text from the first newline character. If no newline is present in the
string
, truncate text tomax_len
characters. If the text is shorter thanmax_len
, does nothing.- Parameters
string (str) – text to truncate
max_len (int) – maximal length of the truncated string
- Returns
truncated string, enquoted in double quotes, with the
(truncated)
string appended at the end- Return type
str