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

Function extract_grouped_input_state_callback_args_from_kwargs

dash/dependencies.py:225–270  ·  view source on GitHub ↗
(kwargs)

Source from the content-addressed store, hash-verified

223
224
225def extract_grouped_input_state_callback_args_from_kwargs(kwargs):
226 input_parameters = kwargs["inputs"]
227 if isinstance(input_parameters, DashDependency):
228 input_parameters = [input_parameters]
229
230 state_parameters = kwargs.get("state", None)
231 if isinstance(state_parameters, DashDependency):
232 state_parameters = [state_parameters]
233
234 if isinstance(input_parameters, dict):
235 # Wrapped function will be called with named keyword arguments
236 if state_parameters:
237 if not isinstance(state_parameters, dict):
238 raise ValueError(
239 "The input argument to app.callback was a dict, "
240 "but the state argument was not.\n"
241 "input and state arguments must have the same type"
242 )
243
244 # Merge into state dependencies
245 parameters = state_parameters
246 parameters.update(input_parameters)
247 else:
248 parameters = input_parameters
249
250 return parameters
251
252 if isinstance(input_parameters, (list, tuple)):
253 # Wrapped function will be called with positional arguments
254 parameters = list(input_parameters)
255 if state_parameters:
256 if not isinstance(state_parameters, (list, tuple)):
257 raise ValueError(
258 "The input argument to app.callback was a list, "
259 "but the state argument was not.\n"
260 "input and state arguments must have the same type"
261 )
262
263 parameters += list(state_parameters)
264
265 return parameters
266
267 raise ValueError(
268 "The input argument to app.callback may be a dict, list, or tuple,\n"
269 f"but received value of type {type(input_parameters)}"
270 )
271
272
273def extract_grouped_input_state_callback_args_from_args(args):

Calls 2

getMethod · 0.45
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…