Skip to content

FivePhase

Bases: MixEnum

The FivePhases (五行) Enum class.

Source code in src/ichingpy/enum/five_phase.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
class FivePhase(MixEnum):
    """The FivePhases (五行) Enum class."""

    METAL = 1, "金"
    WOOD = 2, "木"
    WATER = 3, "水"
    FIRE = 4, "火"
    EARTH = 5, "土"

    @property
    def generates(self) -> "FivePhase":
        """Return the phase generated by this phase."""
        return FivePhase[GENERATE_MAPPING[self.name]]

    @property
    def generated_by(self):
        """Return the phase that generates this phase."""
        # Reverse the generates_mapping
        reverse_mapping = {v: k for k, v in GENERATE_MAPPING.items()}
        return FivePhase[reverse_mapping[self.name]]

    @property
    def overcomes(self) -> "FivePhase":
        """Return the phase that overcomes this phase."""
        return FivePhase[OVERCOME_MAPPING[self.name]]

    @property
    def overcome_by(self) -> "FivePhase":
        """Return the phase that is overcome by this phase."""
        # Reverse the overcomes_mapping
        reverse_mapping = {v: k for k, v in OVERCOME_MAPPING.items()}
        return FivePhase[reverse_mapping[self.name]]

generated_by property

Return the phase that generates this phase.

generates property

Return the phase generated by this phase.

overcome_by property

Return the phase that is overcome by this phase.

overcomes property

Return the phase that overcomes this phase.