Mods API

Model osu! mods as a ruleset-bound set, the classic legacy bitfield, or ruleset-agnostic (intermode) identities.

Core types

class parsecore.Mods.GameMode(*values)[source]

Bases: IntEnum

One of the four osu! rulesets (osu!, taiko, catch, mania).

Osu = 0
Taiko = 1
Catch = 2
Mania = 3
as_str()[source]

Return the ruleset’s short name (osu, taiko, fruits, mania).

Return type:

str

classmethod from_str(s)[source]

Return the GameMode for a short ruleset name.

Parameters:

s (str) – The ruleset name (e.g. osu or fruits).

Return type:

GameMode

Returns:

The matching ruleset.

Raises:

ValueError – If the name is not recognised.

class parsecore.Mods.GameModKind(*values)[source]

Bases: Enum

The category of a mod (difficulty reduction/increase, conversion, automation, …).

DifficultyReduction = 'DifficultyReduction'
DifficultyIncrease = 'DifficultyIncrease'
Conversion = 'Conversion'
Automation = 'Automation'
Fun = 'Fun'
System = 'System'
rank()[source]

Return a sort rank so mods group by kind in a stable order.

Return type:

int

Returns:

An integer ordering used when sorting mods for display.

class parsecore.Mods.Acronym(s)[source]

Bases: object

A validated mod acronym: two to four uppercase letters or digits.

Parameters:

s (str)

classmethod from_str(s)[source]

Parse an acronym from a string.

Parameters:

s (str) – The acronym text.

Return type:

Acronym

Returns:

The parsed acronym.

Raises:

ValueError – If the text is not a valid acronym.

as_str()[source]

Return the acronym as a plain string.

Return type:

str

Single mod

class parsecore.Mods.GameMod(inner)[source]

Bases: object

A single mod with its settings, tied to one ruleset.

Wraps a concrete generated mod (see generated_mods) and forwards its acronym, kind, legacy bit and incompatibilities.

classmethod new(acronym, mode)[source]

Create a mod from an acronym and ruleset.

Parameters:
  • acronym (str | Acronym) – The mod acronym (e.g. HD).

  • mode (GameMode) – The ruleset the mod belongs to.

Return type:

GameMod

Returns:

The constructed mod (an unknown mod if the acronym is unrecognised).

property inner

Return the wrapped concrete mod instance.

property variant: str

Return the concrete class name of the wrapped mod.

acronym()[source]

Return the mod’s acronym.

Return type:

Acronym

description()[source]

Return the mod’s human-readable description.

Return type:

str

kind()[source]

Return the mod’s kind.

Return type:

GameModKind

bits()[source]

Return the mod’s legacy bit value, or None if it has none.

Return type:

int | None

incompatible_mods()[source]

Return the acronyms of mods incompatible with this one.

Return type:

list

mode()[source]

Return the ruleset this mod belongs to, or None if generic.

Return type:

GameMode | None

intermode()[source]

Return the ruleset-agnostic (intermode) form of this mod.

into_simple()[source]

Return the settings-only GameModSimple form of this mod.

is_unknown()[source]

Return whether this is an unrecognised mod.

Return type:

bool

to_dict()[source]

Serialise the mod to a plain dict.

Return type:

dict

Returns:

A dict with the acronym and any non-default settings.

classmethod from_dict(data, mode=None, deny_unknown_fields=False)[source]

Deserialise a mod from a dict.

Parameters:
  • data (dict) – The serialised mapping.

  • mode (GameMode | None, default: None) – The ruleset to resolve the acronym in.

  • deny_unknown_fields (bool, default: False) – If True, reject unrecognised setting keys.

Return type:

GameMod

Returns:

The reconstructed mod.

to_json()[source]

Return the mod serialised as a JSON string.

Return type:

str

classmethod from_json(s, mode=None, deny_unknown_fields=False)[source]

Deserialise a mod from a JSON string.

Parameters:
  • s (str) – The JSON text.

  • mode (GameMode | None, default: None) – The ruleset to resolve the acronym in.

  • deny_unknown_fields (bool, default: False) – If True, reject unrecognised setting keys.

Return type:

GameMod

Returns:

The reconstructed mod.

static AccuracyChallengeCatch(**kwargs)

Construct this mod for the given ruleset.

