()
| 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 |
nothing calls this directly
no test coverage detected