Conditions | 1 |
Total Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Tests | 3 |
CRAP Score | 1 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | 1 | import re |
|
18 | 1 | def convert_camel_to_snake(value): |
|
19 | """Convert string from CamelCase to snake_case |
||
20 | |||
21 | :param value: CamelCase value |
||
22 | :type value: str |
||
23 | :return: snake_case converted value |
||
24 | :rtype: str |
||
25 | """ |
||
26 | s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', value) |
||
27 | return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() |