static AccuracyChallengeMania(**kwargs)

Construct this mod for the given ruleset.

static AccuracyChallengeOsu(**kwargs)

Construct this mod for the given ruleset.

static AccuracyChallengeTaiko(**kwargs)

Construct this mod for the given ruleset.

static AdaptiveSpeedMania(**kwargs)

Construct this mod for the given ruleset.

static AdaptiveSpeedOsu(**kwargs)

Construct this mod for the given ruleset.

static AdaptiveSpeedTaiko(**kwargs)

Construct this mod for the given ruleset.

static AlternateOsu(**kwargs)

Construct this mod for the given ruleset.

static ApproachDifferentOsu(**kwargs)

Construct this mod for the given ruleset.

static AutopilotOsu(**kwargs)

Construct this mod for the given ruleset.

static AutoplayCatch(**kwargs)

Construct this mod for the given ruleset.

static AutoplayMania(**kwargs)

Construct this mod for the given ruleset.

static AutoplayOsu(**kwargs)

Construct this mod for the given ruleset.

static AutoplayTaiko(**kwargs)

Construct this mod for the given ruleset.

static BarrelRollOsu(**kwargs)

Construct this mod for the given ruleset.

static BlindsOsu(**kwargs)

Construct this mod for the given ruleset.

static BloomOsu(**kwargs)

Construct this mod for the given ruleset.

static BubblesOsu(**kwargs)

Construct this mod for the given ruleset.

static CinemaCatch(**kwargs)

Construct this mod for the given ruleset.

static CinemaMania(**kwargs)

Construct this mod for the given ruleset.

static CinemaOsu(**kwargs)

Construct this mod for the given ruleset.

static CinemaTaiko(**kwargs)

Construct this mod for the given ruleset.

static ClassicCatch(**kwargs)

Construct this mod for the given ruleset.

static ClassicMania(**kwargs)

Construct this mod for the given ruleset.

static ClassicOsu(**kwargs)

Construct this mod for the given ruleset.

static ClassicTaiko(**kwargs)

Construct this mod for the given ruleset.

static ConstantSpeedMania(**kwargs)

Construct this mod for the given ruleset.

static ConstantSpeedTaiko(**kwargs)

Construct this mod for the given ruleset.

static CoverMania(**kwargs)

Construct this mod for the given ruleset.

static DaycoreCatch(**kwargs)

Construct this mod for the given ruleset.

static DaycoreMania(**kwargs)

Construct this mod for the given ruleset.

static DaycoreOsu(**kwargs)

Construct this mod for the given ruleset.

static DaycoreTaiko(**kwargs)

Construct this mod for the given ruleset.

static DeflateOsu(**kwargs)

Construct this mod for the given ruleset.

static DepthOsu(**kwargs)

Construct this mod for the given ruleset.

static DifficultyAdjustCatch(**kwargs)

Construct this mod for the given ruleset.

static DifficultyAdjustMania(**kwargs)

Construct this mod for the given ruleset.

static DifficultyAdjustOsu(**kwargs)

Construct this mod for the given ruleset.

static DifficultyAdjustTaiko(**kwargs)

Construct this mod for the given ruleset.

static DoubleTimeCatch(**kwargs)

Construct this mod for the given ruleset.

static DoubleTimeMania(**kwargs)

Construct this mod for the given ruleset.

static DoubleTimeOsu(**kwargs)

Construct this mod for the given ruleset.

static DoubleTimeTaiko(**kwargs)

Construct this mod for the given ruleset.

static DualStagesMania(**kwargs)

Construct this mod for the given ruleset.

static EasyCatch(**kwargs)

Construct this mod for the given ruleset.

static EasyMania(**kwargs)

Construct this mod for the given ruleset.

static EasyOsu(**kwargs)

Construct this mod for the given ruleset.

static EasyTaiko(**kwargs)

Construct this mod for the given ruleset.

static EightKeysMania(**kwargs)

Construct this mod for the given ruleset.

static FadeInMania(**kwargs)

Construct this mod for the given ruleset.

static FiveKeysMania(**kwargs)

Construct this mod for the given ruleset.

static FlashlightCatch(**kwargs)

Construct this mod for the given ruleset.

static FlashlightMania(**kwargs)

Construct this mod for the given ruleset.

