26
26
from stac_fastapi .elasticsearch .session import Session
27
27
from stac_fastapi .extensions .third_party .bulk_transactions import (
28
28
BaseBulkTransactionsClient ,
29
- Items , BulkTransactionMethod ,
29
+ BulkTransactionMethod ,
30
+ Items ,
30
31
)
31
32
from stac_fastapi .types import stac as stac_types
32
33
from stac_fastapi .types .config import Settings
@@ -718,7 +719,9 @@ def __attrs_post_init__(self):
718
719
settings = ElasticsearchSettings ()
719
720
self .client = settings .create_client
720
721
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 :
722
725
"""Preprocess an item to match the data model.
723
726
724
727
Args:
@@ -729,8 +732,10 @@ def preprocess_item(self, item: stac_types.Item, base_url, method: BulkTransacti
729
732
Returns:
730
733
The preprocessed item.
731
734
"""
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
+ )
734
739
735
740
@overrides
736
741
def bulk_item_insert (
@@ -753,7 +758,8 @@ def bulk_item_insert(
753
758
base_url = ""
754
759
755
760
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 ()
757
763
]
758
764
759
765
# not a great way to get the collection_id-- should be part of the method signature
0 commit comments