MCPcopy Index your code
hub / github.com/RustPython/RustPython / _escape

Function _escape

Lib/plistlib.py:168–178  ·  view source on GitHub ↗
(text)

Source from the content-addressed store, hash-verified

166 )
167
168def _escape(text):
169 m = _controlCharPat.search(text)
170 if m is not None:
171 raise ValueError("strings can't contain control characters; "
172 "use bytes instead")
173 text = text.replace("\r\n", "\n") # convert DOS line endings
174 text = text.replace("\r", "\n") # convert Mac line endings
175 text = text.replace("&", "&") # escape '&'
176 text = text.replace("<", "&lt;") # escape '<'
177 text = text.replace(">", "&gt;") # escape '>'
178 return text
179
180class _PlistParser:
181 def __init__(self, dict_type, aware_datetime=False):

Callers 1

simple_elementMethod · 0.70

Calls 2

searchMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected