diff --git a/swh/storage/in_memory.py b/swh/storage/in_memory.py --- a/swh/storage/in_memory.py +++ b/swh/storage/in_memory.py @@ -629,7 +629,9 @@ else: 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] return collections.Counter( branch.target_type.value if branch else None diff --git a/swh/storage/interface.py b/swh/storage/interface.py --- a/swh/storage/interface.py +++ b/swh/storage/interface.py @@ -715,7 +715,9 @@ ... @remote_api_endpoint("snapshot/count_branches") - 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]]: """Count the number of branches in the snapshot with the given id Args: diff --git a/swh/storage/storage.py b/swh/storage/storage.py --- a/swh/storage/storage.py +++ b/swh/storage/storage.py @@ -771,7 +771,7 @@ @db_transaction(statement_timeout=2000) def snapshot_count_branches( self, snapshot_id: Sha1Git, db=None, cur=None - ) -> Optional[Dict[str, int]]: + ) -> Optional[Dict[Optional[str], int]]: return dict([bc for bc in db.snapshot_count_branches(snapshot_id, cur)]) @timed