11from typing import Dict , Optional , List , Callable , Tuple , Type , Any
22import numpy as np
3- import shortuuid
43
5- from shapeflow .core import Dispatcher , Endpoint , stream_image , stream_json , stream_plain
6- from shapeflow .util .meta import bind
7- from shapeflow .maths .colors import HsvColor
8- from shapeflow .core .streaming import BaseStreamer , EventStreamer , PlainFileStreamer
4+ from shapeflow .core .dispatching import Endpoint , Dispatcher
5+ from shapeflow .core .streaming import BaseStreamer , EventStreamer , \
6+ PlainFileStreamer , Stream
97
108
119# todo: also specify http methods maybe?
1210class _VideoAnalyzerDispatcher (Dispatcher ):
1311 """Dispatches ``/api/va/<id>/<endpoint>``
1412 """
15- status = Endpoint (Callable [[], dict ], stream_json )
13+ status = Endpoint (Callable [[], dict ], Stream . json )
1614 """Get the analyzer's status
1715
1816 :func:`shapeflow.core.backend.BaseAnalyzer.status`
@@ -52,7 +50,7 @@ class _VideoAnalyzerDispatcher(Dispatcher):
5250
5351 :func:`shapeflow.core.backend.BaseAnalyzer.cancel`
5452 """
55- get_config = Endpoint (Callable [[], dict ], stream_json )
53+ get_config = Endpoint (Callable [[], dict ], Stream . json )
5654 """Return the analyzer's configuration
5755
5856 :func:`shapeflow.core.backend.BaseAnalyzer.get_config`
@@ -107,7 +105,7 @@ class _VideoAnalyzerDispatcher(Dispatcher):
107105
108106 :func:`shapeflow.video.VideoAnalyzer.get_overlay_png`
109107 """
110- get_frame = Endpoint (Callable [[Optional [int ]], np .ndarray ], stream_image )
108+ get_frame = Endpoint (Callable [[Optional [int ]], np .ndarray ], Stream . image )
111109 """Return the transformed frame at the provided frame number
112110 (or the current frame number if ``None``)
113111
@@ -119,18 +117,18 @@ class _VideoAnalyzerDispatcher(Dispatcher):
119117
120118 :func:`shapeflow.video.VideoAnalyzer.set_filter_click`
121119 """
122- get_inverse_transformed_overlay = Endpoint (Callable [[], np .ndarray ], stream_image )
120+ get_inverse_transformed_overlay = Endpoint (Callable [[], np .ndarray ], Stream . image )
123121 """Return the inverse transformed overlay image
124122
125123 :func:`shapeflow.video.VideoAnalyzer.get_inverse_transformed_overlay`
126124 """
127- get_inverse_overlaid_frame = Endpoint (Callable [[Optional [int ]], np .ndarray ], stream_image )
125+ get_inverse_overlaid_frame = Endpoint (Callable [[Optional [int ]], np .ndarray ], Stream . image )
128126 """Return the inverse overlaid frame at the provided frame number
129127 (or the current frame number if ``None``)
130128
131129 :func:`shapeflow.video.VideoAnalyzer.get_inverse_overlaid_frame`
132130 """
133- get_state_frame = Endpoint (Callable [[Optional [int ], Optional [int ]], np .ndarray ], stream_image )
131+ get_state_frame = Endpoint (Callable [[Optional [int ], Optional [int ]], np .ndarray ], Stream . image )
134132 """Return the state frame at the provided frame number
135133 (or the current frame number if ``None``)
136134
@@ -183,7 +181,7 @@ class _VideoAnalyzerDispatcher(Dispatcher):
183181
184182 :func:`shapeflow.video.VideoAnalyzer.get_fps`
185183 """
186- get_raw_frame = Endpoint (Callable [[Optional [int ]], np .ndarray ], stream_image )
184+ get_raw_frame = Endpoint (Callable [[Optional [int ]], np .ndarray ], Stream . image )
187185 """Return the raw frame at the provided frame number
188186 (or the current frame number if ``None``)
189187
@@ -381,7 +379,7 @@ class ApiDispatcher(Dispatcher):
381379
382380 :func:`shapeflow.main._Main.set_settings`
383381 """
384- events = Endpoint (Callable [[], EventStreamer ], stream_json )
382+ events = Endpoint (Callable [[], EventStreamer ], Stream . json )
385383 """Open an event stream
386384
387385 :func:`shapeflow.main._Main.events`
@@ -391,7 +389,7 @@ class ApiDispatcher(Dispatcher):
391389
392390 :func:`shapeflow.main._Main.stop_events`
393391 """
394- log = Endpoint (Callable [[], PlainFileStreamer ], stream_plain )
392+ log = Endpoint (Callable [[], PlainFileStreamer ], Stream . plain )
395393 """Open a log stream
396394
397395 :func:`shapeflow.main._Main.log`
0 commit comments