# ../events/__init__.py

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
from core import AutoUnload
from loggers import _SPLogger
from public import public
#   Events
from events.manager import EventRegistry


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Get the sp.events logger
EventsLogger = _SPLogger.events


# =============================================================================
# >> CLASSES
# =============================================================================
@public
class Event(AutoUnload):
    '''Event decorator class'''

    def __init__(self, callback):
        '''Store the callback and register the event'''

        # Is the callback callable?
        if not callable(callback):

            # Raise an error
            raise TypeError(
                "'" + type(callback).__name__ + "' object is not callable")

        # Store the callback
        self.callback = callback

        # Register the event
        EventRegistry.register_for_event(self.callback.__name__, self.callback)

    def __call__(self, GameEvent):
        '''Calls the Event callback with the GameEvent instance'''
        return self.callback(GameEvent)

    def _unload_instance(self):
        '''Unregisters the event'''
        EventRegistry.unregister_for_event(
            self.callback.__name__, self.callback)

57021d26ac3db5ceec0f4285fee424fac02a922f
<mask token>


@public
class Event(AutoUnload):
    <mask token>
    <mask token>

    def __call__(self, GameEvent):
        """Calls the Event callback with the GameEvent instance"""
        return self.callback(GameEvent)

    def _unload_instance(self):
        """Unregisters the event"""
        EventRegistry.unregister_for_event(self.callback.__name__, self.
            callback)

<mask token>


@public
class Event(AutoUnload):
    <mask token>

    def __init__(self, callback):
        """Store the callback and register the event"""
        if not callable(callback):
            raise TypeError("'" + type(callback).__name__ +
                "' object is not callable")
        self.callback = callback
        EventRegistry.register_for_event(self.callback.__name__, self.callback)

    def __call__(self, GameEvent):
        """Calls the Event callback with the GameEvent instance"""
        return self.callback(GameEvent)

    def _unload_instance(self):
        """Unregisters the event"""
        EventRegistry.unregister_for_event(self.callback.__name__, self.
            callback)

<mask token>
EventsLogger = _SPLogger.events


@public
class Event(AutoUnload):
    """Event decorator class"""

    def __init__(self, callback):
        """Store the callback and register the event"""
        if not callable(callback):
            raise TypeError("'" + type(callback).__name__ +
                "' object is not callable")
        self.callback = callback
        EventRegistry.register_for_event(self.callback.__name__, self.callback)

    def __call__(self, GameEvent):
        """Calls the Event callback with the GameEvent instance"""
        return self.callback(GameEvent)

    def _unload_instance(self):
        """Unregisters the event"""
        EventRegistry.unregister_for_event(self.callback.__name__, self.
            callback)

from core import AutoUnload
from loggers import _SPLogger
from public import public
from events.manager import EventRegistry
EventsLogger = _SPLogger.events


@public
class Event(AutoUnload):
    """Event decorator class"""

    def __init__(self, callback):
        """Store the callback and register the event"""
        if not callable(callback):
            raise TypeError("'" + type(callback).__name__ +
                "' object is not callable")
        self.callback = callback
        EventRegistry.register_for_event(self.callback.__name__, self.callback)

    def __call__(self, GameEvent):
        """Calls the Event callback with the GameEvent instance"""
        return self.callback(GameEvent)

    def _unload_instance(self):
        """Unregisters the event"""
        EventRegistry.unregister_for_event(self.callback.__name__, self.
            callback)

# ../events/__init__.py

# =============================================================================
# >> IMPORTS
# =============================================================================
# Source.Python Imports
from core import AutoUnload
from loggers import _SPLogger
from public import public
#   Events
from events.manager import EventRegistry


# =============================================================================
# >> GLOBAL VARIABLES
# =============================================================================
# Get the sp.events logger
EventsLogger = _SPLogger.events


# =============================================================================
# >> CLASSES
# =============================================================================
@public
class Event(AutoUnload):
    '''Event decorator class'''

    def __init__(self, callback):
        '''Store the callback and register the event'''

        # Is the callback callable?
        if not callable(callback):

            # Raise an error
            raise TypeError(
                "'" + type(callback).__name__ + "' object is not callable")

        # Store the callback
        self.callback = callback

        # Register the event
        EventRegistry.register_for_event(self.callback.__name__, self.callback)

    def __call__(self, GameEvent):
        '''Calls the Event callback with the GameEvent instance'''
        return self.callback(GameEvent)

    def _unload_instance(self):
        '''Unregisters the event'''
        EventRegistry.unregister_for_event(
            self.callback.__name__, self.callback)
