diff --git a/swh/indexer/storage/__init__.py b/swh/indexer/storage/__init__.py --- a/swh/indexer/storage/__init__.py +++ b/swh/indexer/storage/__init__.py @@ -7,7 +7,7 @@ from collections import Counter, defaultdict import itertools import json -from typing import Dict, Iterable, Iterator, List, Optional, Tuple +from typing import Dict, Iterable, List, Optional, Tuple import psycopg2 import psycopg2.pool @@ -146,7 +146,7 @@ @db_transaction_generator() def content_mimetype_missing( self, mimetypes: Iterable[Dict], db=None, cur=None - ) -> Iterator[Tuple[Sha1, int]]: + ) -> Iterable[Tuple[Sha1, int]]: for obj in db.content_mimetype_missing_from_list(mimetypes, cur): yield obj[0] @@ -276,7 +276,7 @@ @db_transaction_generator() def content_mimetype_get( self, ids: Iterable[Sha1], db=None, cur=None - ) -> Iterator[ContentMimetypeRow]: + ) -> Iterable[ContentMimetypeRow]: for c in db.content_mimetype_get_from_list(ids, cur): yield ContentMimetypeRow.from_dict( converters.db_to_mimetype(dict(zip(db.content_mimetype_cols, c))) diff --git a/swh/indexer/storage/in_memory.py b/swh/indexer/storage/in_memory.py --- a/swh/indexer/storage/in_memory.py +++ b/swh/indexer/storage/in_memory.py @@ -259,7 +259,7 @@ def content_mimetype_missing( self, mimetypes: Iterable[Dict] - ) -> Iterator[Tuple[Sha1, int]]: + ) -> Iterable[Tuple[Sha1, int]]: yield from self._mimetypes.missing(mimetypes) def content_mimetype_get_partition( @@ -280,7 +280,7 @@ added = self._mimetypes.add(mimetypes, conflict_update) return {"content_mimetype:add": added} - def content_mimetype_get(self, ids: Iterable[Sha1]) -> Iterator[ContentMimetypeRow]: + def content_mimetype_get(self, ids: Iterable[Sha1]) -> Iterable[ContentMimetypeRow]: yield from self._mimetypes.get(ids) def content_language_missing(self, languages): diff --git a/swh/indexer/storage/interface.py b/swh/indexer/storage/interface.py --- a/swh/indexer/storage/interface.py +++ b/swh/indexer/storage/interface.py @@ -3,7 +3,7 @@ # License: GNU General Public License version 3, or any later version # See top-level LICENSE file for more information -from typing import Dict, Iterable, Iterator, List, Optional, Tuple, TypeVar +from typing import Dict, Iterable, List, Optional, Tuple, TypeVar from swh.core.api import remote_api_endpoint from swh.core.api.classes import PagedResult as CorePagedResult @@ -25,7 +25,7 @@ @remote_api_endpoint("content_mimetype/missing") def content_mimetype_missing( self, mimetypes: Iterable[Dict] - ) -> Iterator[Tuple[Sha1, int]]: + ) -> Iterable[Tuple[Sha1, int]]: """Generate mimetypes missing from storage. Args: @@ -90,7 +90,7 @@ ... @remote_api_endpoint("content_mimetype") - def content_mimetype_get(self, ids: Iterable[Sha1]) -> Iterator[ContentMimetypeRow]: + def content_mimetype_get(self, ids: Iterable[Sha1]) -> Iterable[ContentMimetypeRow]: """Retrieve full content mimetype per ids. Args: