simfile.sm

Simfile & chart classes for SM files.

Attributes

SM_CHART_PROPERTIES

Pseudo-properties of .SM files, named how they are recognized internally.

SM_SIMFILE_PROPERTIES

All simfile-level properties of .SM files recognized by StepMania 5,

Classes

SMChart

SM implementation of BaseChart.

AttachedSMChart

SM implementation of BaseChart.

SMCharts

SM implementation of BaseCharts.

SMSimfile

SM implementation of BaseSimfile.

Module Contents

simfile.sm.SM_CHART_PROPERTIES = ('STEPSTYPE', 'DESCRIPTION', 'DIFFICULTY', 'METER', 'RADARVALUES', 'NOTES')

Pseudo-properties of .SM files, named how they are recognized internally.

This sequence is sorted in the same order dictated by the .SM format.

class simfile.sm.SMChart

Bases: simfile.base.BaseChart

SM implementation of BaseChart.

Unlike SSCChart, SM chart metadata is stored as a fixed list of 6 properties, so this class prohibits adding or deleting keys from its backing OrderedDict.

extradata: List[str] | None = None

If the chart data contains more than 6 components, the extra components will be stored in this attribute.

classmethod blank() SMChart

Generate a blank, valid chart populated with standard keys.

This should approximately match blank charts produced by the StepMania editor.

classmethod from_str(string: str) SMChart

Parse the serialized MSD value components of a NOTES property.

The string should contain six colon-separated components, corresponding to each of the base known properties documented in BaseChart. Any additional components will be stored in extradata.

Raises ValueError if the string contains fewer than six components.

Deprecated since version 2.1: This is now a less efficient version of from_msd(), which interoperates better with msdparser version 2.0.

classmethod from_msd(values: Sequence[str]) SMChart

Parse the MSD value components of a NOTES property.

The list should contain six strings, corresponding to each of the base known properties documented in BaseChart. Any additional components will be stored in extradata.

Raises ValueError if the list contains fewer than six components.

Deprecated since version 3.0: Use from_msd_parameter() instead. This method doesn’t preserve whitespace or comments.

classmethod from_msd_parameter(param: msdparser.MSDParameter) SMChart

Parse a NOTES parameter from an SM file.

The parameter should contain seven components, corresponding to the “NOTES” key followed by the six base known properties documented in BaseChart. Any additional components will be stored in extradata.

Raises ValueError if the parameter contains <7 components.

serialize(file)

Write the object to provided text file object as MSD.

abstract update(*args, **kwargs) None

Raises NotImplementedError.

abstract pop(property, default=None)

Raises NotImplementedError.

abstract popitem(last=True)

Raises NotImplementedError.

abstract values() frozenset[str]

Raises NotImplementedError.

class simfile.sm.AttachedSMChart

Bases: SMChart, simfile.base.BaseAttachedChart

SM implementation of BaseChart.

Unlike SSCChart, SM chart metadata is stored as a fixed list of 6 properties, so this class prohibits adding or deleting keys from its backing OrderedDict.

detach() SMChart
class simfile.sm.SMCharts(simfile: S, charts: Iterable[C] | None = None)

Bases: simfile.base.BaseCharts[AttachedSMChart, SMChart, SMSimfile]

SM implementation of BaseCharts.

List elements are SMChart instances.

append(chart: SMChart)

Append object to the end of the list.

extend(iterable: Iterable[SMChart]) None

Extend list by appending elements from the iterable.

simfile.sm.SM_SIMFILE_PROPERTIES = ('TITLE', 'SUBTITLE', 'ARTIST', 'TITLETRANSLIT', 'SUBTITLETRANSLIT', 'ARTISTTRANSLIT', 'GENRE',...

All simfile-level properties of .SM files recognized by StepMania 5, including aliases.

This sequence is sorted in the same order produced by the StepMania 5 editor.

class simfile.sm.SMSimfile(*, file: TextIO | None = None, string: str | None = None, tokens: Iterable[Tuple[msdparser.lexer.MSDToken, str]] | None = None, strict: bool = True)

Bases: simfile.base.BaseSimfile

SM implementation of BaseSimfile.

stops

Specialized property for STOPS that supports FREEZES as an alias.

classmethod blank() SMSimfile

Generate a blank, valid simfile populated with standard keys.

This should approximately match the simfile produced by the StepMania editor in a directory with no .sm or .ssc files.

property charts: SMCharts

List of charts associated with this simfile.