Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/in_memory.py
Show First 20 Lines • Show All 688 Lines • ▼ Show 20 Lines | ) -> Optional[Dict[str, Any]]: | ||||
"id": snapshot_id, | "id": snapshot_id, | ||||
"branches": branches, | "branches": branches, | ||||
"next_branch": next_branch, | "next_branch": next_branch, | ||||
} | } | ||||
def snapshot_get_random(self) -> Sha1Git: | def snapshot_get_random(self) -> Sha1Git: | ||||
return random.choice(list(self._snapshots)) | return random.choice(list(self._snapshots)) | ||||
def object_find_by_sha1_git(self, ids): | def object_find_by_sha1_git(self, ids: List[Sha1Git]) -> Dict[Sha1Git, List[Dict]]: | ||||
anlambert: `Dict[Sha1Git, List[Dict]]` => `Dict[Sha1Git, List[Dict[str, Any]]` ? | |||||
Done Inline Actionsyeah, i thought it was a mouthful so i did not add it. ardumont: yeah, i thought it was a mouthful so i did not add it.
Plus it will get reworked with real… | |||||
Not Done Inline ActionsRight, this will be replaced by model objects. No need to bother then. anlambert: Right, this will be replaced by model objects. No need to bother then. | |||||
ret = {} | ret: Dict[Sha1Git, List[Dict]] = {} | ||||
for id_ in ids: | for id_ in ids: | ||||
objs = self._objects.get(id_, []) | objs = self._objects.get(id_, []) | ||||
ret[id_] = [{"sha1_git": id_, "type": obj[0],} for obj in objs] | ret[id_] = [{"sha1_git": id_, "type": obj[0],} for obj in objs] | ||||
return ret | return ret | ||||
def _convert_origin(self, t): | def _convert_origin(self, t): | ||||
if t is None: | if t is None: | ||||
return None | return None | ||||
▲ Show 20 Lines • Show All 598 Lines • Show Last 20 Lines |
Dict[Sha1Git, List[Dict]] => Dict[Sha1Git, List[Dict[str, Any]] ?