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 ( 5e962d...d4663b )
by P.R.
03:14
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 1
import weakref
9
10
11 1
class Event:
12
    """
13
    Class for events.
14
    """
15
16
    # ------------------------------------------------------------------------------------------------------------------
17 1
    event_controller = None
18
    """
19
    The event controller.
20
21
    :type: None|enarksh.event.EventController.EventController
22
    """
23
24
    # ------------------------------------------------------------------------------------------------------------------
25 1
    def __init__(self, source):
26
        """
27
        Object constructor.
28
29
        :param T source: The object that generates this event.
30
        """
31 1
        self._source = source
32
        """
33
        The object that generates this event.
34
35
        :type: enarksh.event.EventActor.EventActor
36
        """
37
38 1
        self.ref = weakref.ref(self, Event.event_controller.internal_unregister_event_ref)
39
        """
40
        The weak reference to this event.
41
42
        :type: weakref
43
        """
44
45
        # Register this event as an event in the current program.
46 1
        Event.event_controller.internal_register_event(self)
47
48
    # ------------------------------------------------------------------------------------------------------------------
49 1
    @property
50
    def source(self):
51
        """
52
        Returns the object that fires this event.
53
54
        :rtype: enarksh.event.EventActor.EventActor
55
        """
56 1
        return self._source
57
58
    # ------------------------------------------------------------------------------------------------------------------
59 1
    def fire(self, event_data=None):
60
        """
61
        Fires this event. That is, the event is put on the event queue of the event controller.
62
63
        Normally this method is called by the source of this event.
64
65
        :param * event_data: Additional data supplied by the event source.
66
        """
67 1
        Event.event_controller.internal_queue_event(self, event_data)
68
69
    # ------------------------------------------------------------------------------------------------------------------
70 1
    def register_listener(self, listener, listener_data=None):
71
        """
72
        Registers an object as a listener for this event.
73
74
        :param callable listener: An object that listen for an event.
75
        :param * listener_data: Additional data supplied by the listener destination.
76
        """
77 1
        Event.event_controller.internal_register_listener(self, listener, listener_data)
78
79
# ----------------------------------------------------------------------------------------------------------------------
80