Funktionierender Prototyp des Serious Games zur Vermittlung von Wissen zu Software-Engineering-Arbeitsmodellen.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

loopback.py 706B

12345678910111213141516171819202122232425262728
  1. # Copyright (c) Twisted Matrix Laboratories.
  2. # See LICENSE for details.
  3. """
  4. Loopback helper used in test_ssh and test_recvline
  5. """
  6. from twisted.protocols import loopback
  7. class LoopbackRelay(loopback.LoopbackRelay):
  8. clearCall = None
  9. def logPrefix(self):
  10. return f"LoopbackRelay({self.target.__class__.__name__!r})"
  11. def write(self, data):
  12. loopback.LoopbackRelay.write(self, data)
  13. if self.clearCall is not None:
  14. self.clearCall.cancel()
  15. from twisted.internet import reactor
  16. self.clearCall = reactor.callLater(0, self._clearBuffer)
  17. def _clearBuffer(self):
  18. self.clearCall = None
  19. loopback.LoopbackRelay.clearBuffer(self)