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

Method _initialize_context

dash/dash.py:1516–1537  ·  view source on GitHub ↗

Initialize the global context for the request.

(self, body: CallbackExecutionBody)

Source from the content-addressed store, hash-verified

1514
1515 # pylint: disable=R0915
1516 def _initialize_context(self, body: CallbackExecutionBody):
1517 """Initialize the global context for the request."""
1518 adapter = self.backend.request_adapter()
1519 g = AttributeDict({})
1520 g.inputs_list = body.get("inputs", [])
1521 g.states_list = body.get("state", [])
1522 g.outputs_list = body.get("outputs", [])
1523 g.input_values = inputs_to_dict(g.inputs_list)
1524 g.state_values = inputs_to_dict(g.states_list)
1525 g.triggered_inputs = [
1526 {"prop_id": x, "value": g.input_values.get(x)}
1527 for x in body.get("changedPropIds", [])
1528 ]
1529 g.dash_response = self.backend.response_adapter()
1530 g.cookies = dict(adapter.cookies)
1531 g.headers = dict(adapter.headers)
1532 g.args = adapter.args
1533 g.path = adapter.full_path
1534 g.remote = adapter.remote_addr
1535 g.origin = adapter.origin
1536 g.updated_props = {}
1537 return g
1538
1539 def _prepare_callback(self, g, body: CallbackExecutionBody):
1540 """Prepare callback-related data."""

Callers 5

_dispatchMethod · 0.80
_dispatchMethod · 0.80
_dispatch_asyncMethod · 0.80
_dispatchMethod · 0.80
run_callbackFunction · 0.80

Calls 3

AttributeDictClass · 0.85
inputs_to_dictFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected