(evalue_idx: int)
| 189 | values: List[EValue] = execution_plan.values |
| 190 | |
| 191 | def _format_arg(evalue_idx: int) -> str: |
| 192 | def _get_io_index(iolist: List[int], target_evalue_idx: int) -> int: |
| 193 | """ |
| 194 | The list is short enough so linear scan is proper. |
| 195 | """ |
| 196 | for io_idx, evalue_idx in enumerate(iolist): |
| 197 | if evalue_idx == target_evalue_idx: |
| 198 | return io_idx |
| 199 | return -1 |
| 200 | |
| 201 | argstr = str(evalue_idx) |
| 202 | if (input_idx := _get_io_index(inputs, evalue_idx)) >= 0: |
| 203 | argstr += f"\033[31mI{input_idx}\033[0m" |
| 204 | if (output_idx := _get_io_index(outputs, evalue_idx)) >= 0: |
| 205 | argstr += f"\033[31mO{output_idx}\033[0m" |
| 206 | |
| 207 | # EValue type |
| 208 | evalue = values[evalue_idx] |
| 209 | return argstr + _format_evalue(evalue, show_meminfo, mark_dynamic_shape_tensor) |
| 210 | |
| 211 | print( |
| 212 | f"The program contains the following {len(instructions)} instructions", file=out |
no test coverage detected