static FlashlightOsu(**kwargs)

Construct this mod for the given ruleset.

static FlashlightTaiko(**kwargs)

Construct this mod for the given ruleset.

static FloatingFruitsCatch(**kwargs)

Construct this mod for the given ruleset.

static FourKeysMania(**kwargs)

Construct this mod for the given ruleset.

static FreezeFrameOsu(**kwargs)

Construct this mod for the given ruleset.

static GrowOsu(**kwargs)

Construct this mod for the given ruleset.

static HalfTimeCatch(**kwargs)

Construct this mod for the given ruleset.

static HalfTimeMania(**kwargs)

Construct this mod for the given ruleset.

static HalfTimeOsu(**kwargs)

Construct this mod for the given ruleset.

static HalfTimeTaiko(**kwargs)

Construct this mod for the given ruleset.

static HardRockCatch(**kwargs)

Construct this mod for the given ruleset.

static HardRockMania(**kwargs)

Construct this mod for the given ruleset.

static HardRockOsu(**kwargs)

Construct this mod for the given ruleset.

static HardRockTaiko(**kwargs)

Construct this mod for the given ruleset.

static HiddenCatch(**kwargs)

Construct this mod for the given ruleset.

static HiddenMania(**kwargs)

Construct this mod for the given ruleset.

static HiddenOsu(**kwargs)

Construct this mod for the given ruleset.

static HiddenTaiko(**kwargs)

Construct this mod for the given ruleset.

static HoldOffMania(**kwargs)

Construct this mod for the given ruleset.

static InvertMania(**kwargs)

Construct this mod for the given ruleset.

static MagnetisedOsu(**kwargs)

Construct this mod for the given ruleset.

static MirrorCatch(**kwargs)

Construct this mod for the given ruleset.

static MirrorMania(**kwargs)

Construct this mod for the given ruleset.

static MirrorOsu(**kwargs)

Construct this mod for the given ruleset.

static MovingFastCatch(**kwargs)

Construct this mod for the given ruleset.

static MutedCatch(**kwargs)

Construct this mod for the given ruleset.

static MutedMania(**kwargs)

Construct this mod for the given ruleset.

static MutedOsu(**kwargs)

Construct this mod for the given ruleset.

static MutedTaiko(**kwargs)

Construct this mod for the given ruleset.

static NightcoreCatch(**kwargs)

Construct this mod for the given ruleset.

static NightcoreMania(**kwargs)

Construct this mod for the given ruleset.

static NightcoreOsu(**kwargs)

Construct this mod for the given ruleset.

static NightcoreTaiko(**kwargs)

Construct this mod for the given ruleset.

static NineKeysMania(**kwargs)

Construct this mod for the given ruleset.

static NoFailCatch(**kwargs)

Construct this mod for the given ruleset.

static NoFailMania(**kwargs)

Construct this mod for the given ruleset.

static NoFailOsu(**kwargs)

Construct this mod for the given ruleset.

static NoFailTaiko(**kwargs)

Construct this mod for the given ruleset.

static NoReleaseMania(**kwargs)

Construct this mod for the given ruleset.

static NoScopeCatch(**kwargs)

Construct this mod for the given ruleset.

static NoScopeOsu(**kwargs)

Construct this mod for the given ruleset.

static OneKeyMania(**kwargs)

Construct this mod for the given ruleset.

static PerfectCatch(**kwargs)

Construct this mod for the given ruleset.

static PerfectMania(**kwargs)

Construct this mod for the given ruleset.

static PerfectOsu(**kwargs)

Construct this mod for the given ruleset.

static PerfectTaiko(**kwargs)

Construct this mod for the given ruleset.

static RandomMania(**kwargs)

Construct this mod for the given ruleset.

static RandomOsu(**kwargs)

Construct this mod for the given ruleset.

static RandomTaiko(**kwargs)

Construct this mod for the given ruleset.

static RelaxCatch(**kwargs)

Construct this mod for the given ruleset.

static RelaxOsu(**kwargs)

Construct this mod for the given ruleset.

static RelaxTaiko(**kwargs)

Construct this mod for the given ruleset.

static RepelOsu(**kwargs)

Construct this mod for the given ruleset.

static ScoreV2Catch(**kwargs)

Construct this mod for the given ruleset.

