<commit_before># -*- coding: utf-8 -*-
"""Module with Kyco Events"""

from datetime import datetime

# Base Events Classes


class KycoEvent(object):
    """Base Event class

    The event data will be passed on the content attribute, which should be a
    dictionary.

    Args:
        content (dict): Dictionary with all event informations
    """
    def __init__(self, content, connection=None, timestamp=datetime.now()):
        self.content = content
        self.connection = connection
        self.timestamp = timestamp


class KycoCoreEvent(KycoEvent):
    """Kyco Core Event base class.

    Events generated by Kyco or any Core NApps"""
    def __init__(self, content, connection=None, timestamp=datetime.now()):
        super().__init__(content, connection, timestamp)
        self.context = 'core'


class KycoMsgEvent(KycoEvent):
    """Base class for all Events related to OpenFlow Messages"""
    def __init__(self, content, connection=None, timestamp=datetime.now()):
        super().__init__(content, connection, timestamp)
        self.context = 'message'


class KycoAppEvent(KycoEvent):
    """Base class for all Events generated to/by Apps that are not OpenFlow
    Messages"""
    def __init__(self, content, connection=None, timestamp=datetime.now()):
        super().__init__(content, connection, timestamp)
        self.context = 'apps'


class KycoShutdownEvent(KycoEvent):
    def __init__(self, content={}, connection=None, timestamp=datetime.now()):
        super().__init__(content, connection, timestamp)


class KycoRawEvent(KycoCoreEvent):
    """Kyco Event generated by incoming packets from the network.
<commit_msg>Fixing timestamp to use UTC<commit_after># -*- coding: utf-8 -*-
"""Module with Kyco Events"""

from datetime import datetime
from datetime import timezone

# Base Events Classes


class KycoEvent(object):
    """Base Event class

    The event data will be passed on the content attribute, which should be a
    dictionary.

    Args:
        content (dict): Dictionary with all event informations
    """
    def __init__(self, content, connection=None,
                 timestamp=datetime.now(timezone.utc)):
        self.content = content
        self.connection = connection
        self.timestamp = timestamp


class KycoCoreEvent(KycoEvent):
    """Kyco Core Event base class.

    Events generated by Kyco or any Core NApps"""
    def __init__(self, content, connection=None,
                 timestamp=datetime.now(timezone.utc)):
        super().__init__(content, connection, timestamp)
        self.context = 'core'


class KycoMsgEvent(KycoEvent):
    """Base class for all Events related to OpenFlow Messages"""
    def __init__(self, content, connection=None, timestamp=datetime.now(timezone.utc)):
        super().__init__(content, connection, timestamp)
        self.context = 'message'


class KycoAppEvent(KycoEvent):
    """Base class for all Events generated to/by Apps that are not OpenFlow
    Messages"""
    def __init__(self, content, connection=None, timestamp=datetime.now(timezone.utc)):
        super().__init__(content, connection, timestamp)
        self.context = 'apps'


class KycoShutdownEvent(KycoEvent):
    def __init__(self, content={}, connection=None, timestamp=datetime.now(timezone.utc)):
        super().__init__(content, connection, timestamp)


class KycoRawEvent(KycoCoreEvent):
    """Kyco Event generated by incoming packets from the network.

{'fraction_non_alphanumeric': 0.10417875798026698, 'fraction_numerical': 0.0005803830528148578, 'mean_word_length': 3.6330645161290325, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5174144', 'n_tokens_mistral': 949, 'n_tokens_neox': 910, 'n_words': 298}