<commit_before>"""
github3.event
=============

This module contains the class(es) related to Events

"""

from .models import GitHubCore


class Event(GitHubCore):
    """The :class:`Event <Event>` object. It structures and handles the data
    returned by via the `Events <http://developer.github.com/v3/events>`_
    section of the GitHub API.
    """
    def __init__(self, event, session=None):
        super(Event, self).__init__(session)
        from .user import User
        from .org import Organization
        self._created = self._strptime(event.get('created_at'))
        self._type = event.get('type')
        self._public = event.get('public')
        self._repo = event.get('repo', {})
        self._actor = event.get('actor', {})
        if self._actor:
            self._actor = User(self._actor, self._session)
        self._id = event.get('id')
        handler = _payload_handlers[self._type]
        self._payload = handler(event.get('payload'))
        self._org = event.get('org', {})
        if self._org:
            Organization(self._org, self._session)

    def __repr__(self):
        return '<Event [%s]>' % self._type[:-5]

    @property
    def actor(self):
        """:class:`User <User>` object representing the actor."""
        return self._actor

    @property
    def created_at(self):
        """datetime object representing when the event was created."""
        return self._created

    @property
    def id(self):
        """Unique id of the event"""
        return self._id

    @classmethod
    def list_types(cls):
        return sorted(_payload_handlers.keys())

    @property
    def org(self):
        """:class:`Organization <Organization>` object if actor was an org."""
        return self._org

    @property
    def payload(self):
        """Dictionary with the payload. Payload structure is defined by type_.

        .. _type: http://developer.github.com/v3/events/types
        """
        return self._payload

    def is_public(self):
        """Indicates whether the Event is public or not.

        :returns: bool -- True if event is pubic, False otherwise
        """
        return self._public

    @property
    def repo(self):
        return self._repo

    @property
    def type(self):

        return self._type
<commit_msg>Minor changes to Event class + docs.<commit_after>"""
github3.event
=============

This module contains the class(es) related to Events

"""

from .models import GitHubCore


class Event(GitHubCore):
    """The :class:`Event <Event>` object. It structures and handles the data
    returned by via the `Events <http://developer.github.com/v3/events>`_
    section of the GitHub API.
    """
    def __init__(self, event, session=None):
        super(Event, self).__init__(session)
        from .user import User
        from .org import Organization
        self._created = self._strptime(event.get('created_at'))
        self._type = event.get('type')
        self._public = event.get('public')
        self._repo = event.get('repo', {})
        self._actor = event.get('actor', {})
        if self._actor:
            self._actor = User(self._actor, self._session)
        self._id = event.get('id')
        handler = _payload_handlers[self._type]
        self._payload = handler(event.get('payload'))
        self._org = event.get('org', {})
        if self._org:
            Organization(self._org, self._session)

    def __repr__(self):
        return '<Event [%s]>' % self._type[:-5]

    @property
    def actor(self):
        """:class:`User <User>` object representing the actor."""
        return self._actor

    @property
    def created_at(self):
        """datetime object representing when the event was created."""
        return self._created

    @property
    def id(self):
        """Unique id of the event"""
        return self._id

    @staticmethod
    def list_types():
        """List all possible types of Events"""
        return sorted(_payload_handlers.keys())

    @property
    def org(self):
        """:class:`Organization <Organization>` object if actor was an org."""
        return self._org

    @property
    def payload(self):
        """Dictionary with the payload. Payload structure is defined by type_.

        .. _type: http://developer.github.com/v3/events/types
        """
        return self._payload

    def is_public(self):
        """Indicates whether the Event is public or not.

        :returns: bool -- True if event is pubic, False otherwise
        """
        return self._public

    @property
    def repo(self):
        """Return ``tuple(owner, repository_name)``"""
        return self._repo

    @property
    def type(self):
        """Event type"""
        return self._type

{'fraction_non_alphanumeric': 0.12901182432432431, 'fraction_numerical': 0.0016891891891891893, 'mean_word_length': 2.3932664756446993, 'pattern_counts': {'":': 4, '<': 13, '<?xml version=': 0, '>': 13, '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': '3168687', 'n_tokens_mistral': 1333, 'n_tokens_neox': 1294, 'n_words': 384}