static ScoreV2Mania(**kwargs)

Construct this mod for the given ruleset.

static ScoreV2Osu(**kwargs)

Construct this mod for the given ruleset.

static ScoreV2Taiko(**kwargs)

Construct this mod for the given ruleset.

static SevenKeysMania(**kwargs)

Construct this mod for the given ruleset.

static SimplifiedRhythmTaiko(**kwargs)

Construct this mod for the given ruleset.

static SingleTapOsu(**kwargs)

Construct this mod for the given ruleset.

static SingleTapTaiko(**kwargs)

Construct this mod for the given ruleset.

static SixKeysMania(**kwargs)

Construct this mod for the given ruleset.

static SpinInOsu(**kwargs)

Construct this mod for the given ruleset.

static SpunOutOsu(**kwargs)

Construct this mod for the given ruleset.

static StrictTrackingOsu(**kwargs)

Construct this mod for the given ruleset.

static SuddenDeathCatch(**kwargs)

Construct this mod for the given ruleset.

static SuddenDeathMania(**kwargs)

Construct this mod for the given ruleset.

static SuddenDeathOsu(**kwargs)

Construct this mod for the given ruleset.

static SuddenDeathTaiko(**kwargs)

Construct this mod for the given ruleset.

static SwapTaiko(**kwargs)

Construct this mod for the given ruleset.

static SynesthesiaOsu(**kwargs)

Construct this mod for the given ruleset.

static TargetPracticeOsu(**kwargs)

Construct this mod for the given ruleset.

static TenKeysMania(**kwargs)

Construct this mod for the given ruleset.

static ThreeKeysMania(**kwargs)

Construct this mod for the given ruleset.

static TouchDeviceOsu(**kwargs)

Construct this mod for the given ruleset.

static TraceableOsu(**kwargs)

Construct this mod for the given ruleset.

static TransformOsu(**kwargs)

Construct this mod for the given ruleset.

static TwoKeysMania(**kwargs)

Construct this mod for the given ruleset.

static UnknownCatch(**kwargs)

Construct this mod for the given ruleset.

static UnknownMania(**kwargs)

Construct this mod for the given ruleset.

static UnknownMod(**kwargs)

Construct this mod for the given ruleset.

static UnknownOsu(**kwargs)

Construct this mod for the given ruleset.

static UnknownTaiko(**kwargs)

Construct this mod for the given ruleset.

static WiggleOsu(**kwargs)

Construct this mod for the given ruleset.

static WindDownCatch(**kwargs)

Construct this mod for the given ruleset.

static WindDownMania(**kwargs)

Construct this mod for the given ruleset.

static WindDownOsu(**kwargs)

Construct this mod for the given ruleset.

static WindDownTaiko(**kwargs)

Construct this mod for the given ruleset.

static WindUpCatch(**kwargs)

Construct this mod for the given ruleset.

static WindUpMania(**kwargs)

Construct this mod for the given ruleset.

static WindUpOsu(**kwargs)

Construct this mod for the given ruleset.

static WindUpTaiko(**kwargs)

Construct this mod for the given ruleset.

clock_rate()

Return a single mod’s clock-rate multiplier, or None.

Return type:

float | None

class parsecore.Mods.GameModIntermode(*values)[source]

Bases: Enum

Every known mod as a ruleset-agnostic identity.

Each member carries the acronym, legacy bit and kind shared by that mod across all rulesets.

