Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/storage/converters.py
Show All 36 Lines | for ctag in ctags["ctags"]: | ||||
"name": ctag["name"], | "name": ctag["name"], | ||||
"kind": ctag["kind"], | "kind": ctag["kind"], | ||||
"line": ctag["line"], | "line": ctag["line"], | ||||
"lang": ctag["lang"], | "lang": ctag["lang"], | ||||
"indexer_configuration_id": tool_id, | "indexer_configuration_id": tool_id, | ||||
} | } | ||||
def fossology_license_to_db(licenses): | |||||
"""Similar to ctags_to_db, but for licenses.""" | |||||
id = licenses["id"] | |||||
tool_id = licenses["indexer_configuration_id"] | |||||
for license in licenses["licenses"]: | |||||
yield { | |||||
"id": id, | |||||
"indexer_configuration_id": tool_id, | |||||
"license": license, | |||||
} | |||||
def db_to_ctags(ctag): | def db_to_ctags(ctag): | ||||
"""Convert a ctags entry into a ready ctags entry. | """Convert a ctags entry into a ready ctags entry. | ||||
Args: | Args: | ||||
ctags (dict): ctags entry with the following keys: | ctags (dict): ctags entry with the following keys: | ||||
- id (bytes): content's identifier | - id (bytes): content's identifier | ||||
- ctags ([dict]): List of dictionary with the following keys: | - ctags ([dict]): List of dictionary with the following keys: | ||||
▲ Show 20 Lines • Show All 88 Lines • Show Last 20 Lines |