Skip to content

Commit 25ff3e1

Browse files
committed
Adding default "not implemented" for JSON Patch.
1 parent 8863923 commit 25ff3e1

File tree

1 file changed

+13
-38
lines changed
  • stac_fastapi/types/stac_fastapi/types

1 file changed

+13
-38
lines changed

stac_fastapi/types/stac_fastapi/types/core.py

Lines changed: 13 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,6 @@ def merge_patch_item(
154154
"""
155155
...
156156

157-
@abc.abstractmethod
158157
def json_patch_item(
159158
self,
160159
collection_id: str,
@@ -174,12 +173,10 @@ def json_patch_item(
174173
Returns:
175174
The patched item.
176175
"""
177-
...
176+
raise NotImplementedError("JSON Patch not implemented")
178177

179178
@abc.abstractmethod
180-
def delete_item(
181-
self, item_id: str, collection_id: str, **kwargs
182-
) -> Optional[Union[stac.Item, Response]]:
179+
def delete_item(self, item_id: str, collection_id: str, **kwargs) -> Optional[Union[stac.Item, Response]]:
183180
"""Delete an item from a collection.
184181
185182
Called with `DELETE /collections/{collection_id}/items/{item_id}`
@@ -194,9 +191,7 @@ def delete_item(
194191
...
195192

196193
@abc.abstractmethod
197-
def create_collection(
198-
self, collection: Collection, **kwargs
199-
) -> Optional[Union[stac.Collection, Response]]:
194+
def create_collection(self, collection: Collection, **kwargs) -> Optional[Union[stac.Collection, Response]]:
200195
"""Create a new collection.
201196
202197
Called with `POST /collections`.
@@ -313,9 +308,7 @@ def json_patch_collection(
313308
...
314309

315310
@abc.abstractmethod
316-
def delete_collection(
317-
self, collection_id: str, **kwargs
318-
) -> Optional[Union[stac.Collection, Response]]:
311+
def delete_collection(self, collection_id: str, **kwargs) -> Optional[Union[stac.Collection, Response]]:
319312
"""Delete a collection.
320313
321314
Called with `DELETE /collections/{collection_id}`
@@ -468,9 +461,7 @@ async def json_patch_item(
468461
...
469462

470463
@abc.abstractmethod
471-
async def delete_item(
472-
self, item_id: str, collection_id: str, **kwargs
473-
) -> Optional[Union[stac.Item, Response]]:
464+
async def delete_item(self, item_id: str, collection_id: str, **kwargs) -> Optional[Union[stac.Item, Response]]:
474465
"""Delete an item from a collection.
475466
476467
Called with `DELETE /collections/{collection_id}/items/{item_id}`
@@ -485,9 +476,7 @@ async def delete_item(
485476
...
486477

487478
@abc.abstractmethod
488-
async def create_collection(
489-
self, collection: Collection, **kwargs
490-
) -> Optional[Union[stac.Collection, Response]]:
479+
async def create_collection(self, collection: Collection, **kwargs) -> Optional[Union[stac.Collection, Response]]:
491480
"""Create a new collection.
492481
493482
Called with `POST /collections`.
@@ -604,9 +593,7 @@ async def json_patch_collection(
604593
...
605594

606595
@abc.abstractmethod
607-
async def delete_collection(
608-
self, collection_id: str, **kwargs
609-
) -> Optional[Union[stac.Collection, Response]]:
596+
async def delete_collection(self, collection_id: str, **kwargs) -> Optional[Union[stac.Collection, Response]]:
610597
"""Delete a collection.
611598
612599
Called with `DELETE /collections/{collection_id}`
@@ -696,9 +683,7 @@ class BaseCoreClient(LandingPageMixin, abc.ABC):
696683
extensions: list of registered api extensions.
697684
"""
698685

699-
base_conformance_classes: List[str] = attr.ib(
700-
factory=lambda: BASE_CONFORMANCE_CLASSES
701-
)
686+
base_conformance_classes: List[str] = attr.ib(factory=lambda: BASE_CONFORMANCE_CLASSES)
702687
extensions: List[ApiExtension] = attr.ib(default=attr.Factory(list))
703688

704689
def conformance_classes(self) -> List[str]:
@@ -744,9 +729,7 @@ def landing_page(self, **kwargs) -> stac.LandingPage:
744729
)
745730

746731
# Add Queryables link
747-
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled(
748-
"SearchFilterExtension"
749-
):
732+
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled("SearchFilterExtension"):
750733
landing_page["links"].append(
751734
{
752735
"rel": Relations.queryables.value,
@@ -808,9 +791,7 @@ def conformance(self, **kwargs) -> stac.Conformance:
808791
return stac.Conformance(conformsTo=self.conformance_classes())
809792

810793
@abc.abstractmethod
811-
def post_search(
812-
self, search_request: BaseSearchPostRequest, **kwargs
813-
) -> stac.ItemCollection:
794+
def post_search(self, search_request: BaseSearchPostRequest, **kwargs) -> stac.ItemCollection:
814795
"""Cross catalog search (POST).
815796
816797
Called with `POST /search`.
@@ -916,9 +897,7 @@ class AsyncBaseCoreClient(LandingPageMixin, abc.ABC):
916897
extensions: list of registered api extensions.
917898
"""
918899

919-
base_conformance_classes: List[str] = attr.ib(
920-
factory=lambda: BASE_CONFORMANCE_CLASSES
921-
)
900+
base_conformance_classes: List[str] = attr.ib(factory=lambda: BASE_CONFORMANCE_CLASSES)
922901
extensions: List[ApiExtension] = attr.ib(default=attr.Factory(list))
923902

924903
def conformance_classes(self) -> List[str]:
@@ -954,9 +933,7 @@ async def landing_page(self, **kwargs) -> stac.LandingPage:
954933
)
955934

956935
# Add Queryables link
957-
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled(
958-
"SearchFilterExtension"
959-
):
936+
if self.extension_is_enabled("FilterExtension") or self.extension_is_enabled("SearchFilterExtension"):
960937
landing_page["links"].append(
961938
{
962939
"rel": Relations.queryables.value,
@@ -1019,9 +996,7 @@ async def conformance(self, **kwargs) -> stac.Conformance:
1019996
return stac.Conformance(conformsTo=self.conformance_classes())
1020997

1021998
@abc.abstractmethod
1022-
async def post_search(
1023-
self, search_request: BaseSearchPostRequest, **kwargs
1024-
) -> stac.ItemCollection:
999+
async def post_search(self, search_request: BaseSearchPostRequest, **kwargs) -> stac.ItemCollection:
10251000
"""Cross catalog search (POST).
10261001
10271002
Called with `POST /search`.

0 commit comments

Comments
 (0)