AccuracyChallenge = 'AccuracyChallenge'
AdaptiveSpeed = 'AdaptiveSpeed'
Alternate = 'Alternate'
ApproachDifferent = 'ApproachDifferent'
Autopilot = 'Autopilot'
Autoplay = 'Autoplay'
BarrelRoll = 'BarrelRoll'
Blinds = 'Blinds'
Bloom = 'Bloom'
Bubbles = 'Bubbles'
Cinema = 'Cinema'
Classic = 'Classic'
ConstantSpeed = 'ConstantSpeed'
Cover = 'Cover'
Daycore = 'Daycore'
Deflate = 'Deflate'
Depth = 'Depth'
DifficultyAdjust = 'DifficultyAdjust'
DoubleTime = 'DoubleTime'
DualStages = 'DualStages'
Easy = 'Easy'
EightKeys = 'EightKeys'
FadeIn = 'FadeIn'
FiveKeys = 'FiveKeys'
Flashlight = 'Flashlight'
FloatingFruits = 'FloatingFruits'
FourKeys = 'FourKeys'
FreezeFrame = 'FreezeFrame'
Grow = 'Grow'
HalfTime = 'HalfTime'
HardRock = 'HardRock'
Hidden = 'Hidden'
HoldOff = 'HoldOff'
Invert = 'Invert'
Magnetised = 'Magnetised'
Mirror = 'Mirror'
MovingFast = 'MovingFast'
Muted = 'Muted'
Nightcore = 'Nightcore'
NineKeys = 'NineKeys'
NoFail = 'NoFail'
NoRelease = 'NoRelease'
NoScope = 'NoScope'
OneKey = 'OneKey'
Perfect = 'Perfect'
Random = 'Random'
Relax = 'Relax'
Repel = 'Repel'
ScoreV2 = 'ScoreV2'
SevenKeys = 'SevenKeys'
SimplifiedRhythm = 'SimplifiedRhythm'
SingleTap = 'SingleTap'
SixKeys = 'SixKeys'
SpinIn = 'SpinIn'
SpunOut = 'SpunOut'
StrictTracking = 'StrictTracking'
SuddenDeath = 'SuddenDeath'
Swap = 'Swap'
Synesthesia = 'Synesthesia'
TargetPractice = 'TargetPractice'
TenKeys = 'TenKeys'
ThreeKeys = 'ThreeKeys'
TouchDevice = 'TouchDevice'
Traceable = 'Traceable'
Transform = 'Transform'
TwoKeys = 'TwoKeys'
Wiggle = 'Wiggle'
WindDown = 'WindDown'
WindUp = 'WindUp'
Unknown = 'Unknown'
acronym()[source]

Return the mod’s acronym.

Return type:

Acronym

bits()[source]

Return the mod’s legacy bit value, or None if it has none.

Return type:

int | None

kind()[source]

Return the mod’s kind.

Return type:

GameModKind

classmethod from_acronym(acronym)[source]

Return the mod for an acronym, or an unknown mod.

Parameters:

acronym – The acronym to resolve.

Return type:

GameModIntermode | UnknownGameMod

Returns:

The matching GameModIntermode, or an UnknownGameMod.

classmethod try_from_bits(bits)[source]

Return the single mod matching a legacy bit, if any.

Parameters:

bits (int) – A single legacy mod bit.

Return type:

GameModIntermode | None

Returns:

The matching mod, or None if the bit is unknown.

description()

Return the mod’s human-readable description.

Return type:

str

as_simple()

Return the settings-free GameModSimple form of the mod.

class parsecore.Mods.GameModSimple(acronym, settings=<factory>)[source]

Bases: object

A mod identified only by acronym and free-form settings, without a ruleset.

Parameters:
acronym: Acronym
settings: dict[str, SettingSimple]
class parsecore.Mods.SettingSimple(value)[source]

Bases: object

A single mod setting value that may be a bool, float or string.

Parameters:

value (bool | float | str)

property value: bool | float | str

Return the raw underlying value.

is_bool()[source]

Return whether the value is a boolean.

Return type:

bool

is_float()[source]

Return whether the value is a float.

Return type:

bool

is_str()[source]

Return whether the value is a string.

Return type:

bool

as_bool()[source]

Return the value as a bool.

Raises:

TypeError – If the value is not a boolean.

Return type:

bool

as_float()[source]

Return the value as a float.

Raises:

TypeError – If the value is not a float.

Return type:

float

as_str()[source]

Return the value as a string.

Raises:

TypeError – If the value is not a string.

Return type:

str

Mod collections

class parsecore.Mods.GameMods(mods=())[source]

Bases: object

An ordered, de-duplicated collection of mods for a single ruleset.

Parameters:

mods (Iterable[GameMod])

insert(gamemod)[source]

Add a mod, ignoring it if its acronym is already present.

Parameters:

gamemod (GameMod) – The mod to add.

Return type:

None

remove(gamemod)[source]

Remove a specific mod.

Parameters:

gamemod (GameMod) – The mod to remove.

Return type:

bool

Returns:

True if it was present and removed.

remove_acronym(acronym)[source]

Remove the mod with the given acronym.

