Skip to content

enums

Enumerations shared across the library - metrics, periods, player types, and the like. Members are PascalCase names mapped to the API's string values, so wom.Metric.Attack serializes to "attack".

Global enums used throughout the project.

Activities module-attribute

Activities: FrozenSet[Metric] = frozenset({LeaguePoints, BountyHunterHunter, BountyHunterRogue, ClueScrollsAll, ClueScrollsBeginner, ClueScrollsEasy, ClueScrollsMedium, ClueScrollsHard, ClueScrollsElite, ClueScrollsMaster, CollectionsLogged, ColosseumGlory, LastManStanding, PvpArena, SoulWarsZeal, GuardiansOfTheRift})

Set containing activities.

Bosses module-attribute

Bosses: FrozenSet[Metric] = frozenset({AbyssalSire, AlchemicalHydra, Amoxliatl, Araxxor, Artio, BarrowsChests, Brutus, Bryophyta, Callisto, Calvarion, Cerberus, ChambersOfXeric, ChambersOfXericChallenge, ChaosElemental, ChaosFanatic, CommanderZilyana, CorporealBeast, CrazyArchaeologist, DagannothPrime, DagannothRex, DagannothSupreme, DerangedArchaeologist, DoomOfMokhaiotl, DukeSucellus, GeneralGraardor, GiantMole, GrotesqueGuardians, Hespori, Hueycoatl, KalphiteQueen, KingBlackDragon, Kraken, Kreearra, KrilTsutsaroth, LunarChests, MadAngel, MaggotKing, Mimic, Nex, Nightmare, PhosanisNightmare, Obor, PhantomMuspah, Sarachnis, Scorpia, Scurrius, ShellbaneGryphon, Skotizo, SolHeredit, Spindel, Tempoross, TheGauntlet, TheCorruptedGauntlet, TheLeviathan, TheWhisperer, TheRoyalTitans, TheatreOfBlood, TheatreOfBloodHard, ThermonuclearSmokeDevil, TombsOfAmascut, TombsOfAmascutExpert, TzKalZuk, TzTokJad, Vardorvis, Venenatis, Vetion, Vorkath, Wintertodt, Yama, Zalcano, Zulrah})

Set containing bosses.

ComputedMetrics module-attribute

ComputedMetrics: FrozenSet[Metric] = frozenset({Ehp, Ehb})

Set containing all the types of computed metrics.

Skills module-attribute

Skills: FrozenSet[Metric] = frozenset({Overall, Attack, Defence, Strength, Hitpoints, Ranged, Prayer, Magic, Cooking, Woodcutting, Fletching, Fishing, Firemaking, Crafting, Smithing, Mining, Herblore, Agility, Thieving, Slayer, Farming, Runecrafting, Hunter, Construction, Sailing})

Set containing skills.

BaseEnum

Bases: Enum

The base enum all library enums inherit from.

Source code in wom/enums.py
class BaseEnum(Enum, metaclass=BaseEnumMeta):
    """The base enum all library enums inherit from."""

    def __str__(self) -> str:
        return self.value  # type: ignore[no-any-return]

    def __eq__(self, other: object) -> bool:
        if isinstance(other, BaseEnum):
            return self.value == other.value  # type: ignore[no-any-return]

        if isinstance(other, str):
            return self.value == other  # type: ignore[no-any-return]

        return super().__eq__(other)

    def __hash__(self) -> int:
        return hash(self.value)

    @classmethod
    def _missing_(cls, value: object) -> BaseEnum:
        warnings.warn(
            f"{value!r} is not a valid {cls.__name__} variant. "
            "Please report this issue on github at https://github.com/Jonxslays/wom.py/issues/new",
            UnknownEnumWarning,
            stacklevel=2,
        )
        return cls.Unknown  # type: ignore[attr-defined,no-any-return]

    @classmethod
    def at_random(cls: t.Type[T]) -> T:
        """Generates a random variant of this enum.

        Returns
        -------
        T
            The randomly generated enum.
        """
        return t.cast(T, random.choice(tuple(cls)))

at_random classmethod

at_random() -> T

Generates a random variant of this enum.

Returns:

Type Description
T

The randomly generated enum.

Source code in wom/enums.py
@classmethod
def at_random(cls: t.Type[T]) -> T:
    """Generates a random variant of this enum.

    Returns
    -------
    T
        The randomly generated enum.
    """
    return t.cast(T, random.choice(tuple(cls)))

BaseEnumMeta

Bases: EnumMeta

Metaclass for BaseEnum.

Source code in wom/enums.py
class BaseEnumMeta(EnumMeta):
    """Metaclass for [`BaseEnum`][wom.BaseEnum]."""

    def __iter__(cls) -> t.Iterator[t.Any]:
        """Iterates over the enum's members, skipping the `Unknown` variant."""
        members: t.Iterable[t.Any] = super().__iter__()
        return (member for member in members if member.value != "unknown")

__iter__

__iter__() -> t.Iterator[t.Any]

Iterates over the enum's members, skipping the Unknown variant.

Source code in wom/enums.py
def __iter__(cls) -> t.Iterator[t.Any]:
    """Iterates over the enum's members, skipping the `Unknown` variant."""
    members: t.Iterable[t.Any] = super().__iter__()
    return (member for member in members if member.value != "unknown")

Metric

Bases: BaseEnum

Represents all metrics including skills, bosses, activities, and computed metrics.

