Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/codemeta.py
Show First 20 Lines • Show All 84 Lines • ▼ Show 20 Lines | for line in reader: # For each canonical name | ||||
# If that's not the parentType/property/type/description | # If that's not the parentType/property/type/description | ||||
for local_name in _codemeta_field_separator.split(value): | for local_name in _codemeta_field_separator.split(value): | ||||
# For each of the data source's properties that maps | # For each of the data source's properties that maps | ||||
# to this canonical name | # to this canonical name | ||||
if local_name.strip(): | if local_name.strip(): | ||||
codemeta_translation[col][local_name.strip()] = \ | codemeta_translation[col][local_name.strip()] = \ | ||||
canonical_name | canonical_name | ||||
return codemeta_translation | return (header, codemeta_translation) | ||||
with open(CROSSWALK_TABLE_PATH) as fd: | with open(CROSSWALK_TABLE_PATH) as fd: | ||||
CROSSWALK_TABLE = _read_crosstable(fd) | (CODEMETA_KEYS, CROSSWALK_TABLE) = _read_crosstable(fd) | ||||
def _document_loader(url): | def _document_loader(url): | ||||
"""Document loader for pyld. | """Document loader for pyld. | ||||
Reads the local codemeta.jsonld file instead of fetching it | Reads the local codemeta.jsonld file instead of fetching it | ||||
from the Internet every single time.""" | from the Internet every single time.""" | ||||
if url == CODEMETA_CONTEXT_URL or url in CODEMETA_ALTERNATE_CONTEXT_URLS: | if url == CODEMETA_CONTEXT_URL or url in CODEMETA_ALTERNATE_CONTEXT_URLS: | ||||
Show All 22 Lines |