Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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):