Source code for swh.indexer.storage.converters
# Copyright (C) 2015-2022 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU General Public License version 3, or any later version
# See top-level LICENSE file for more information
[docs]
def db_to_mimetype(mimetype):
"""Convert a mimetype entry into a ready mimetype output."""
return {
"id": mimetype["id"],
"encoding": mimetype["encoding"],
"mimetype": mimetype["mimetype"],
"tool": {
"id": mimetype["tool_id"],
"name": mimetype["tool_name"],
"version": mimetype["tool_version"],
"configuration": mimetype["tool_configuration"],
},
}
[docs]
def db_to_fossology_license(license):
return {
"id": license["id"],
"license": license["license"],
"tool": {
"id": license["tool_id"],
"name": license["tool_name"],
"version": license["tool_version"],
"configuration": license["tool_configuration"],
},
}