MCPcopy Index your code
hub / github.com/python/cpython / _escape

Function _escape

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

Source from the content-addressed store, hash-verified

160 )
161
162def _escape(text):
163 m = _controlCharPat.search(text)
164 if m is not None:
165 raise ValueError("strings can't contain control characters; "
166 "use bytes instead")
167 text = text.replace("\r\n", "\n") # convert DOS line endings
168 text = text.replace("\r", "\n") # convert Mac line endings
169 text = text.replace("&", "&") # escape '&'
170 text = text.replace("<", "&lt;") # escape '<'
171 text = text.replace(">", "&gt;") # escape '>'
172 return text
173
174class _PlistParser:
175 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

Used in the wild real call sites across dependent graphs

searching dependent graphs…