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

Function unicode_internal_decode

Lib/_pycodecs.py:218–242  ·  view source on GitHub ↗

None

(unistr, errors="strict")

Source from the content-addressed store, hash-verified

216
217
218def unicode_internal_decode(unistr, errors="strict"):
219 """None"""
220 if type(unistr) == str:
221 return unistr, len(unistr)
222 else:
223 p = []
224 i = 0
225 if sys.byteorder == "big":
226 start = unicode_bytes - 1
227 stop = -1
228 step = -1
229 else:
230 start = 0
231 stop = unicode_bytes
232 step = 1
233 while i < len(unistr) - unicode_bytes + 1:
234 t = 0
235 h = 0
236 for j in range(start, stop, step):
237 t += ord(unistr[i + j]) << (h * 8)
238 h += 1
239 i += unicode_bytes
240 p += chr(t)
241 res = "".join(p)
242 return res, len(res)
243
244
245def utf_16_ex_decode(data, errors="strict", byteorder=0, final=0):

Callers

nothing calls this directly

Calls 4

lenFunction · 0.85
ordFunction · 0.85
chrFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected