<commit_before>"""
Wrappers for Status objects.

.. currentmodule:: curious.dataclasses.presence
"""

import enum


class Status(enum.Enum):
    """
    Represents a Member's status.
    """
    #: Corresponds to online (green dot).
    ONLINE = 'online'

    #: Corresponds to offline (gray dot).
    OFFLINE = 'offline'

    #: Corresponds to idle (yellow dot).
    IDLE = 'idle'

    #: Corresponds to Do Not Disturb (red dot).
    DND = 'dnd'

    #: Corresponds to invisible (gray dot).
    INVISIBLE = 'invisible'

    @property
    def strength(self) -> int:
        """
        :return: The strength of the presence, when computing the final presence on multiple \ 
            connections. 
        """
        return strengths.index(self)


strengths = [Status.OFFLINE, Status.INVISIBLE, Status.IDLE, Status.DND, Status.ONLINE]


class GameType(enum.IntEnum):
    """
    Represents a game's type.
    """
    #: Shows the ``Playing`` text.
    PLAYING = 0

    #: Shows the ``Streaming`` text.
    STREAMING = 1

    #: Shows the ``Listening to`` text.
    LISTENING_TO = 2

    #: Shows the ``Watching`` text.
    WATCHING = 3


class Game(object):
    """
    Represents a game object.
    """

    __slots__ = "type", "url", "name"

    def __init__(self, **kwargs):
        """
        :param name: The name for the game. 100 characters max.
        :param url: The URL for the game, if streaming.
        :param type: A :class:`.GameType` for this game.
        """
        #: The type of game this is.
        self.type: GameType = GameType(kwargs.get("type", 0))
        #: The stream URL this game is for.
        self.url: str = kwargs.get("url", None)
        #: The name of the game being played.
        self.name: str = kwargs.get("name", None)

    def to_dict(self) -> dict:
        """
        :return: The dict representation of this object. 
        """
        d = {
            "name": self.name,
            "type": self.type,
        }
        if self.url is not None:
            d["url"] = self.url

        return d

    def __repr__(self):
        return "<Game name='{}' type={} url={}>".format(self.name, self.type, self.url)


class Presence(object):
    """
    Represents a presence on a member.
    """

    __slots__ = "_status", "_game"<commit_msg>Don't explode if we get a weird presence.<commit_after>"""
Wrappers for Status objects.

.. currentmodule:: curious.dataclasses.presence
"""

import enum


class Status(enum.Enum):
    """
    Represents a Member's status.
    """
    #: Corresponds to online (green dot).
    ONLINE = 'online'

    #: Corresponds to offline (gray dot).
    OFFLINE = 'offline'

    #: Corresponds to idle (yellow dot).
    IDLE = 'idle'

    #: Corresponds to Do Not Disturb (red dot).
    DND = 'dnd'

    #: Corresponds to invisible (gray dot).
    INVISIBLE = 'invisible'

    @property
    def strength(self) -> int:
        """
        :return: The strength of the presence, when computing the final presence on multiple \ 
            connections. 
        """
        return strengths.index(self)


strengths = [Status.OFFLINE, Status.INVISIBLE, Status.IDLE, Status.DND, Status.ONLINE]


class GameType(enum.IntEnum):
    """
    Represents a game's type.
    """
    #: Shows the ``Playing`` text.
    PLAYING = 0

    #: Shows the ``Streaming`` text.
    STREAMING = 1

    #: Shows the ``Listening to`` text.
    LISTENING_TO = 2

    #: Shows the ``Watching`` text.
    WATCHING = 3


class Game(object):
    """
    Represents a game object.
    """

    __slots__ = "type", "url", "name"

    def __init__(self, **kwargs):
        """
        :param name: The name for the game. 100 characters max.
        :param url: The URL for the game, if streaming.
        :param type: A :class:`.GameType` for this game.
        """
        #: The type of game this is.
        self.type: GameType = 0
        try:
            self.type: GameType = GameType(kwargs.get("type", 0))
        except ValueError:
            self.type = kwargs.get("type", 0)

        #: The stream URL this game is for.
        self.url: str = kwargs.get("url", None)
        #: The name of the game being played.
        self.name: str = kwargs.get("name", None)

    def to_dict(self) -> dict:
        """
        :return: The dict representation of this object. 
        """
        d = {
            "name": self.name,
            "type": self.type,
        }
        if self.url is not None:
            d["url"] = self.url

        return d

    def __repr__(self):
        return "<Game name='{}' type={} url={}>".format(self.name, self.type, self.url)


class Presence(object):
    """
    Represents a presence on a member.
    """

    __slots__ = "_status", "_game"
{'fraction_non_alphanumeric': 0.13236225459151363, 'fraction_numerical': 0.0037998733375554147, 'mean_word_length': 2.088657105606258, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 9, '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': '4016644', 'n_tokens_mistral': 1546, 'n_tokens_neox': 1435, 'n_words': 463}