Parameters:

acronym (str | Acronym) – The acronym to remove.

Return type:

bool

Returns:

True if a mod was removed.

extend(mods)[source]

Add every mod from an iterable.

Parameters:

mods (Iterable[GameMod]) – The mods to add.

Return type:

None

clear()[source]

Remove all mods.

Return type:

None

is_empty()[source]

Return whether no mods are present.

Return type:

bool

len()[source]

Return the number of mods.

Return type:

int

contains(gamemod)[source]

Return whether a specific mod is present.

Parameters:

gamemod (GameMod) – The mod to look for.

Return type:

bool

contains_acronym(acronym)[source]

Return whether a mod with the given acronym is present.

Parameters:

acronym (str | Acronym) – The acronym to look for.

Return type:

bool

get(acronym, mode=None)[source]

Return the contained mod with the given acronym, or None.

Parameters:
  • acronym (str | Acronym) – The acronym to look up.

  • mode (GameMode | None, default: None) – The ruleset (unused for lookup; kept for API symmetry).

Return type:

GameMod | None

Returns:

The matching mod, or None.

bits()[source]

Return the combined legacy bitfield of all contained mods.

Return type:

int

checked_bits()[source]

Return the legacy bitfield, or None if any mod has no legacy bit.

Return type:

int | None

to_intermode()[source]

Return the ruleset-agnostic (intermode) form of this collection.

classmethod from_iter(mods)[source]

Create a collection from an iterable of mods.

Parameters:

mods (Iterable[GameMod]) – The mods to include.

Return type:

GameMods

Returns:

The new collection.

as_legacy()

Return the mods as a GameModsLegacy bitfield.

clock_rate()

Return the effective clock rate of the mods, or None if indeterminate.

Return type:

float | None

contains_any(mods)
contains_intermode(m)
static from_acronyms(mode=None)

Parse a ruleset-bound collection from an acronym string.

Parameters:
  • s (str) – The acronyms (e.g. HDDT).

  • mode (default: None) – The ruleset to resolve them in.

Return type:

GameMods

Returns:

The parsed collection.

static from_intermode(mode)

Resolve intermode mods to a ruleset-bound collection.

Return type:

GameMods

classmethod from_json(s, mode=None, deny_unknown_fields=False)

Parse ruleset-bound mods from a JSON string.

Return type:

GameMods

Parameters:
  • s (str)

  • deny_unknown_fields (bool)

intersection(other)

Return the mods present in both collections.

Return type:

GameMods

Parameters:

other (GameMods)

intersects(other)

Return whether the two collections share any mod.

Return type:

bool

Parameters:

other (GameMods)

is_valid()

Return whether the mod combination is internally consistent.

Return type:

bool

remove_all(mods)
remove_all_intermode(mods)
remove_intermode(m)
sanitize()

Remove mutually incompatible mods in place.

Return type:

None

to_json()

Return the mods as a JSON string.

Return type:

str

try_as_legacy()

Return the legacy bitfield form, or None if not representable.

static try_from_intermode(mode)

Resolve intermode mods to a ruleset, or None on failure.

Return type:

GameMods | None

class parsecore.Mods.GameModsIntermode(mods=())[source]

Bases: object

An ordered set of ruleset-agnostic mods (identified by acronym only).

Parameters:

mods (Iterable[GameModIntermode])

insert(gamemod)[source]

Add a mod, ignoring duplicates by acronym.

Return type:

None

Parameters:

gamemod (GameModIntermode)

remove(gamemod)[source]

Remove a mod; return whether it was present.

Return type:

bool

Parameters:

gamemod (GameModIntermode)

remove_all(mods)

Remove every given mod.

Return type:

None

extend(mods)[source]

Add every mod from an iterable.

Return type:

None

Parameters:

mods (Iterable[GameModIntermode])

clear()[source]

Remove all mods.

Return type:

None

is_empty()[source]

Return whether no mods are present.

Return type:

bool

len()[source]

Return the number of mods.

Return type:

int

contains(gamemod)[source]

Return whether a specific mod is present.

Return type:

bool

Parameters:

gamemod (GameModIntermode | str)

contains_acronym(acronym)[source]

Return whether a mod with the given acronym is present.

Return type:

bool

Parameters:

acronym (Acronym | str)

