def from_json(cls, json_filename, db_filename='crashes.sqlite'):
"""
Parses JSON creating a database.
"""
json_filename = Path(json_filename)
db_filename = Path(db_filename)
if not db_filename.exists():
pass
elif db_filename.mtime > json_filename.mtime:
return Corpus(db_filename)
# Autovivify the corpus
corpus = Corpus(db_filename)
# Parse the JSON.
data = load_oracle_data(json_filename, should_parse=False)
crashes, _oracle_all, crash2bucket, _total_ids, _total_buckets = data
for report_id, bucket_id in crash2bucket.items():
if report_id not in crashes:
continue
corpus.insert_crash(report_id, crashes[report_id], bucket_id)
评论列表
文章目录