How to use the jsonlines.jsonlines function in jsonlines

To help you get started, we’ve selected a few jsonlines examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github quiltdata / quilt / api / python / quilt3 / jsonl.py View on Github external
def __iter__(self):
        return self.lines.__iter__()





def custom6_process(str_line):
    # print("custom6_process start")
    output = ujson.loads(str_line)
    # print("custom6_process end")
    return output


class Custom6Reader(jsonlines.jsonlines.ReaderWriterBase):


    def __init__(self, fp):

        len_timer = Timer("Extracting lines as strings").start()
        str_lines = [f for f in fp]
        self.total_lines = len(str_lines)
        len_timer.stop()

        self.header = ujson.loads(str_lines.pop(0))
        self.p = mp.Pool(POOL_WORKERS)
        self.res_iterator = self.p.imap_unordered(custom6_process, str_lines)



    def read(self):

jsonlines

Library with helpers for the jsonlines file format

BSD-2-Clause
Latest version published 11 months ago

Package Health Score

72 / 100
Full package analysis

Similar packages