Source code in wom/enums.py
class Metric(BaseEnum):
    """Represents all metrics including skills, bosses, activities, and
    computed metrics.
    """

    # Skills
    Overall = "overall"
    Attack = "attack"
    Defence = "defence"
    Strength = "strength"
    Hitpoints = "hitpoints"
    Ranged = "ranged"
    Prayer = "prayer"
    Magic = "magic"
    Cooking = "cooking"
    Woodcutting = "woodcutting"
    Fletching = "fletching"
    Fishing = "fishing"
    Firemaking = "firemaking"
    Crafting = "crafting"
    Smithing = "smithing"
    Mining = "mining"
    Herblore = "herblore"
    Agility = "agility"
    Thieving = "thieving"
    Slayer = "slayer"
    Farming = "farming"
    Runecrafting = "runecrafting"
    Hunter = "hunter"
    Construction = "construction"
    Sailing = "sailing"

    # Activities
    LeaguePoints = "league_points"
    BountyHunterHunter = "bounty_hunter_hunter"
    BountyHunterRogue = "bounty_hunter_rogue"
    ClueScrollsAll = "clue_scrolls_all"
    ClueScrollsBeginner = "clue_scrolls_beginner"
    ClueScrollsEasy = "clue_scrolls_easy"
    ClueScrollsMedium = "clue_scrolls_medium"
    ClueScrollsHard = "clue_scrolls_hard"
    ClueScrollsElite = "clue_scrolls_elite"
    ClueScrollsMaster = "clue_scrolls_master"
    CollectionsLogged = "collections_logged"
    ColosseumGlory = "colosseum_glory"
    LastManStanding = "last_man_standing"
    PvpArena = "pvp_arena"
    SoulWarsZeal = "soul_wars_zeal"
    GuardiansOfTheRift = "guardians_of_the_rift"

    # Bosses
    AbyssalSire = "abyssal_sire"
    AlchemicalHydra = "alchemical_hydra"
    Amoxliatl = "amoxliatl"
    Araxxor = "araxxor"
    Artio = "artio"
    BarrowsChests = "barrows_chests"
    Brutus = "brutus"
    Bryophyta = "bryophyta"
    Callisto = "callisto"
    Calvarion = "calvarion"
    Cerberus = "cerberus"
    ChambersOfXeric = "chambers_of_xeric"
    ChambersOfXericChallenge = "chambers_of_xeric_challenge_mode"
    ChaosElemental = "chaos_elemental"
    ChaosFanatic = "chaos_fanatic"
    CommanderZilyana = "commander_zilyana"
    CorporealBeast = "corporeal_beast"
    CrazyArchaeologist = "crazy_archaeologist"
    DagannothPrime = "dagannoth_prime"
    DagannothRex = "dagannoth_rex"
    DagannothSupreme = "dagannoth_supreme"
    DerangedArchaeologist = "deranged_archaeologist"
    DoomOfMokhaiotl = "doom_of_mokhaiotl"
    DukeSucellus = "duke_sucellus"
    GeneralGraardor = "general_graardor"
    GiantMole = "giant_mole"
    GrotesqueGuardians = "grotesque_guardians"
    Hespori = "hespori"
    Hueycoatl = "the_hueycoatl"
    KalphiteQueen = "kalphite_queen"
    KingBlackDragon = "king_black_dragon"
    Kraken = "kraken"
    Kreearra = "kreearra"
    KrilTsutsaroth = "kril_tsutsaroth"
    LunarChests = "lunar_chests"
    MadAngel = "mad_angel"
    MaggotKing = "maggot_king"
    Mimic = "mimic"
    Nex = "nex"
    Nightmare = "nightmare"
    PhosanisNightmare = "phosanis_nightmare"
    Obor = "obor"
    PhantomMuspah = "phantom_muspah"
    Sarachnis = "sarachnis"
    Scorpia = "scorpia"
    Scurrius = "scurrius"
    ShellbaneGryphon = "shellbane_gryphon"
    Skotizo = "skotizo"
    SolHeredit = "sol_heredit"
    Spindel = "spindel"
    Tempoross = "tempoross"
    TheGauntlet = "the_gauntlet"
    TheCorruptedGauntlet = "the_corrupted_gauntlet"
    TheLeviathan = "the_leviathan"
    TheWhisperer = "the_whisperer"
    TheRoyalTitans = "the_royal_titans"
    TheatreOfBlood = "theatre_of_blood"
    TheatreOfBloodHard = "theatre_of_blood_hard_mode"
    ThermonuclearSmokeDevil = "thermonuclear_smoke_devil"
    TombsOfAmascut = "tombs_of_amascut"
    TombsOfAmascutExpert = "tombs_of_amascut_expert"
    TzKalZuk = "tzkal_zuk"
    TzTokJad = "tztok_jad"
    Vardorvis = "vardorvis"
    Venenatis = "venenatis"
    Vetion = "vetion"
    Vorkath = "vorkath"
    Wintertodt = "wintertodt"
    Yama = "yama"
    Zalcano = "zalcano"
    Zulrah = "zulrah"

    # Computed Metrics
    Ehp = "ehp"
    Ehb = "ehb"

    # Unknown
    Unknown = "unknown"

Period

Bases: BaseEnum

A period of time used by the API.

Source code in wom/enums.py
class Period(BaseEnum):
    """A period of time used by the API."""

    FiveMins = "five_min"
    Day = "day"
    Week = "week"
    Month = "month"
    Year = "year"
    Unknown = "unknown"

UnknownEnumWarning

Bases: UserWarning

Warns that the API returned an enum value the library does not recognize, which was coerced to the Unknown variant.

Filter or silence it like any other warning, e.g. warnings.filterwarnings("ignore", category=wom.UnknownEnumWarning).

Source code in wom/enums.py
class UnknownEnumWarning(UserWarning):
    """Warns that the API returned an enum value the library does not
    recognize, which was coerced to the `Unknown` variant.

    Filter or silence it like any other warning, e.g.
    `warnings.filterwarnings("ignore", category=wom.UnknownEnumWarning)`.
    """