MCPcopy Index your code
hub / github.com/plotly/dash / _dispatch

Method _dispatch

dash/backends/_fastapi.py:546–565  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

544
545 def serve_callback(self, dash_app: Dash):
546 async def _dispatch(request: Request): # pylint: disable=unused-argument
547 # pylint: disable=protected-access
548 body = self.request_adapter().get_json()
549 cb_ctx = dash_app._initialize_context(
550 body
551 ) # pylint: disable=protected-access
552 func = dash_app._prepare_callback(
553 cb_ctx, body
554 ) # pylint: disable=protected-access
555 args = dash_app._inputs_to_vals(
556 cb_ctx.inputs_list + cb_ctx.states_list
557 ) # pylint: disable=protected-access
558 ctx = copy_context()
559 partial_func = dash_app._execute_callback(
560 func, args, cb_ctx.outputs_list, cb_ctx
561 ) # pylint: disable=protected-access
562 response_data = ctx.run(partial_func)
563 if inspect.iscoroutine(response_data):
564 response_data = await response_data
565 return cb_ctx.dash_response.set_response(data=response_data)
566
567 return _dispatch
568

Callers

nothing calls this directly

Calls 7

_initialize_contextMethod · 0.80
_prepare_callbackMethod · 0.80
_inputs_to_valsMethod · 0.80
_execute_callbackMethod · 0.80
get_jsonMethod · 0.45
runMethod · 0.45
set_responseMethod · 0.45

Tested by

no test coverage detected