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 ( 3ab7a8...2f370c )
by Raphaël
02:57
created

pyjection.helper.convert_camel_to_snake()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 3
dl 0
loc 10
ccs 2
cts 2
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
nop 1
crap 1
1 1
import re
2 1
import inspect
3
4
5 1
def get_service_subject_identifier(service_subject):
6
    """Get the snake_case identifier of the service_subject
7
8
    :param service_subject: Service subject
9
    :type service_subject: mixed
10
    :return: snake case name of the service subject
11
    :rtype: str
12
    """
13 1
    if inspect.isclass(service_subject) is True:
14 1
        subject_name = service_subject.__name__
15
    else:
16 1
        subject_name = service_subject.__class__.__name__
17 1
    return convert_camel_to_snake(subject_name)
18
19
20 1
def convert_camel_to_snake(value):
21
    """Convert string from CamelCase to snake_case
22
23
    :param value: CamelCase value
24
    :type value: str
25
    :return: snake_case converted value
26
    :rtype: str
27
    """
28 1
    s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', value)
29
    return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
30