MCPcopy
hub / github.com/pytest-dev/pytest / is_fully_escaped

Function is_fully_escaped

src/_pytest/raises.py:345–351  ·  view source on GitHub ↗
(s: str)

Source from the content-addressed store, hash-verified

343
344
345def 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
354def unescape(s: str) -> str:

Calls

no outgoing calls