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 ( 5cb0ac...773912 )
by P.R.
02:12
created

Event.destroy()   A

Complexity

Conditions 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 9
ccs 4
cts 4
cp 1
crap 2
rs 9.6666
1
"""
2
Enarksh
3
4
Copyright 2013-2016 Set Based IT Consultancy
5
6
Licence MIT
7
"""
8
9
10 1
class Event:
11
    """
12
    Class for events.
13
    """
14
15
    # ------------------------------------------------------------------------------------------------------------------
16 1
    event_controller = None
17
    """
18
    The event controller.
19
20
    :type: None|enarksh.event.EventController.EventController
21
    """
22
23
    # ------------------------------------------------------------------------------------------------------------------
24 1
    def __init__(self, source):
25
        """
26
        Object constructor.
27
28
        :param T source: The object that generates this event.
29
        """
30 1
        self._source = source
31
        """
32
        The object that generates this event.
33
34
        :type: enarksh.event.EventActor.EventActor
35
        """
36
37
        # Register this event as an event in the current program.
38 1
        Event.event_controller.friend_register_event(self)
39
40
    # ------------------------------------------------------------------------------------------------------------------
41 1
    @property
42
    def source(self):
43
        """
44
        Returns the object that fires this event.
45
46
        :rtype: enarksh.event.EventActor.EventActor
47
        """
48 1
        return self._source
49
50
    # ------------------------------------------------------------------------------------------------------------------
51 1
    def destroy(self):
52
        """
53
        Destroys this event. This as preparation for removing this event such that there aren't references (from the
54
        event system) to this event and the garbage collector can remove this event.
55
        """
56
        # Remove this event as an event in the current program.
57 1
        Event.event_controller.friend_unregister_event(self)
58 1
        if hasattr(self, '_source'):
59 1
            del self._source
60
61
    # ------------------------------------------------------------------------------------------------------------------
62 1
    def fire(self, event_data=None):
63
        """
64
        Fires this event. That is, the event is put on the event queue of the event controller.
65
66
        Normally this method is called by the source of this event.
67
68
        :param * event_data: Additional data supplied by the event source.
69
        """
70 1
        Event.event_controller.friend_queue_event(self, event_data)
71
72
    # ------------------------------------------------------------------------------------------------------------------
73 1
    def register_listener(self, listener, listener_data=None):
74
        """
75
        Registers an object as a listener for this event.
76
77
        :param callable listener: An object that listen for an event.
78
        :param * listener_data: Additional data supplied by the listener destination.
79
        """
80 1
        Event.event_controller.friend_register_listener(self, listener, listener_data)
81
82
# ----------------------------------------------------------------------------------------------------------------------
83