summaryrefslogtreecommitdiff
path: root/blc2/constants.py
blob: ca43367dba0fadbe2d50ebd16eda8584b82f2265 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
"""Constants module. 

Contains some constants used throughout. 
"""

class _Infinity:
    """Class for the singleton INFTY.

    We assume that this is only used in time-related operations, i.e. that numbers involved
    are nonnegative.
    """
    INFTY = None

    def __repr__(self):
        return "infty"

    def __str__(self):
        return "infty"

    def __gt__(self, other):
        if other == INFTY:
            return False
        return True

    def __ge__(self, other):
        return True

    def __le__(self, other):
        return other == INFTY

    def __lt__(self, other):
        return False

    def __add__(self, other):
        return self

    def __radd__(self, other):
        return self

    def __sub__(self, other):
        return self

    def __rsub__(self, other):
        return self

    def __mul__(self, other):
        if other == 0:
            raise ValueError("Undefined")
        return self

    def __rmul__(self, other):
        return self * other

    def __init__(self):
        if _Infinity.INFTY is not None:
            raise ValueError("Cannot create two infinities")
        _Infinity.INFTY = self

INFTY = _Infinity()

AUTO = -2

BXW = "{http://unsuspicious.services/bxw}"

SCENE = "Scene"
AUDIO = "Audio"
CHASER = "Chaser"
CHASERSTEP = "ChaserStep"
JOIN = "Join"
FUNCTION = "Function"

INTERNAL = "Internal"
EXTERNAL = "External"

INHERIT = "Inherit"
MANUAL = "Manual"

LOOP = "Loop"
RANDOM = "Random"
ONESHOT = "Oneshot"