GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( 0bdc53...7603ec )
by Raphaël
01:23
created

convert_camel_to_snake()   A

Complexity

Conditions 1

Size

Total Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
c 1
b 0
f 1
dl 0
loc 10
ccs 3
cts 3
cp 1
crap 1
rs 9.4285
1 1
import re
2 1
import inspect
3
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
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()