Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/metadata_dictionary/R.py
- This file was added.
from debian.deb822 import Deb822 | |||||
from swh.indexer.codemeta import CROSSWALK_TABLE | |||||
from .base import DictMapping, SingleFileMapping | |||||
def parse_debian_control(s): | |||||
metadata = {} | |||||
for paragraph in Deb822.iter_paragraphs(s): | |||||
metadata.update(**paragraph) | |||||
return metadata | |||||
class RDescriptionMapping(DictMapping, SingleFileMapping): | |||||
"""Dedicated class for ...""" | |||||
vlorentz: Please fill this | |||||
name = "description" | |||||
Not Done Inline ActionsHmm, that's not a very clear name without context. What about "r-description"? vlorentz: Hmm, that's not a very clear name without context. What about "r-description"? | |||||
filename = b"DESCRIPTION" | |||||
mapping = CROSSWALK_TABLE["R Package Description"] | |||||
string_fields = [ | |||||
"URL", | |||||
"SystemRequirements", | |||||
"Date", | |||||
"License", | |||||
"Description", | |||||
"Package", | |||||
"Title", | |||||
"givenName", | |||||
"familyName", | |||||
"Suggests", | |||||
"Maintainer", | |||||
"BugReports", | |||||
] | |||||
def translate(self, raw_content): | |||||
raw_content = raw_content.decode() | |||||
content_dict = parse_debian_control(raw_content) | |||||
content_dict["Suggests"] = content_dict["Suggests"].replace(",", "").split() | |||||
return self._translate_dict(content_dict) | |||||
Not Done Inline ActionsI don't see these in the expected output in the test. Not need to parse them if they are not translatable. vlorentz: I don't see these in the expected output in the test. Not need to parse them if they are not… |
Please fill this