Skip to content

Commit 3118f4b

Browse files
committed
run pre commit
1 parent 0b1037c commit 3118f4b

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

stac_fastapi/elasticsearch/stac_fastapi/elasticsearch/transactions.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ def create_item(self, model: stac_types.Item, **kwargs):
6060
if model["type"] == "FeatureCollection":
6161
bulk_client = BulkTransactionsClient()
6262
processed_items = [
63-
bulk_client._preprocess_item(item, base_url) for item in model["features"]
63+
bulk_client._preprocess_item(item, base_url)
64+
for item in model["features"]
6465
]
6566
return_msg = f"Successfully added {len(processed_items)} items."
6667
bulk_client.bulk_sync(processed_items)
@@ -222,6 +223,7 @@ def _preprocess_item(self, model: stac_types.Item, base_url) -> stac_types.Item:
222223
return model
223224

224225
def bulk_sync(self, processed_items):
226+
"""Elasticsearch bulk insertion."""
225227
actions = [
226228
{"_index": "stac_items", "_source": item} for item in processed_items
227229
]

stac_fastapi/elasticsearch/tests/clients/test_elasticsearch.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ def test_bulk_item_insert(
289289
# item["id"], item["collection"], request=MockStarletteRequest
290290
# )
291291

292+
292293
def test_feature_collection_insert(
293294
es_core: CoreCrudClient,
294295
es_transactions: TransactionsClient,
@@ -299,23 +300,21 @@ def test_feature_collection_insert(
299300
es_transactions.create_collection(coll, request=MockStarletteRequest)
300301

301302
item = load_test_data("test_item.json")
302-
303+
303304
features = []
304305
for _ in range(10):
305306
_item = deepcopy(item)
306307
_item["id"] = str(uuid.uuid4())
307308
features.append(_item)
308309

309-
feature_collection = {
310-
"type": "FeatureCollection",
311-
"features": features
312-
}
310+
feature_collection = {"type": "FeatureCollection", "features": features}
313311

314312
es_transactions.create_item(feature_collection, request=MockStarletteRequest)
315313
time.sleep(3)
316314
fc = es_core.item_collection(coll["id"], request=MockStarletteRequest)
317315
assert len(fc["features"]) >= 10
318316

317+
319318
@pytest.mark.skip(reason="Not working")
320319
def test_landing_page_no_collection_title(
321320
es_core: CoreCrudClient,

0 commit comments

Comments
 (0)