swh.indexer.metadata_mapping.codemeta module#

class swh.indexer.metadata_mapping.codemeta.CodemetaMapping(log_suffix='')[source]#

Bases: SingleFileIntrinsicMapping

dedicated class for CodeMeta (codemeta.json) mapping and translation

name = 'codemeta'#
filename: bytes | Pattern[bytes] = b'codemeta.json'#
string_fields = None#
classmethod supported_terms() List[str][source]#
translate(content: bytes) Dict[str, Any] | None[source]#

Translates content by parsing content from a bytestring containing mapping-specific data and translating with the appropriate mapping to JSON-LD using the Codemeta and ForgeFed vocabularies.

Parameters:

raw_content – raw content to translate

Returns:

translated metadata in JSON friendly form needed for the content if parseable, None otherwise.