Skip to content

Commit b2ff45b

Browse files
committed
fix import
1 parent 3159e05 commit b2ff45b

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

stac_fastapi/core/stac_fastapi/core/core.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
BulkTransactionMethod,
3838
Items,
3939
)
40-
from stac_fastapi.sfeos_helpers.database import return_date
4140
from stac_fastapi.types import stac as stac_types
4241
from stac_fastapi.types.conformance import BASE_CONFORMANCE_CLASSES
4342
from stac_fastapi.types.core import AsyncBaseCoreClient
@@ -326,9 +325,8 @@ async def item_collection(
326325
)
327326

328327
try:
329-
datetime_search = return_date(datetime)
330328
search = self.database.apply_datetime_filter(
331-
search=search, datetime_search=datetime_search
329+
search=search, datetime=datetime
332330
)
333331
except (ValueError, TypeError) as e:
334332
# Handle invalid interval formats if return_date fails
@@ -509,9 +507,8 @@ async def post_search(
509507
)
510508

511509
try:
512-
datetime_search = return_date(search_request.datetime)
513510
search = self.database.apply_datetime_filter(
514-
search=search, datetime_search=datetime_search
511+
search=search, datetime=search_request.datetime
515512
)
516513
except (ValueError, TypeError) as e:
517514
# Handle invalid interval formats if return_date fails

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
mk_actions,
4040
mk_item_id,
4141
populate_sort_shared,
42+
return_date,
4243
validate_refresh,
4344
)
4445
from stac_fastapi.sfeos_helpers.database.query import (
@@ -277,17 +278,19 @@ def apply_collections_filter(search: Search, collection_ids: List[str]):
277278

278279
@staticmethod
279280
def apply_datetime_filter(
280-
search: Search, datetime_search: Dict[str, Optional[str]]
281+
search: Search, datetime: str | None
281282
) -> Search:
282283
"""Apply a filter to search on datetime, start_datetime, and end_datetime fields.
283284
284285
Args:
285286
search: The search object to filter.
286-
datetime_search: Dict[str, Optional[str]]
287+
datetime: str | None
287288
288289
Returns:
289290
The filtered search object.
290291
"""
292+
datetime_search = return_date(datetime)
293+
291294
if not datetime_search:
292295
return search
293296

stac_fastapi/opensearch/stac_fastapi/opensearch/database_logic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
mk_actions,
3838
mk_item_id,
3939
populate_sort_shared,
40+
return_date,
4041
validate_refresh,
4142
)
4243
from stac_fastapi.sfeos_helpers.database.query import (
@@ -66,6 +67,7 @@
6667
from stac_fastapi.types.links import resolve_links
6768
from stac_fastapi.types.stac import Collection, Item
6869

70+
6971
logger = logging.getLogger(__name__)
7072

7173

@@ -284,17 +286,19 @@ def apply_free_text_filter(search: Search, free_text_queries: Optional[List[str]
284286

285287
@staticmethod
286288
def apply_datetime_filter(
287-
search: Search, datetime_search: Dict[str, Optional[str]]
289+
search: Search, datetime: str | None
288290
) -> Search:
289291
"""Apply a filter to search on datetime, start_datetime, and end_datetime fields.
290292
291293
Args:
292294
search: The search object to filter.
293-
datetime_search: Dict[str, Optional[str]]
295+
datetime: str | None
294296
295297
Returns:
296298
The filtered search object.
297299
"""
300+
datetime_search = return_date(datetime)
301+
298302
if not datetime_search:
299303
return search
300304

stac_fastapi/sfeos_helpers/stac_fastapi/sfeos_helpers/aggregation/client.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,9 @@ async def aggregate(
313313
search=search, item_ids=aggregate_request.ids
314314
)
315315

316-
datetime_search = return_date(aggregate_request.datetime)
317316
if aggregate_request.datetime:
318317
search = self.database.apply_datetime_filter(
319-
search=search, datetime_search=datetime_search
318+
search=search, datetime=aggregate_request.datetime
320319
)
321320

322321
if aggregate_request.bbox:

0 commit comments

Comments
 (0)