MCPcopy
hub / github.com/XPixelGroup/DiffBIR / read_jsonl

Function read_jsonl

llava/eval/generate_webpage_data_from_table.py:10–20  ·  view source on GitHub ↗
(path: str, key: str=None)

Source from the content-addressed store, hash-verified

8
9
10def read_jsonl(path: str, key: str=None):
11 data = []
12 with open(os.path.expanduser(path)) as f:
13 for line in f:
14 if not line:
15 continue
16 data.append(json.loads(line))
17 if key is not None:
18 data.sort(key=lambda x: x[key])
19 data = {item[key]: item for item in data}
20 return data
21
22
23def trim_hanging_lines(s: str, n: int) -> str:

Calls 1

sortMethod · 0.80

Tested by

no test coverage detected