MCPcopy Create free account
hub / github.com/simplejson/simplejson / scan_four_digit_hex

Function scan_four_digit_hex

simplejson/decoder.py:56–66  ·  view source on GitHub ↗

Scan a four digit hex number from s[end:end + 4]

(s, end, _m=re.compile(r'^[0-9a-fA-F]{4}$').match)

Source from the content-addressed store, hash-verified

54
55
56def scan_four_digit_hex(s, end, _m=re.compile(r'^[0-9a-fA-F]{4}$').match):
57 """Scan a four digit hex number from s[end:end + 4]
58 """
59 msg = "Invalid \\uXXXX escape sequence"
60 esc = s[end:end + 4]
61 if not _m(esc):
62 raise JSONDecodeError(msg, s, end - 2)
63 try:
64 return int(esc, 16), end + 4
65 except ValueError:
66 raise JSONDecodeError(msg, s, end - 2)
67
68def py_scanstring(s, end, encoding=None, strict=True,
69 _b=BACKSLASH, _m=STRINGCHUNK.match, _join=u''.join,

Callers

nothing calls this directly

Calls 1

JSONDecodeErrorClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…