Skip to content

Commit 1bd515d

Browse files
committed
use genexp, address pr review
1 parent ad7a248 commit 1bd515d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import asyncio
33
import logging
44
from base64 import urlsafe_b64decode, urlsafe_b64encode
5-
from typing import Dict, List, Optional, Tuple, Type, Union
5+
from typing import Dict, List, Optional, Tuple, Type, Union, Any, Iterable
66

77
import attr
88
import elasticsearch
@@ -66,12 +66,12 @@ class DatabaseLogic:
6666

6767
"""CORE LOGIC"""
6868

69-
async def get_all_collections(self) -> List[Collection]:
69+
async def get_all_collections(self) -> List[Dict[str, Any]]:
7070
"""Database logic to retrieve a list of all collections."""
7171
# https://github.com/stac-utils/stac-fastapi-elasticsearch/issues/65
7272
# collections should be paginated, but at least return more than the default 10 for now
7373
collections = await self.client.search(index=COLLECTIONS_INDEX, size=1000)
74-
return [c["_source"] for c in collections["hits"]["hits"]]
74+
return (c["_source"] for c in collections["hits"]["hits"])
7575

7676
async def get_one_item(self, collection_id: str, item_id: str) -> Dict:
7777
"""Database logic to retrieve a single item."""
@@ -190,7 +190,7 @@ async def execute_search(
190190
limit: int,
191191
token: Optional[str],
192192
sort: Optional[Dict[str, Dict[str, str]]],
193-
) -> Tuple[List[Item], Optional[int], Optional[str]]:
193+
) -> Tuple[Iterable[Dict[str, Any]], Optional[int], Optional[str]]:
194194
"""Database logic to execute search with limit."""
195195
search_after = None
196196
if token:

0 commit comments

Comments
 (0)