Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9348870
codemeta.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
925 B
Subscribers
None
codemeta.py
View Options
# 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
Details
Attached
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
Attached To
rDCIDX Metadata indexer
Event Timeline
Log In to Comment