(line: str)
| 568 | |
| 569 | # https://github.com/google/XNNPACK/blob/master/tools/xngen.py |
| 570 | def escape(line: str) -> str: |
| 571 | output_parts = [] |
| 572 | while "${" in line: |
| 573 | start_pos = line.index("${") |
| 574 | end_pos = line.index("}", start_pos + 2) |
| 575 | if start_pos != 0: |
| 576 | output_parts.append('"' + line[:start_pos].replace('"', '\\"') + '"') |
| 577 | output_parts.append("str(" + line[start_pos + 2 : end_pos] + ")") |
| 578 | line = line[end_pos + 1 :] |
| 579 | if line: |
| 580 | output_parts.append('"' + line.replace('"', '\\"') + '"') |
| 581 | return " + ".join(output_parts) |
| 582 | |
| 583 | |
| 584 | # https://github.com/google/XNNPACK/blob/master/tools/xngen.py |
no test coverage detected