added Notifier impl
This commit is contained in:
parent
65b66eaf14
commit
6ed4c8e7e1
1 changed files with 24 additions and 0 deletions
24
treepuncher/notifier.py
Normal file
24
treepuncher/notifier.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
from typing import Callable, List
|
||||
|
||||
class Notifier:
|
||||
_report_functions : List[Callable]
|
||||
|
||||
def __init__(self):
|
||||
self._report_functions = []
|
||||
|
||||
def register(self, fn:Callable):
|
||||
self._report_functions.append(fn)
|
||||
return fn
|
||||
|
||||
def report(self) -> str:
|
||||
return '\n'.join(fn() for fn in self._report_functions)
|
||||
|
||||
def notify(self, text, **kwargs):
|
||||
print(text)
|
||||
|
||||
async def initialize(self, _client:'Treepuncher'):
|
||||
pass
|
||||
|
||||
async def cleanup(self, _client:'Treepuncher'):
|
||||
pass
|
||||
|
Loading…
Reference in a new issue