Module server.factions

Supreme Commander known faction definitions

Classes

class Faction (*args, **kwds)
Expand source code
@unique
class Faction(IntEnum):
    uef = 1
    aeon = 2
    cybran = 3
    seraphim = 4
    # This is not entirely accurate as 5 can also represent "random" in which
    # case nomad has value 6
    nomad = 5

    @staticmethod
    def from_string(value: str) -> "Faction":
        return Faction.__members__[value.lower()]

    @staticmethod
    def from_value(value: Union[str, int]) -> "Faction":
        if isinstance(value, str):
            return Faction.from_string(value)
        elif isinstance(value, int):
            return Faction(value)

        raise TypeError(f"Unsupported faction type {type(value)}!")

Enum where members are also (and must be) ints

Ancestors

  • enum.IntEnum
  • builtins.int
  • enum.ReprEnum
  • enum.Enum

Class variables

var aeon

The type of the None singleton.

var cybran

The type of the None singleton.

var nomad

The type of the None singleton.

var seraphim

The type of the None singleton.

var uef

The type of the None singleton.

Static methods

def from_string(value: str) ‑> Faction
Expand source code
@staticmethod
def from_string(value: str) -> "Faction":
    return Faction.__members__[value.lower()]
def from_value(value: str | int) ‑> Faction
Expand source code
@staticmethod
def from_value(value: Union[str, int]) -> "Faction":
    if isinstance(value, str):
        return Faction.from_string(value)
    elif isinstance(value, int):
        return Faction(value)

    raise TypeError(f"Unsupported faction type {type(value)}!")