blob: 2e63088ac0490c07aef807c2d7ff6b10eef522db (
plain) (
blame)
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
|
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
from typing import Optional
class Enum:
group: Optional[str] = None
def __init__(self, label: str) -> None:
self.label = label
def __repr__(self) -> str:
return f"<{self.group}: {self.label}>"
def __str__(self) -> str:
return self.label
class StatusEnum(Enum):
group = "Status"
OFFLINE = Enum("Offline")
ONLINE = Enum("Online")
AWAY = Enum("Away")
class OfflineError(Exception):
"""The requested action can't happen while offline."""
|