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 ( 51d863...dbdfc9 )
by P.R.
02:48
created

LoadHostClient._load_host()   A

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
c 1
b 0
f 0
dl 0
loc 7
ccs 0
cts 4
cp 0
crap 2
rs 9.4285
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
9
import enarksh
10
from enarksh.DataLayer import DataLayer
11
from enarksh.xml_reader.XmlReader import XmlReader
12
13
14
class LoadHostClient:
15
    """
16
    A client for requesting the controller to load a host definition.
17
    """
18
19
    # ------------------------------------------------------------------------------------------------------------------
20
    def __init__(self):
21
        """
22
        Object constructor.
23
        """
24
        DataLayer.config['host'] = enarksh.MYSQL_HOSTNAME
25
        DataLayer.config['user'] = enarksh.MYSQL_USERNAME
26
        DataLayer.config['password'] = enarksh.MYSQL_PASSWORD
27
        DataLayer.config['database'] = enarksh.MYSQL_SCHEMA
28
        DataLayer.config['port'] = enarksh.MYSQL_PORT
29
        DataLayer.config['autocommit'] = False
30
31
    # ------------------------------------------------------------------------------------------------------------------
32
    def main(self, filename):
33
        """
34
        The main function of load_schedule.
35
36
        :param str filename: The filename with the XML definition of the host.
37
        """
38
39
        try:
40
            DataLayer.connect()
41
42
            reader = XmlReader()
43
            host = reader.parse_host(filename)
44
            host.store()
45
46
            DataLayer.commit()
47
            DataLayer.disconnect()
48
        except Exception as exception:
49
            DataLayer.rollback()
50
            DataLayer.disconnect()
51
52
            raise exception
53
54
# ----------------------------------------------------------------------------------------------------------------------
55