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.

LoadHostClient.main()   A
last analyzed

Complexity

Conditions 2

Size

Total Lines 20

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 20
ccs 0
cts 12
cp 0
crap 6
rs 9.4285
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
from enarksh.Credentials import Credentials
9
from enarksh.DataLayer import DataLayer
10
from enarksh.xml_reader.XmlReader import XmlReader
11
12
13
class LoadHostClient:
14
    """
15
    A client for requesting the controller to load a host definition.
16
    """
17
18
    # ------------------------------------------------------------------------------------------------------------------
19
    def __init__(self):
20
        """
21 View Code Duplication
        Object constructor.
22
        """
23
        credentials = Credentials.get()
24
25
        DataLayer.config['host'] = credentials.get_host()
26
        DataLayer.config['user'] = credentials.get_user()
27
        DataLayer.config['password'] = credentials.get_password()
28
        DataLayer.config['database'] = credentials.get_database()
29
        DataLayer.config['port'] = credentials.get_port()
30
        DataLayer.config['autocommit'] = False
31
32
    # ------------------------------------------------------------------------------------------------------------------
33
    def main(self, filename):
34
        """
35
        The main function of load_schedule.
36
37
        :param str filename: The filename with the XML definition of the host.
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