| Total Complexity | 4 |
| Total Lines | 14 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 1 | Features | 0 |
| 1 | from groundwork.patterns import GwThreadsPattern |
||
| 4 | class ThreadPlugin(GwThreadsPattern): |
||
| 5 | def __init__(self, *args, **kwargs): |
||
| 6 | self.name = self.__class__.__name__ |
||
| 7 | super().__init__(*args, **kwargs) |
||
| 8 | |||
| 9 | def activate(self): |
||
| 10 | self.threads.register("test_thread", self.thread_func, description="Test Thread") |
||
| 11 | |||
| 12 | def thread_func(self, plugin, **kwargs): |
||
| 13 | print("Thread executed by %s" % plugin.name) |
||
| 14 | return "Done" |
||
| 15 | |||
| 16 | def deactivate(self): |
||
| 17 | pass |
||
| 18 |