Conditions | 2 |
Total Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Tests | 5 |
CRAP Score | 2 |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | 1 | import re |
|
4 | 1 | def get_service_subject_identifier(service_subject): |
|
5 | """Get the snake_case identifier of the service_subject |
||
6 | |||
7 | :param service_subject: Service subject |
||
8 | :type service_subject: mixed |
||
9 | :return: snake case name of the service subject |
||
10 | :rtype: str |
||
11 | """ |
||
12 | 1 | if inspect.isclass(service_subject) is True: |
|
13 | 1 | subject_name = service_subject.__name__ |
|
14 | else: |
||
15 | 1 | subject_name = service_subject.__class__.__name__ |
|
16 | 1 | return convert_camel_to_snake(subject_name) |
|
17 | |||
27 | return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower() |