Page MenuHomeSoftware Heritage

codemeta.py
No OneTemporary

codemeta.py

# Copyright (C) 2018-2019 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
import json
from swh.indexer.codemeta import CODEMETA_TERMS
from swh.indexer.codemeta import expand
from .base import SingleFileMapping
class CodemetaMapping(SingleFileMapping):
"""
dedicated class for CodeMeta (codemeta.json) mapping and translation
"""
name = 'codemeta'
filename = b'codemeta.json'
string_fields = None
@classmethod
def supported_terms(cls):
return [term for term in CODEMETA_TERMS if not term.startswith('@')]
def translate(self, content):
try:
return self.normalize_translation(expand(
json.loads(content.decode())))
except Exception:
return None

File Metadata

Mime Type
text/x-python
Expires
Jul 4 2025, 6:54 PM (6 w, 11 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3241715

Event Timeline