swh.lister.cran.lister module#

class swh.lister.cran.lister.CRANLister(scheduler: SchedulerInterface, credentials: Optional[Dict[str, Dict[str, List[Dict[str, str]]]]] = None, max_origins_per_page: Optional[int] = None, max_pages: Optional[int] = None, enable_origins: bool = True)[source]#

Bases: StatelessLister[List[Dict[str, str]]]

List all packages hosted on The Comprehensive R Archive Network.

LISTER_NAME: str = 'CRAN'#
get_pages() Iterator[List[Dict[str, str]]][source]#

Yields a single page containing all CRAN packages info.

get_origins_from_page(page: List[Dict[str, str]]) Iterator[ListedOrigin][source]#

Extract a list of model.ListedOrigin from a raw page of results.

Parameters:

page – a single page of results

Returns:

an iterator for the origins present on the given page of results

swh.lister.cran.lister.read_cran_data() List[Dict[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'
    },
    {
        'Package': 'abbyyR',
        'Version': '0.5.4'
    },
    ...
]

swh.lister.cran.lister.compute_origin_urls(package_info: Dict[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

swh.lister.cran.lister.parse_packaged_date(package_info: Dict[str, str]) Optional[datetime][source]#