(text: str, orig: Dict[str, str])
| 414 | # User-facing helpers |
| 415 | # --------------------------------------------------------------------------- # |
| 416 | def text_to_patch(text: str, orig: Dict[str, str]) -> Tuple[Patch, int]: |
| 417 | lines = text.splitlines() # preserves blank lines, no strip() |
| 418 | if ( |
| 419 | len(lines) < 2 |
| 420 | or not Parser._norm(lines[0]).startswith("*** Begin Patch") |
| 421 | or Parser._norm(lines[-1]) != "*** End Patch" |
| 422 | ): |
| 423 | raise DiffError("Invalid patch text - missing sentinels") |
| 424 | |
| 425 | parser = Parser(current_files=orig, lines=lines, index=1) |
| 426 | parser.parse() |
| 427 | return parser.patch, parser.fuzz |
| 428 | |
| 429 | |
| 430 | def identify_files_needed(text: str) -> List[str]: |
no test coverage detected