build.shared.singleton   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A Singleton.__call__() 0 5 2
1
"""
2
    Metaclass do define singleton classes
3
    Taken from
4
    http://stackoverflow.com/questions/6760685/creating-a-singleton-in-python
5
"""
6
7
8 1
class Singleton(type):
9
    """
10
        Singleton Class
11
    """
12 1
    _instances = {}
13
14 1
    def __call__(cls, *args, **kwargs):
15 1
        if cls not in cls._instances:
16 1
            cls._instances[cls] = super(Singleton, cls).__call__(*args,
17
                                                                 **kwargs)
18
        return cls._instances[cls]
19