Skip to content

Commit 0822417

Browse files
committed
Reset command set between different patches.
1 parent 3ffe9d5 commit 0822417

File tree

3 files changed

+6
-25
lines changed

3 files changed

+6
-25
lines changed

stac_fastapi/core/stac_fastapi/core/models/patch.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ class ESCommandSet:
1717

1818
dict_: Dict[str, None] = {}
1919

20+
def __init__(self):
21+
"""Initialise ESCommandSet instance."""
22+
self.dict_ = {}
23+
2024
def add(self, value: str):
2125
"""Add command.
2226

stac_fastapi/core/stac_fastapi/core/utilities.py

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -278,29 +278,6 @@ def test_commands(
278278
)
279279

280280

281-
def commands_to_source(commands: List[str]) -> str:
282-
"""Convert list of commands to Elasticsearch script source.
283-
284-
Args:
285-
commands (List[str]): List of Elasticearch commands
286-
287-
Returns:
288-
str: Elasticsearch script source
289-
"""
290-
seen: Set[str] = set()
291-
seen_add = seen.add
292-
# regex = re.compile(r"([^.' ]*:[^.' ]*)[. ;]")
293-
source = ""
294-
295-
# filter duplicate lines
296-
for command in commands:
297-
if command not in seen:
298-
seen_add(command)
299-
source += command
300-
301-
return source
302-
303-
304281
def operations_to_script(operations: List) -> Dict:
305282
"""Convert list of operation to painless script.
306283

stac_fastapi/tests/clients/test_elasticsearch.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ async def test_json_patch_item_replace(ctx, core_client, txn_client):
320320
{"op": "replace", "path": "/properties/gsd", "value": 100}
321321
),
322322
PatchAddReplaceTest.model_validate(
323-
{"op": "replace", "path": "/properties/proj:epsg", "value": "world"}
323+
{"op": "replace", "path": "/properties/proj:epsg", "value": 12345}
324324
),
325325
PatchAddReplaceTest.model_validate(
326326
{"op": "replace", "path": "/properties/area/1", "value": 50}
@@ -339,7 +339,7 @@ async def test_json_patch_item_replace(ctx, core_client, txn_client):
339339
)
340340

341341
assert updated_item["properties"]["gsd"] == 100
342-
assert updated_item["properties"]["proj:epsg"] == "world"
342+
assert updated_item["properties"]["proj:epsg"] == 12345
343343
assert updated_item["properties"]["area"] == [2500, 50]
344344

345345

0 commit comments

Comments
 (0)