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 ( 45bad2...19fcc2 )
by P.R.
04:30
created

Logger.daemonize()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
c 0
b 0
f 0
dl 0
loc 6
ccs 0
cts 2
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
import zmq
9
10
import enarksh
11
from enarksh.DataLayer import DataLayer
12
from enarksh.event.EventController import EventController
13
from enarksh.logger.event_handler.ExitMessageEventHandler import ExitMessageEventHandler
14
from enarksh.logger.event_handler.LogFileMessageEventHandler import LogFileMessageEventHandler
15
from enarksh.logger.message.LogFileMessage import LogFileMessage
16
from enarksh.message.ExitMessage import ExitMessage
0 ignored issues
show
Bug introduced by
The name message does not seem to exist in module enarksh.
Loading history...
Configuration introduced by
The import enarksh.message.ExitMessage could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
17
from enarksh.message.MessageController import MessageController
0 ignored issues
show
Bug introduced by
The name message does not seem to exist in module enarksh.
Loading history...
Configuration introduced by
The import enarksh.message.MessageController could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

Loading history...
18
19
20
class Logger:
21
    """
22
    The logger.
23
    """
24
25
    # ------------------------------------------------------------------------------------------------------------------
26
    def __init__(self):
27
        """
28
        Object constructor.
29
        """
30
        self._event_controller = EventController()
31
        """
32
        The event controller.
33
34
        :type: enarksh.event.EventController.EventController
35
        """
36
37
        self._message_controller = MessageController()
38
        """
39
        The message controller.
40
41
        :type: enarksh.message.MessageController.MessageController
42
        """
43
44
    # ------------------------------------------------------------------------------------------------------------------
45
    def main(self):
46
        """
47
        The main of the logger.
48
        """
49
        # Startup logger.
50
        self._startup()
51
52
        # Register our socket for asynchronous incoming messages.
53
        self._message_controller.register_end_point('pull', zmq.PULL, enarksh.LOGGER_PULL_END_POINT)
1 ignored issue
show
Bug introduced by
The Module zmq does not seem to have a member named PULL.

This check looks for calls to members that are non-existent. These calls will fail.

The member could have been renamed or removed.

Loading history...
54
55
        # Register supported message types
56
        self._message_controller.register_message_type(ExitMessage.MESSAGE_TYPE)
57
        self._message_controller.register_message_type(LogFileMessage.MESSAGE_TYPE)
58
59
        # Register message received event handlers.
60
        self._message_controller.register_listener(ExitMessage.MESSAGE_TYPE, ExitMessageEventHandler.handle)
61
        self._message_controller.register_listener(LogFileMessage.MESSAGE_TYPE, LogFileMessageEventHandler.handle)
62
63
        # Register other event handlers.
64
        self._event_controller.event_queue_empty.register_listener(self._message_controller.receive_message)
65
66
        # Run the event loop.
67
        self._event_controller.loop()
68
69
        # Shutdown logger.
70
        self._shutdown()
71
72
    # ------------------------------------------------------------------------------------------------------------------
73
    @staticmethod
74
    def _shutdown():
75
        """
76
        Performs the necessary actions for stopping the logger.
77
        """
78
        # Log stop of the logger.
79
        print('Stop logger')
80
81
    # ------------------------------------------------------------------------------------------------------------------
82
    @staticmethod
83
    def _startup():
84
        """
85
        Performs the necessary actions for starting up the logger.
86
        """
87
        # Log the start of the logger.
88
        print('Start logger')
89
90
        # Set database configuration options.
91
        DataLayer.config['host'] = enarksh.MYSQL_HOSTNAME
92
        DataLayer.config['user'] = enarksh.MYSQL_USERNAME
93
        DataLayer.config['password'] = enarksh.MYSQL_PASSWORD
94
        DataLayer.config['database'] = enarksh.MYSQL_SCHEMA
95
        DataLayer.config['port'] = enarksh.MYSQL_PORT
96
97
# ----------------------------------------------------------------------------------------------------------------------
98