File: coroutines.py

package info (click to toggle)
python-ijson 3.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 668 kB
  • sloc: python: 2,687; ansic: 1,776; sh: 4; makefile: 3
file content (15 lines) | stat: -rw-r--r-- 320 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from ijson import utils


def bytesiter(x):
    for b in x:
        yield bytes([b])


def get_all(routine, json_content, *args, **kwargs):
    events = utils.sendable_list()
    coro = routine(events, *args, **kwargs)
    for datum in bytesiter(json_content):
        coro.send(datum)
    coro.close()
    return events