Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 623 Lines • ▼ Show 20 Lines | ) -> Optional[Dict[str, Any]]: | ||||
visit_d = self._origin_visit_get_updated(origin_url, visit) | visit_d = self._origin_visit_get_updated(origin_url, visit) | ||||
snapshot_id = visit_d["snapshot"] | snapshot_id = visit_d["snapshot"] | ||||
if snapshot_id: | if snapshot_id: | ||||
return self.snapshot_get(snapshot_id) | return self.snapshot_get(snapshot_id) | ||||
else: | else: | ||||
return None | return None | ||||
def snapshot_count_branches(self, snapshot_id: Sha1Git) -> Optional[Dict[str, int]]: | def snapshot_count_branches( | ||||
self, snapshot_id: Sha1Git | |||||
) -> Optional[Dict[Optional[str], int]]: | |||||
snapshot = self._snapshots[snapshot_id] | snapshot = self._snapshots[snapshot_id] | ||||
return collections.Counter( | return collections.Counter( | ||||
branch.target_type.value if branch else None | branch.target_type.value if branch else None | ||||
for branch in snapshot.branches.values() | for branch in snapshot.branches.values() | ||||
) | ) | ||||
def snapshot_get_branches( | def snapshot_get_branches( | ||||
self, | self, | ||||
▲ Show 20 Lines • Show All 651 Lines • Show Last 20 Lines |