(s: str)
| 343 | |
| 344 | |
| 345 | def is_fully_escaped(s: str) -> bool: |
| 346 | # we know we won't compile with re.VERBOSE, so whitespace doesn't need to be escaped |
| 347 | metacharacters = "{}()+.*?^$[]|" |
| 348 | # Strip all escape sequences (backslash + any char), then check if any |
| 349 | # metacharacter remains unescaped in the resulting string. |
| 350 | stripped = re.sub(r"\\.", "", s) |
| 351 | return not any(c in metacharacters for c in stripped) |
| 352 | |
| 353 | |
| 354 | def unescape(s: str) -> str: |
no outgoing calls