swh.lister.cran.lister module

class swh.lister.cran.lister.CRANLister(override_config=None)[source]

Bases: swh.lister.core.simple_lister.SimpleLister

MODEL

alias of swh.lister.cran.models.CRANModel

LISTER_NAME = 'cran'
instance = 'cran'
task_dict(origin_type, origin_url, version=None, html_url=None, policy=None, **kwargs)[source]

Return task format dict. This creates tasks with args and kwargs set, for example:

args: []
kwargs: {
    'url': 'https://cran.r-project.org/Packages/<package>...',
    'artifacts': [{
        'url': 'https://cran.r-project.org/...',
        'version': '0.0.1',
    }]
}
safely_issue_request(identifier)[source]

Bypass the implementation. It’s now the list_packages which returns data.

As an implementation detail, we cannot change simply the base SimpleLister yet as other implementation still uses it. This shall be part of another refactoring pass.

list_packages(response) → List[Mapping[str, str]][source]
Runs R script which uses inbuilt API to return a json response

containing data about the R packages.

Returns

List of Dict about R packages. For example:

[
    {
        'Package': 'A3',
        'Version': '1.0.0',
        'Title': 'A3 package',
        'Description': ...
    },
    {
        'Package': 'abbyyR',
        'Version': '0.5.4',
        'Title': 'Access to Abbyy OCR (OCR) API',
        'Description': ...'
    },
    ...
]

get_model_from_repo(repo: Mapping[str, str]) → Mapping[str, str][source]

Transform from repository representation to model

swh.lister.cran.lister.read_cran_data() → List[Mapping[str, str]][source]

Execute r script to read cran listing.

swh.lister.cran.lister.compute_origin_urls(repo: Mapping[str, str]) → Tuple[str, str][source]

Compute the package url from the repo dict.

Parameters

repo – dict with key ‘Package’, ‘Version’

Returns

the tuple project url, artifact url