swh.lister.sourceforge.lister module

class swh.lister.sourceforge.lister.VcsNames(value)[source]

Bases: enum.Enum

Used to filter SourceForge tool names for valid VCS types

CVS = 'cvs'
GIT = 'git'
BAZAAR = 'bzr'
class swh.lister.sourceforge.lister.SourceForgeListerEntry(vcs: swh.lister.sourceforge.lister.VcsNames, url: str, last_modified: datetime.date)[source]

Bases: object

vcs: swh.lister.sourceforge.lister.VcsNames
url: str
last_modified: datetime.date
class swh.lister.sourceforge.lister.SourceForgeListerState(subsitemap_last_modified: Dict[str, datetime.date] = <factory>, empty_projects: Dict[str, datetime.date] = <factory>)[source]

Bases: object

Current state of the SourceForge lister in incremental runs

subsitemap_last_modified: Dict[str, datetime.date]

Some projects (not the majority, but still meaningful) have no VCS for us to archive. We need to remember a mapping of their API URL to their “last modified” date so we don’t keep querying them needlessly every time.

empty_projects: Dict[str, datetime.date]
class swh.lister.sourceforge.lister.SourceForgeLister(scheduler: swh.scheduler.interface.SchedulerInterface, incremental: bool = False, credentials: Optional[Dict[str, Dict[str, List[Dict[str, str]]]]] = None)[source]

Bases: swh.lister.pattern.Lister[swh.lister.sourceforge.lister.SourceForgeListerState, List[swh.lister.sourceforge.lister.SourceForgeListerEntry]]

List origins from the “SourceForge” forge.

LISTER_NAME: str = 'sourceforge'
state_from_dict(d: Dict[str, Dict[str, Any]]) swh.lister.sourceforge.lister.SourceForgeListerState[source]

Convert the state stored in the scheduler backend (as a dict), to the concrete StateType for this lister.

state_to_dict(state: swh.lister.sourceforge.lister.SourceForgeListerState) Dict[str, Any][source]

Convert the StateType for this lister to its serialization as dict for storage in the scheduler.

Values must be JSON-compatible as that’s what the backend database expects.

projects_last_modified() Dict[Tuple[str, str], datetime.date][source]
page_request(url, params) requests.models.Response[source]
get_pages() Iterator[List[swh.lister.sourceforge.lister.SourceForgeListerEntry]][source]

SourceForge has a main XML sitemap that lists its sharded sitemaps for all projects. Each XML sub-sitemap lists project pages, which are not unique per project: a project can have a wiki, a home, a git, an svn, etc. For each unique project, we query an API endpoint that lists (among other things) the tools associated with said project, some of which are the VCS used. Subprojects are considered separate projects. Lastly we use the information of which VCS are used to build the predictable clone URL for any given VCS.

get_origins_from_page(page: List[swh.lister.sourceforge.lister.SourceForgeListerEntry]) Iterator[swh.scheduler.model.ListedOrigin][source]

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


page – a single page of results


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