MCPcopy Create free account
hub / github.com/internetarchive/openlibrary / parse_data_table

Function parse_data_table

openlibrary/data/__init__.py:8–16  ·  view source on GitHub ↗

Parses the dump of data table and returns an iterator with for all entries.

(filename)

Source from the content-addressed store, hash-verified

6
7
8def parse_data_table(filename):
9 """Parses the dump of data table and returns an iterator with
10 <key, type, revision, json> for all entries.
11 """
12 with open(filename) as file:
13 for line in file:
14 _thing_id, _revision, json_data = pgdecode(line).strip().split("\t")
15 d = json.loads(json_data)
16 yield d["key"], d["type"]["key"], str(d["revision"]), json_data

Callers

nothing calls this directly

Calls 2

pgdecodeFunction · 0.90
loadsMethod · 0.80

Tested by

no test coverage detected