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 ( fac2c4...4a4d5a )
by P.R.
03:39
created

NodeActionWebMessage.__init__()   A

Complexity

Conditions 1

Size

Total Lines 54

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 54
ccs 0
cts 9
cp 0
crap 2
rs 9.6716

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
from enarksh.message.Message import Message
9
10
11
class NodeActionWebMessage(Message):
12
    """
13
    Message type for requesting a node action made through the web application.
14
    """
15
    MESSAGE_TYPE = 'controller:NodeActionWebMessage'
16
    """
17
    The message type.
18
19
    :type: str
20
    """
21
22
    # ------------------------------------------------------------------------------------------------------------------
23
    def __init__(self, sch_id, rnd_id, act_id, usr_login, mail_on_completion, mail_on_error):
24
        """
25
        Object constructor.
26
27
        :param int sch_id: The ID of the schedule.
28
        :param int rnd_id: The ID of the run node.
29
        :param int act_id: The ID of the requested action.
30
        :param str usr_login: The name of the user who has requested the node action.
31
        :param bool mail_on_completion: If True the user wants to receive a mail when the schedule has completed.
32
        :param bool mail_on_error: If True the user wants to receive a mail when an error occurs.
33
        """
34
        Message.__init__(self, NodeActionWebMessage.MESSAGE_TYPE)
35
36
        self.sch_id = sch_id
37
        """
38
        The ID of the schedule.
39
40
        :type: int
41
        """
42
43
        self.rnd_id = rnd_id
44
        """
45
        The ID of the run node.
46
47
        :type: int
48
        """
49
50
        self.act_id = act_id
51
        """
52
        The ID of the requested action.
53
54
        :type: int
55
        """
56
57
        self.usr_login = usr_login
58
        """
59
        The name of the user who has requested the node action.
60
61
        :type: str
62
        """
63
64
        self.mail_on_completion = mail_on_completion
65
        """
66
        If True the user wants to receive a mail when the schedule has completed.
67
68
        :type: bool
69
        """
70
71
        self.mail_on_error = mail_on_error
72
        """
73
        If True the user wants to receive a mail when an error occurs.
74
75
        :type: bool
76
        """
77
78
    # ------------------------------------------------------------------------------------------------------------------
79
    @staticmethod
80
    def create_from_json(message):
81
        """
82
        Object constructor using JSON encoded message.
83
84
        :param * message: The message.
85
86
        :rtype: enarksh.controller.message.PossibleNodeActionsWebMessage.PossibleNodeActionsWebMessage
87
        """
88
        return NodeActionWebMessage(int(message['sch_id']),
89
                                    int(message['rnd_id']),
90
                                    int(message['act_id']),
91
                                    message['usr_login'],
92
                                    bool(message['mail_on_completion']),
93
                                    bool(message['mail_on_error']))
94
95
    # ------------------------------------------------------------------------------------------------------------------
96
    def send_message(self, end_point):
97
        """
98
        Sends the message to an end point.
99
100
        :param str end_point: The end point.
101
102
        :rtype: None
103
        """
104
        self.message_controller.send_message(end_point, self)
105
106
# ----------------------------------------------------------------------------------------------------------------------
107