bits()[source]

Return the combined legacy bitfield of all mods.

Return type:

int

checked_bits()[source]

Return the legacy bitfield, or None if any mod lacks one.

Return type:

int | None

intersection(other)[source]

Return the mods present in both collections.

Return type:

GameModsIntermode

Parameters:

other (GameModsIntermode)

union(other)[source]

Return the union with another collection.

Return type:

GameModsIntermode

Parameters:

other (GameModsIntermode)

difference(other)[source]

Return the mods in this collection but not the other.

Return type:

GameModsIntermode

Parameters:

other (GameModsIntermode)

classmethod from_bits(bits)[source]

Create the collection from a legacy bitfield.

Parameters:

bits (int) – The legacy mod bitfield.

Return type:

GameModsIntermode

Returns:

The parsed collection (NC implies DT, PF implies SD, etc.).

classmethod from_acronyms(acronyms)[source]

Create the collection from an iterable of acronyms.

Parameters:

acronyms (Iterable[str | Acronym]) – The acronyms or acronym objects.

Return type:

GameModsIntermode

Returns:

The parsed collection.

classmethod parse(s)[source]

Parse the collection from a concatenated acronym string.

Parameters:

s (str) – The acronyms (e.g. HDNC).

Return type:

GameModsIntermode

Returns:

The parsed collection.

as_legacy()

Return the mods as a legacy bitfield.

Return type:

GameModsLegacy

contains_any(mods)

Return whether any of the given mods is present.

Return type:

bool

classmethod from_acronyms_iter(acronyms)

Parse intermode mods from an iterable of acronyms.

Return type:

GameModsIntermode

classmethod from_acronyms_str(s)

Parse intermode mods from a concatenated acronym string.

Return type:

GameModsIntermode

Parameters:

s (str)

classmethod from_json(s)

Parse intermode mods from a JSON string.

Return type:

GameModsIntermode

Parameters:

s (str)

intersects(other)

Return whether the two collections share any mod.

Return type:

bool

legacy_clock_rate()

Return the clock rate from the legacy bit representation.

Return type:

float

to_json()

Return the intermode mods as a JSON string.

Return type:

str

try_as_legacy()

Return the legacy bitfield, or None if not representable.

classmethod try_from_acronyms(s)

Parse acronyms leniently, returning None on failure.

Parameters:

s (str)

try_with_mode(mode)

Resolve to a ruleset, or None on failure.

with_mode(mode)

Resolve these intermode mods to the given ruleset.

class parsecore.Mods.GameModsLegacy(bits=0)[source]

Bases: object

The classic osu! mod bitfield (NF=1, EZ=2, HD=8, HR=16, DT=64, …).

Parameters:

bits (int)

NoMod: GameModsLegacy = GameModsLegacy(0)
NoFail: GameModsLegacy = GameModsLegacy(1)
Easy: GameModsLegacy = GameModsLegacy(2)
TouchDevice: GameModsLegacy = GameModsLegacy(4)
Hidden: GameModsLegacy = GameModsLegacy(8)
HardRock: GameModsLegacy = GameModsLegacy(16)
SuddenDeath: GameModsLegacy = GameModsLegacy(32)
DoubleTime: GameModsLegacy = GameModsLegacy(64)
Relax: GameModsLegacy = GameModsLegacy(128)
HalfTime: GameModsLegacy = GameModsLegacy(256)
Nightcore: GameModsLegacy = GameModsLegacy(576)
Flashlight: GameModsLegacy = GameModsLegacy(1024)
Autoplay: GameModsLegacy = GameModsLegacy(2048)
SpunOut: GameModsLegacy = GameModsLegacy(4096)
Autopilot: GameModsLegacy = GameModsLegacy(8192)
Perfect: GameModsLegacy = GameModsLegacy(16416)
Key4: GameModsLegacy = GameModsLegacy(32768)
Key5: GameModsLegacy = GameModsLegacy(65536)
Key6: GameModsLegacy = GameModsLegacy(131072)
Key7: GameModsLegacy = GameModsLegacy(262144)
Key8: GameModsLegacy = GameModsLegacy(524288)
FadeIn: GameModsLegacy = GameModsLegacy(1048576)
Random: GameModsLegacy = GameModsLegacy(2097152)
Cinema: GameModsLegacy = GameModsLegacy(4194304)
Target: GameModsLegacy = GameModsLegacy(8388608)
Key9: GameModsLegacy = GameModsLegacy(16777216)
KeyCoop: GameModsLegacy = GameModsLegacy(33554432)
Key1: GameModsLegacy = GameModsLegacy(67108864)
Key3: GameModsLegacy = GameModsLegacy(134217728)
Key2: GameModsLegacy = GameModsLegacy(268435456)
ScoreV2: GameModsLegacy = GameModsLegacy(536870912)
Mirror: GameModsLegacy = GameModsLegacy(1073741824)
classmethod from_bits(bits)[source]

