Find the closing line of the last tt.reduce block. Returns the index of the `}) : ...` line after tt.reduce.return.
(lines: list[str])
| 165 | |
| 166 | |
| 167 | def _find_reduce_close(lines: list[str]) -> int | None: |
| 168 | """Find the closing line of the last tt.reduce block. |
| 169 | |
| 170 | Returns the index of the `}) : ...` line after tt.reduce.return. |
| 171 | """ |
| 172 | last_reduce_return = _find_last(lines, "tt.reduce.return") |
| 173 | if last_reduce_return is None: |
| 174 | return None |
| 175 | for i in range(last_reduce_return + 1, len(lines)): |
| 176 | if re.search(r"\}\)", lines[i]): |
| 177 | return i |
| 178 | return None |
| 179 | |
| 180 | |
| 181 | def _find_first(lines: list[str], pattern: str) -> int | None: |
no test coverage detected