locals.py 499 B

1234567891011121314151617181920212223242526
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. class Enum:
  4. group = None
  5. def __init__(self, label):
  6. self.label = label
  7. def __repr__(self):
  8. return '<%s: %s>' % (self.group, self.label)
  9. def __str__(self):
  10. return self.label
  11. class StatusEnum(Enum):
  12. group = 'Status'
  13. OFFLINE = Enum('Offline')
  14. ONLINE = Enum('Online')
  15. AWAY = Enum('Away')
  16. class OfflineError(Exception):
  17. """The requested action can't happen while offline."""