Skip to content

Commit 1281805

Browse files
committed
fix formatting
1 parent 02b896a commit 1281805

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/core.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
from stac_fastapi.elasticsearch.session import Session
2727
from stac_fastapi.extensions.third_party.bulk_transactions import (
2828
BaseBulkTransactionsClient,
29-
Items, BulkTransactionMethod,
29+
BulkTransactionMethod,
30+
Items,
3031
)
3132
from stac_fastapi.types import stac as stac_types
3233
from stac_fastapi.types.config import Settings
@@ -718,7 +719,9 @@ def __attrs_post_init__(self):
718719
settings = ElasticsearchSettings()
719720
self.client = settings.create_client
720721

721-
def preprocess_item(self, item: stac_types.Item, base_url, method: BulkTransactionMethod) -> stac_types.Item:
722+
def preprocess_item(
723+
self, item: stac_types.Item, base_url, method: BulkTransactionMethod
724+
) -> stac_types.Item:
722725
"""Preprocess an item to match the data model.
723726
724727
Args:
@@ -729,8 +732,10 @@ def preprocess_item(self, item: stac_types.Item, base_url, method: BulkTransacti
729732
Returns:
730733
The preprocessed item.
731734
"""
732-
exist_ok = (method == BulkTransactionMethod.UPSERT)
733-
return self.database.sync_prep_create_item(item=item, base_url=base_url, exist_ok=exist_ok)
735+
exist_ok = method == BulkTransactionMethod.UPSERT
736+
return self.database.sync_prep_create_item(
737+
item=item, base_url=base_url, exist_ok=exist_ok
738+
)
734739

735740
@overrides
736741
def bulk_item_insert(
@@ -753,7 +758,8 @@ def bulk_item_insert(
753758
base_url = ""
754759

755760
processed_items = [
756-
self.preprocess_item(item, base_url, items.method) for item in items.items.values()
761+
self.preprocess_item(item, base_url, items.method)
762+
for item in items.items.values()
757763
]
758764

759765
# not a great way to get the collection_id-- should be part of the method signature

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/database_logic.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,9 @@ async def check_collection_exists(self, collection_id: str):
591591
if not await self.client.exists(index=COLLECTIONS_INDEX, id=collection_id):
592592
raise NotFoundError(f"Collection {collection_id} does not exist")
593593

594-
async def prep_create_item(self, item: Item, base_url: str, exist_ok: bool = False) -> Item:
594+
async def prep_create_item(
595+
self, item: Item, base_url: str, exist_ok: bool = False
596+
) -> Item:
595597
"""
596598
Preps an item for insertion into the database.
597599
@@ -619,7 +621,9 @@ async def prep_create_item(self, item: Item, base_url: str, exist_ok: bool = Fal
619621

620622
return self.item_serializer.stac_to_db(item, base_url)
621623

622-
def sync_prep_create_item(self, item: Item, base_url: str, exist_ok: bool = False) -> Item:
624+
def sync_prep_create_item(
625+
self, item: Item, base_url: str, exist_ok: bool = False
626+
) -> Item:
623627
"""
624628
Prepare an item for insertion into the database.
625629

0 commit comments

Comments
 (0)