VersionInfo

class mobase.VersionInfo
class mobase.VersionInfo(value: str, scheme: VersionScheme = VersionScheme.DISCOVER)
class mobase.VersionInfo(major: int, minor: int, subminor: int, subsubminor: int, release_type: ReleaseType = ReleaseType.FINAL)
class mobase.VersionInfo(major: int, minor: int, subminor: int, release_type: ReleaseType = ReleaseType.FINAL)

Bases: object

Represents the version of a mod or plugin.

Methods Summary

canonicalString()

rtype:

str

clear()

Resets this VersionInfo to an invalid version.

displayString([forced_segments])

rtype:

str

isValid()

rtype:

bool

parse(value[, scheme, is_manual])

Update this VersionInfo by parsing the given string using the given scheme.

scheme()

rtype:

VersionScheme

Methods Documentation

canonicalString()
Return type:

str

Returns:

A canonical string representing this version, that can be stored and then parsed using the parse() method.

clear()

Resets this VersionInfo to an invalid version.

Return type:

None

displayString(forced_segments=2)
Return type:

str

Parameters:

forced_segments – The number of version segments to display even if the version is 0. 1 is major, 2 is major and minor, etc. The only implemented ranges are (-inf,2] for major/minor, [3] for major/minor/subminor, and [4,inf) for major/minor/subminor/subsubminor. This only versions with a regular scheme.

Returns:

A string for display to the user. The returned string may not contain enough information to reconstruct this version info.

isValid()
Return type:

bool

Returns:

True if this VersionInfo is valid, False otherwise.

parse(value, scheme=VersionScheme.None, is_manual=False)

Update this VersionInfo by parsing the given string using the given scheme.

Return type:

None

Parameters:
  • value – String to parse.

  • scheme – Scheme to use to parse the string.

  • is_manual – True if the given string should be treated as user input.

scheme()
Return type:

VersionScheme

Returns:

The version scheme in effect for this VersionInfo.