Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/loader.py
Show First 20 Lines • Show All 116 Lines • ▼ Show 20 Lines | def get_default_version(self) -> str: | ||||
return "" | return "" | ||||
def last_snapshot(self) -> Optional[Snapshot]: | def last_snapshot(self) -> Optional[Snapshot]: | ||||
"""Retrieve the last snapshot | """Retrieve the last snapshot | ||||
""" | """ | ||||
snapshot = None | snapshot = None | ||||
visit = self.storage.origin_visit_get_latest(self.url, require_snapshot=True) | visit = self.storage.origin_visit_get_latest(self.url, require_snapshot=True) | ||||
if visit and visit.get("snapshot"): | snapshot_id = None if not visit else visit.get("snapshot") | ||||
snapshot = Snapshot.from_dict( | if snapshot_id is not None: | ||||
snapshot_get_all_branches(self.storage, visit["snapshot"]) | snapshot_dict = snapshot_get_all_branches(self.storage, snapshot_id) | ||||
olasd: snap -> snapshot_dict | |||||
) | if snapshot_dict: | ||||
snapshot = Snapshot.from_dict(snapshot_dict) | |||||
return snapshot | return snapshot | ||||
def known_artifacts(self, snapshot: Optional[Snapshot]) -> Dict[Sha1Git, BaseModel]: | def known_artifacts(self, snapshot: Optional[Snapshot]) -> Dict[Sha1Git, BaseModel]: | ||||
"""Retrieve the known releases/artifact for the origin. | """Retrieve the known releases/artifact for the origin. | ||||
Args | Args | ||||
snapshot: snapshot for the visit | snapshot: snapshot for the visit | ||||
▲ Show 20 Lines • Show All 354 Lines • Show Last 20 Lines |
snap -> snapshot_dict