MyService   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 31
rs 10
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A full_name() 0 8 1
A service_name() 0 3 1
A module_name() 0 3 1
A all_packages() 0 7 2
1
# coding: utf-8
2
from django.conf import settings
3
4
5
class MyService(object):
6
7
    """
8
        build the name of the package, module, class
9
        on that model:
10
        th_<service>.my_<service>.Service<Service>
11
    """
12
    @staticmethod
13
    def full_name(package):
14
        service_name = package.split('_')[1]
15
        return ''.join((package,
16
                        ".my_",
17
                        service_name,
18
                        ".Service",
19
                        service_name.title()))
20
21
    @staticmethod
22
    def module_name(package):
23
        return "".join(("my_", package.split('_')[1]))
24
25
    @staticmethod
26
    def service_name(package):
27
        return "".join(("Service", package.split('_')[1].title()))
28
29
    @staticmethod
30
    def all_packages():
31
        my_services = []
32
        for services in settings.TH_SERVICES:
33
            package = services.split('.')[0]
34
            my_services.append(package)
35
        return my_services
36