MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / JSONArray

Function JSONArray

tools/python-3.11.9-amd64/Lib/json/decoder.py:217–251  ·  view source on GitHub ↗
(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR)

Source from the content-addressed store, hash-verified

215 return pairs, end
216
217def JSONArray(s_and_end, scan_once, _w=WHITESPACE.match, _ws=WHITESPACE_STR):
218 s, end = s_and_end
219 values = []
220 nextchar = s[end:end + 1]
221 if nextchar in _ws:
222 end = _w(s, end + 1).end()
223 nextchar = s[end:end + 1]
224 # Look-ahead for trivial empty array
225 if nextchar == ']':
226 return values, end + 1
227 _append = values.append
228 while True:
229 try:
230 value, end = scan_once(s, end)
231 except StopIteration as err:
232 raise JSONDecodeError("Expecting value", s, err.value) from None
233 _append(value)
234 nextchar = s[end:end + 1]
235 if nextchar in _ws:
236 end = _w(s, end + 1).end()
237 nextchar = s[end:end + 1]
238 end += 1
239 if nextchar == ']':
240 break
241 elif nextchar != ',':
242 raise JSONDecodeError("Expecting ',' delimiter", s, end - 1)
243 try:
244 if s[end] in _ws:
245 end += 1
246 if s[end] in _ws:
247 end = _w(s, end + 1).end()
248 except IndexError:
249 pass
250
251 return values, end
252
253
254class JSONDecoder(object):

Callers

nothing calls this directly

Calls 3

scan_onceFunction · 0.85
JSONDecodeErrorClass · 0.70
endMethod · 0.45

Tested by

no test coverage detected