Create the bitfield from an integer value.

Return type:

GameModsLegacy

Parameters:

bits (int)

classmethod parse(s)[source]

Parse the bitfield from a concatenated acronym string (lenient).

Return type:

GameModsLegacy

Parameters:

s (str)

classmethod parse_strict(s)[source]

Parse the bitfield from acronyms, rejecting unknown ones.

Raises:

ValueError – If an acronym is not a valid legacy mod.

Return type:

GameModsLegacy

Parameters:

s (str)

bits()[source]

Return the raw integer bits.

Return type:

int

is_empty()[source]

Return whether no mods are set (NoMod).

Return type:

bool

len()[source]

Return the number of set mods.

Return type:

int

contains(other)[source]

Return whether all of other’s bits are set.

Return type:

bool

Parameters:

other (GameModsLegacy)

intersects(other)[source]

Return whether any of other’s bits are set.

Return type:

bool

Parameters:

other (GameModsLegacy)

clock_rate()[source]

Return the clock-rate multiplier implied by DT/NC/HT.

Return type:

float

iter()[source]

Iterate the individual set mods as single-bit values.

Return type:

Iterator[GameModsLegacy]

named_mods()[source]

Return the human names of the set mods.

Return type:

list[str]

acronyms()[source]

Return the acronyms of the set mods.

Return type:

list[str]

difference(other)

Return this bitfield with the other’s bits cleared.

Return type:

GameModsLegacy

Parameters:

other (GameModsLegacy)

intersection(other)

Return the bitwise intersection.

Return type:

GameModsLegacy

Parameters:

other (GameModsLegacy)

remove(other)

Clear the given bits in place.

Return type:

None

Parameters:

other (GameModsLegacy)

symmetric_difference(other)

Return the bitwise symmetric difference.

Return type:

GameModsLegacy

Parameters:

other (GameModsLegacy)

to_intermode()

Return the intermode form of the legacy bitfield.

static try_from_bits_strict(bits)

Parse bits, returning None if any bit is unknown.

Parameters:

bits (int)

union(other)

Return the bitwise union.

Return type:

GameModsLegacy

Parameters:

other (GameModsLegacy)

All concrete mods

Every mod has a concrete, ruleset-specific class. They share the interface of _ModBase (acronym, description, kind, legacy bit).

EasyOsu([retries])

The EZ mod for osu! (difficulty reduction).

NoFailOsu()

The NF mod for osu! (difficulty reduction).

HalfTimeOsu([speed_change, adjust_pitch])

The HT mod for osu! (difficulty reduction).

HardRockOsu()

The HR mod for osu! (difficulty increase).

SuddenDeathOsu([fail_on_slider_tail, restart])

The SD mod for osu! (difficulty increase).

PerfectOsu([restart])

The PF mod for osu! (difficulty increase).

DoubleTimeOsu([speed_change, adjust_pitch])

The DT mod for osu! (difficulty increase).

NightcoreOsu([speed_change])

The NC mod for osu! (difficulty increase).

HiddenOsu([only_fade_approach_circles])

The HD mod for osu! (difficulty increase).

FlashlightOsu([follow_delay, ...])

The FL mod for osu! (difficulty increase).

RelaxOsu()

The RX mod for osu! (automation).

AutopilotOsu()

The AP mod for osu! (automation).

SpunOutOsu()

The SO mod for osu! (automation).

ClassicOsu([no_slider_head_accuracy, ...])

The CL mod for osu! (conversion).

Tip

The catch, taiko and mania variants follow the same naming pattern, e.g. DoubleTimeCatch, HardRockMania, HiddenTaiko.