(input_state_grouping)
| 303 | |
| 304 | |
| 305 | def 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 | |
| 332 | def handle_grouped_callback_args(args, kwargs): |
no test coverage detected
searching dependent graphs…