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.

Credentials.get_host()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
dl 0
loc 7
ccs 0
cts 2
cp 0
crap 2
rs 9.4285
c 1
b 0
f 0
1
"""
2
PyStratum
3
4
Copyright 2015-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
from configparser import ConfigParser
9
10
from enarksh.C import C
11
12
13
class Credentials:
14
    """
15
    Singleton for reading MySQL's credentials.
16
    """
17
    instance = None
18
    """
19
    The singleton of this class.
20
21
    :type: None|enarksh.Credentials.Credentials
22
    """
23
24
    # ------------------------------------------------------------------------------------------------------------------
25
    @staticmethod
26
    def get():
27
        """
28
        Returns the singleton of this class.
29
30
        :rtype: enarksh.Credentials.Credentials
31
        """
32
        if not Credentials.instance:
33
            Credentials.instance = Credentials()
34
35
        return Credentials.instance
36
37
    # ------------------------------------------------------------------------------------------------------------------
38
    def __init__(self):
39
        """
40
        Object constructor.
41
        """
42
        self.__config = ConfigParser()
43
        self.__config.read(C.CREDENTIALS_CFG)
44
45
    # ------------------------------------------------------------------------------------------------------------------
46
    def get_host(self):
47
        """
48
        Returns the hostname of the MySQL instance.
49
50
        :rtype: str
51
        """
52
        return self.__config.get('database', 'host', fallback='localhost')
53
54
    # ------------------------------------------------------------------------------------------------------------------
55
    def get_user(self):
56
        """
57
        Returns the user for connecting to the MySQL instance.
58
59
        :rtype: str
60
        """
61
        return self.__config.get('database', 'user')
62
63
    # ------------------------------------------------------------------------------------------------------------------
64
    def get_password(self):
65
        """
66
        Returns the password for connecting to the MySQL instance.
67
68
        :rtype: str
69
        """
70
        return self.__config.get('database', 'password')
71
72
    # ------------------------------------------------------------------------------------------------------------------
73
    def get_database(self):
74
        """
75
        Returns the database or schema name.
76
77
        :rtype: str
78
        """
79
        return self.__config.get('database', 'database')
80
81
    # ------------------------------------------------------------------------------------------------------------------
82
    def get_port(self):
83
        """
84
        Returns the port to the MySQL instance.
85
86
        :rtype: int
87
        """
88
        return self.__config.getint('database', 'port', fallback=3306)
89
90
# ----------------------------------------------------------------------------------------------------------------------
91