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

Function unicode_internal_encode

Lib/_pycodecs.py:198–215  ·  view source on GitHub ↗

None

(obj, errors="strict")

Source from the content-addressed store, hash-verified

196
197
198def unicode_internal_encode(obj, errors="strict"):
199 """None"""
200 if type(obj) == str:
201 p = bytearray()
202 t = [ord(x) for x in obj]
203 for i in t:
204 b = bytearray()
205 for j in range(unicode_bytes):
206 b.append(i % 256)
207 i >>= 8
208 if sys.byteorder == "big":
209 b.reverse()
210 p += b
211 res = bytes(p)
212 return res, len(res)
213 else:
214 res = "You can do better than this" # XXX make this right
215 return res, len(res)
216
217
218def unicode_internal_decode(unistr, errors="strict"):

Callers

nothing calls this directly

Calls 4

ordFunction · 0.85
lenFunction · 0.85
appendMethod · 0.45
reverseMethod · 0.45

Tested by

no test coverage detected