Python-ELMO is a Python library which offers an encapsulation of the binary tool ELMO, in order to manipulate it easily in Python and SageMath script.
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

servicethread.py 993B

  1. import threading
  2. from protocol import Protocol, ClosureException
  3. class ServiceThread(threading.Thread):
  4. def run(self):
  5. self.execute()
  6. def execute(self):
  7. # Method where the service runs
  8. pass
  9. class OneShotServiceThread(ServiceThread):
  10. def __init__(self, ip, port, clientsocket):
  11. threading.Thread.__init__(self)
  12. self.ip = ip
  13. self.port = port
  14. self.clientsocket = clientsocket
  15. self.protocol = Protocol(clientsocket)
  16. def run(self):
  17. try:
  18. self.execute()
  19. except ClosureException:
  20. return
  21. def execute(self):
  22. # Method where the service runs
  23. pass
  24. class PermanentServiceThread(ServiceThread):
  25. def __init__(self):
  26. threading.Thread.__init__(self)
  27. self._is_running = True
  28. def is_running(self):
  29. return self._is_running
  30. def stop(self):
  31. self._is_running = False