-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathstates.py
More file actions
44 lines (32 loc) · 940 Bytes
/
states.py
File metadata and controls
44 lines (32 loc) · 940 Bytes
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
from enum import Enum, unique
class OrderedEnum(Enum):
def __ge__(self, other):
if self.__class__ is other.__class__:
return self.value >= other.value
return NotImplemented
def __gt__(self, other):
if self.__class__ is other.__class__:
return self.value > other.value
return NotImplemented
def __le__(self, other):
if self.__class__ is other.__class__:
return self.value <= other.value
return NotImplemented
def __lt__(self, other):
if self.__class__ is other.__class__:
return self.value < other.value
return NotImplemented
@unique
class PodState(OrderedEnum):
initializing = 1
creating = 2
starting = 3
up = 4
terminating = 5
down = 6
destroyed = 7
crashed = 8
error = 9
def __str__(self):
"""Return the name of the state"""
return self.name