-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdev_example.py
37 lines (33 loc) · 965 Bytes
/
dev_example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from typing import List
from sortingview.views import View
from kachery_cloud.TaskBackend import TaskBackend
from time import time
def main():
lines = [
{'text': f'Example line {ind}', 'timestamp': time(), 'stderr': False}
for ind in range(100)
]
view = Console(lines)
print(view.url(label='Console example'))
class Console(View):
"""
Minimalistic example view
"""
def __init__(self,
lines: List[dict], # {text, timestamp, stderr}
**kwargs
) -> None:
super().__init__('Console', **kwargs)
self._lines = lines
def to_dict(self) -> dict:
ret = {
'type': self.type,
'consoleLines': self._lines
}
return ret
def register_task_handlers(self, task_backend: TaskBackend):
return super().register_task_handlers(task_backend)
def child_views(self) -> List[View]:
return []
if __name__ == '__main__':
main()