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

Function escape_encode

Lib/_pycodecs.py:115–123  ·  view source on GitHub ↗

None

(obj, errors="strict")

Source from the content-addressed store, hash-verified

113
114
115def escape_encode(obj, errors="strict"):
116 """None"""
117 if not isinstance(obj, bytes):
118 raise TypeError("must be bytes")
119 s = repr(obj).encode()
120 v = s[2:-1]
121 if s[1] == ord('"'):
122 v = v.replace(b"'", b"\\'").replace(b'\\"', b'"')
123 return v, len(obj)
124
125
126def raw_unicode_escape_decode(data, errors="strict", final=True):

Callers

nothing calls this directly

Calls 6

isinstanceFunction · 0.85
reprFunction · 0.85
ordFunction · 0.85
lenFunction · 0.85
encodeMethod · 0.45
replaceMethod · 0.45

Tested by

no test coverage detected