MCPcopy
hub / github.com/plotly/dash / _dispatch

Method _dispatch

dash/backends/_quart.py:386–403  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

384 # pylint: disable=unused-argument
385 def serve_callback(self, dash_app: Dash): # type: ignore[name-defined] Quart always async
386 async def _dispatch():
387 adapter = QuartRequestAdapter()
388 body = await adapter.get_json()
389 # pylint: disable=protected-access
390 cb_ctx = dash_app._initialize_context(body)
391 # pylint: disable=protected-access
392 func = dash_app._prepare_callback(cb_ctx, body)
393 # pylint: disable=protected-access
394 args = dash_app._inputs_to_vals(cb_ctx.inputs_list + cb_ctx.states_list)
395 ctx = copy_context()
396 # pylint: disable=protected-access
397 partial_func = dash_app._execute_callback(
398 func, args, cb_ctx.outputs_list, cb_ctx
399 )
400 response_data = ctx.run(partial_func)
401 if inspect.iscoroutine(response_data): # if user callback is async
402 response_data = await response_data
403 return cb_ctx.dash_response.set_response(data=response_data) # type: ignore[arg-type]
404
405 return _dispatch
406

Callers

nothing calls this directly

Calls 8

get_jsonMethod · 0.95
QuartRequestAdapterClass · 0.85
_initialize_contextMethod · 0.80
_prepare_callbackMethod · 0.80
_inputs_to_valsMethod · 0.80
_execute_callbackMethod · 0.80
runMethod · 0.45
set_responseMethod · 0.45

Tested by

no test coverage detected