We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ce75038 commit bd634ffCopy full SHA for bd634ff
src/json_stream/tokenizer.py
@@ -365,9 +365,14 @@ def process_char(char):
365
366
return advance, next_state
367
state = State.WHITESPACE
368
- c = stream.read(1)
369
- index = 0
370
- while c:
+ buffer = stream.read(io.DEFAULT_BUFFER_SIZE)
+ c = None
+ index = -1
371
+ advance = True
372
+ while buffer:
373
+ if advance:
374
+ c, buffer = buffer[0], buffer[1:] or stream.read(io.DEFAULT_BUFFER_SIZE)
375
+ index += 1
376
try:
377
advance, state = process_char(c)
378
except ValueError as e:
@@ -376,9 +381,6 @@ def process_char(char):
381
completed = False
382
token = []
383
yield now_token
379
- if advance:
380
- index += 1
384
process_char(SpecialChar.EOF)
385
if completed:
386
0 commit comments