<commit_before>"""Different classes to parse dicts/lists returned from json into meaningful data objects."""

from .enums import *
from .dictmodel import AttributeModel, Attribute, JsonList, Nullable, PreProcessInt, DateConverter


class Score(AttributeModel):
    """Abstract class representing a score.

    Attributes
    -----------
    score : int
        The score value
    maxcombo : int
        Largest combo achieved
    count50 : int
        Number of "50" hits
    count100 : int
        Number of "100" hits
    count300 : int
        Number of "300" hits
    countmiss : int
        Number of misses
    countkatu : int
        Number of "katu" sections (only 100s and 300s)
    countgeki : int
        Number of "geki" sections (only 300s)
    perfect : bool
        If the play is a full combo (maxcombo is maximal)
    user_id : int
        ID of user who played.
    rank :  str
        Letter rank achieved

    See Also
    ---------
    <https://osu.ppy.sh/wiki/Score>
    """
    score = Attribute(int)
    maxcombo = Attribute(int)
    count50 = Attribute(int)
    count100 = Attribute(int)
    count300 = Attribute(int)
    countmiss = Attribute(int)
    countkatu = Attribute(int)
    countgeki = Attribute(int)
    perfect = Attribute(bool)
    user_id = Attribute(int)
    rank = Attribute(str)


class TeamScore(Score):
    """Class representing a score in a multiplayer team game.

    See :class:`Score`

    Attributes
    -----------
    slot : int
        Which multiplayer slot the player was in.
    team : int
        Which multiplayer team the player was in.
    passed : bool
        If the score is passing.

    See Also
    ---------
    <https://osu.ppy.sh/wiki/Score>
    """
    slot = Attribute(int)
    team = Attribute(int)
    passed = Attribute(bool, name="pass")

    def __repr__(self):
        return "<{0.__module__}.TeamScore user_id={0.user_id} team={0.team}>".format(self)


class SoloScore(Score):
    """Class represeting a score in singleplayer.

    See :class:`Score`

    Attributes
    -----------
    beatmap_id : int
        Beatmap the score is for.
    pp : float
        How much PP the score is worth
    enabled_mods : :class:`osuapi.enums.OsuMod`
        Enabled modifiers
    date : datetime
        When the score was played.

    See Also
    ---------
    <https://osu.ppy.sh/wiki/Score>
    """
    beatmap_id = Attribute(str)
    pp = Attribute(float)
    enabled_mods = Attribute(PreProcessInt(OsuMod))
    date = Attribute(DateConverter)

    def __repr__(self):
        return "<{0.__module__}.SoloScore user_id={0.user_id} beatmap_id={0.beatmap_id} date={0.date}>".format(self)


class User(AttributeModel):
    """Class representing a user.

    Attributes
    -----------
    user_id : int
        User's unique identifier.
    username : str
        User's name.
    count300 : int
        Career total of "300" hits.
    count100 : int
        Career total of "100" hits.
    count50 : int
        Carrer total of "50" hits.
    playcount : int
        Career total play count.
    ranked_score : int
        Total sum of the best scores fro all the ranked beatmaps played online.
    total_score : int
        Total sum of all scores on ranked beatmaps, including failed trails.
    pp_rank : int
        Global ranking place.
    accuracy : float
        Weighted average of accuracy on top plays.
    count_rank_ss : int
        Career total of SS ranks.
    count_rank_s : int
        Career total of S ranks.
    count_rank_a : int
        Career total of A ranks.
    country : str<commit_msg>Fix spelling and grammar, also missing doc of level, pp_raw<commit_after>"""Different classes to parse dicts/lists returned from json into meaningful data objects."""

from .enums import *
from .dictmodel import AttributeModel, Attribute, JsonList, Nullable, PreProcessInt, DateConverter


class Score(AttributeModel):
    """Abstract class representing a score.

    Attributes
    -----------
    score : int
        The score value
    maxcombo : int
        Largest combo achieved
    count50 : int
        Number of "50" hits
    count100 : int
        Number of "100" hits
    count300 : int
        Number of "300" hits
    countmiss : int
        Number of misses
    countkatu : int
        Number of "katu" sections (only 100s and 300s)
    countgeki : int
        Number of "geki" sections (only 300s)
    perfect : bool
        If the play is a full combo (maxcombo is maximal)
    user_id : int
        ID of user who played.
    rank :  str
        Letter rank achieved

    See Also
    ---------
    <https://osu.ppy.sh/wiki/Score>
    """
    score = Attribute(int)
    maxcombo = Attribute(int)
    count50 = Attribute(int)
    count100 = Attribute(int)
    count300 = Attribute(int)
    countmiss = Attribute(int)
    countkatu = Attribute(int)
    countgeki = Attribute(int)
    perfect = Attribute(bool)
    user_id = Attribute(int)
    rank = Attribute(str)


class TeamScore(Score):
    """Class representing a score in a multiplayer team game.

    See :class:`Score`

    Attributes
    -----------
    slot : int
        Which multiplayer slot the player was in.
    team : int
        Which multiplayer team the player was in.
    passed : bool
        If the score is passing.

    See Also
    ---------
    <https://osu.ppy.sh/wiki/Score>
    """
    slot = Attribute(int)
    team = Attribute(int)
    passed = Attribute(bool, name="pass")

    def __repr__(self):
        return "<{0.__module__}.TeamScore user_id={0.user_id} team={0.team}>".format(self)


class SoloScore(Score):
    """Class represeting a score in singleplayer.

    See :class:`Score`

    Attributes
    -----------
    beatmap_id : int
        Beatmap the score is for.
    pp : float
        How much PP the score is worth
    enabled_mods : :class:`osuapi.enums.OsuMod`
        Enabled modifiers
    date : datetime
        When the score was played.

    See Also
    ---------
    <https://osu.ppy.sh/wiki/Score>
    """
    beatmap_id = Attribute(str)
    pp = Attribute(float)
    enabled_mods = Attribute(PreProcessInt(OsuMod))
    date = Attribute(DateConverter)

    def __repr__(self):
        return "<{0.__module__}.SoloScore user_id={0.user_id} beatmap_id={0.beatmap_id} date={0.date}>".format(self)


class User(AttributeModel):
    """Class representing a user.

    Attributes
    -----------
    user_id : int
        User's unique identifier.
    username : str
        User's name.
    count300 : int
        Career total of "300" hits.
    count100 : int
        Career total of "100" hits.
    count50 : int
        Career total of "50" hits.
    playcount : int
        Career total play count.
    ranked_score : int
        Total sum of the best scores from all the ranked beatmaps played online.
    total_score : int
        Total sum of all scores on ranked beatmaps, including failed trails.
    pp_rank : int
        Global ranking place.
    level: float
        User's level
    pp_raw: float
        User's performance points
    accuracy : float
        Weighted average of accuracy on top plays.
    count_rank_ss : int
        Career total of SS ranks.
    count_rank_s : int
        Career total of S ranks.
    count_rank_a : int
        Career total of A ranks.
    country : str
{'fraction_non_alphanumeric': 0.0971937029431896, 'fraction_numerical': 0.015331964407939767, 'mean_word_length': 2.1532153646957273, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 6, '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': '58327', 'n_tokens_mistral': 2214, 'n_tokens_neox': 2079, 'n_words': 719}