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

Function compute_input_state_grouping_indices

dash/dependencies.py:305–329  ·  view source on GitHub ↗
(input_state_grouping)

Source from the content-addressed store, hash-verified

303
304
305def compute_input_state_grouping_indices(input_state_grouping):
306 # Flatten grouping of Input and State dependencies into a flat list
307 flat_deps = flatten_grouping(input_state_grouping)
308
309 # Split into separate flat lists of Input and State dependencies
310 flat_inputs = [dep for dep in flat_deps if isinstance(dep, Input)]
311 flat_state = [dep for dep in flat_deps if isinstance(dep, State)]
312
313 # For each entry in the grouping, compute the index into the
314 # concatenation of flat_inputs and flat_state
315 total_inputs = len(flat_inputs)
316 input_count = 0
317 state_count = 0
318 flat_inds = []
319 for dep in flat_deps:
320 if isinstance(dep, Input):
321 flat_inds.append(input_count)
322 input_count += 1
323 else:
324 flat_inds.append(total_inputs + state_count)
325 state_count += 1
326
327 # Reshape this flat list of indices to match the input grouping
328 grouping_inds = make_grouping_by_index(input_state_grouping, flat_inds)
329 return flat_inputs, flat_state, grouping_inds
330
331
332def handle_grouped_callback_args(args, kwargs):

Callers 1

Calls 3

flatten_groupingFunction · 0.85
make_grouping_by_indexFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…