(
self, line: Line, string_indices: list[int]
)
| 472 | return TErr("This line has no strings that need merging.") |
| 473 | |
| 474 | def do_transform( |
| 475 | self, line: Line, string_indices: list[int] |
| 476 | ) -> Iterator[TResult[Line]]: |
| 477 | new_line = line |
| 478 | |
| 479 | rblc_result = self._remove_backslash_line_continuation_chars( |
| 480 | new_line, string_indices |
| 481 | ) |
| 482 | if isinstance(rblc_result, Ok): |
| 483 | new_line = rblc_result.ok() |
| 484 | |
| 485 | msg_result = self._merge_string_group(new_line, string_indices) |
| 486 | if isinstance(msg_result, Ok): |
| 487 | new_line = msg_result.ok() |
| 488 | |
| 489 | if isinstance(rblc_result, Err) and isinstance(msg_result, Err): |
| 490 | msg_cant_transform = msg_result.err() |
| 491 | rblc_cant_transform = rblc_result.err() |
| 492 | cant_transform = CannotTransform( |
| 493 | "StringMerger failed to merge any strings in this line." |
| 494 | ) |
| 495 | |
| 496 | # Chain the errors together using `__cause__`. |
| 497 | msg_cant_transform.__cause__ = rblc_cant_transform |
| 498 | cant_transform.__cause__ = msg_cant_transform |
| 499 | |
| 500 | yield Err(cant_transform) |
| 501 | else: |
| 502 | yield Ok(new_line) |
| 503 | |
| 504 | @staticmethod |
| 505 | def _remove_backslash_line_continuation_chars( |
nothing calls this directly
no test coverage detected