(path)
| 3 | |
| 4 | |
| 5 | def read_jsonl(path): |
| 6 | with open(path, encoding='utf8') as fh: |
| 7 | results = [] |
| 8 | for line in fh: |
| 9 | if line is None: |
| 10 | continue |
| 11 | try: |
| 12 | results.append(json.loads(line) if line != 'null' else line) |
| 13 | except Exception as e: |
| 14 | print(e) |
| 15 | print(path) |
| 16 | print(line) |
| 17 | raise e |
| 18 | return results |
| 19 | |
| 20 | |
| 21 | def save_jsonl(lines, directory): |
no test coverage detected