Skip to content

Commit 2d78ca0

Browse files
authored
Use pythonic variable names where possible (#304)
1 parent c844034 commit 2d78ca0

File tree

11 files changed

+64
-64
lines changed

11 files changed

+64
-64
lines changed

stac_fastapi/api/stac_fastapi/api/app.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -152,14 +152,14 @@ def register_conformance_classes(self):
152152
)
153153

154154
def register_get_item(self):
155-
"""Register get item endpoint (GET /collections/{collectionId}/items/{itemId}).
155+
"""Register get item endpoint (GET /collections/{collection_id}/items/{item_id}).
156156
157157
Returns:
158158
None
159159
"""
160160
self.router.add_api_route(
161161
name="Get Item",
162-
path="/collections/{collectionId}/items/{itemId}",
162+
path="/collections/{collection_id}/items/{item_id}",
163163
response_model=Item if self.settings.enable_response_models else None,
164164
response_class=self.response_class,
165165
response_model_exclude_unset=True,
@@ -237,14 +237,14 @@ def register_get_collections(self):
237237
)
238238

239239
def register_get_collection(self):
240-
"""Register get collection endpoint (GET /collection/{collectionId}).
240+
"""Register get collection endpoint (GET /collection/{collection_id}).
241241
242242
Returns:
243243
None
244244
"""
245245
self.router.add_api_route(
246246
name="Get Collection",
247-
path="/collections/{collectionId}",
247+
path="/collections/{collection_id}",
248248
response_model=Collection if self.settings.enable_response_models else None,
249249
response_class=self.response_class,
250250
response_model_exclude_unset=True,
@@ -256,14 +256,14 @@ def register_get_collection(self):
256256
)
257257

258258
def register_get_item_collection(self):
259-
"""Register get item collection endpoint (GET /collection/{collectionId}/items).
259+
"""Register get item collection endpoint (GET /collection/{collection_id}/items).
260260
261261
Returns:
262262
None
263263
"""
264264
self.router.add_api_route(
265265
name="Get ItemCollection",
266-
path="/collections/{collectionId}/items",
266+
path="/collections/{collection_id}/items",
267267
response_model=ItemCollection
268268
if self.settings.enable_response_models
269269
else None,
@@ -284,9 +284,9 @@ def register_core(self):
284284
GET /
285285
GET /conformance
286286
GET /collections
287-
GET /collections/{collectionId}
288-
GET /collections/{collectionId}/items
289-
GET /collection/{collectionId}/items/{itemId}
287+
GET /collections/{collection_id}
288+
GET /collections/{collection_id}/items
289+
GET /collection/{collection_id}/items/{item_id}
290290
GET /search
291291
POST /search
292292

stac_fastapi/api/stac_fastapi/api/models.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,22 @@ def kwargs(self) -> Dict:
5656
class CollectionUri(APIRequest):
5757
"""Delete collection."""
5858

59-
collectionId: str = attr.ib(default=Path(..., description="Collection ID"))
59+
collection_id: str = attr.ib(default=Path(..., description="Collection ID"))
6060

6161
def kwargs(self) -> Dict:
6262
"""kwargs."""
63-
return {"id": self.collectionId}
63+
return {"id": self.collection_id}
6464

6565

6666
@attr.s
6767
class ItemUri(CollectionUri):
6868
"""Delete item."""
6969

70-
itemId: str = attr.ib(default=Path(..., description="Item ID"))
70+
item_id: str = attr.ib(default=Path(..., description="Item ID"))
7171

7272
def kwargs(self) -> Dict:
7373
"""kwargs."""
74-
return {"collection_id": self.collectionId, "item_id": self.itemId}
74+
return {"collection_id": self.collection_id, "item_id": self.item_id}
7575

7676

7777
@attr.s
@@ -93,7 +93,7 @@ class ItemCollectionUri(CollectionUri):
9393
def kwargs(self) -> Dict:
9494
"""kwargs."""
9595
return {
96-
"id": self.collectionId,
96+
"id": self.collection_id,
9797
"limit": self.limit,
9898
"token": self.token,
9999
}

stac_fastapi/extensions/stac_fastapi/extensions/core/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class ContextExtension(ApiExtension):
1212
"""Context Extension.
1313
14-
The Context extension adds a JSON object to ItemCollection responses (`/search`, `/collections/{collectionId}/items`)
14+
The Context extension adds a JSON object to ItemCollection responses (`/search`, `/collections/{collection_id}/items`)
1515
which includes the number of items matched, returned, and the limit requested.
1616
1717
https://github.com/radiantearth/stac-api-spec/blob/master/item-search/README.md#context

stac_fastapi/extensions/stac_fastapi/extensions/core/filter.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class FilterExtension(ApiExtension):
4444
The filter extension adds several endpoints which allow the retrieval of queryables and
4545
provides an expressive mechanism for searching based on Item Attributes:
4646
GET /queryables
47-
GET /collections/{collectionId}/queryables
47+
GET /collections/{collection_id}/queryables
4848
4949
https://github.com/radiantearth/stac-api-spec/blob/master/fragments/filter/README.md
5050
@@ -103,7 +103,7 @@ def register(self, app: FastAPI) -> None:
103103
)
104104
self.router.add_api_route(
105105
name="Collection Queryables",
106-
path="/collections/{collectionId}/queryables",
106+
path="/collections/{collection_id}/queryables",
107107
methods=["GET"],
108108
endpoint=self._create_endpoint(self.client.get_queryables, CollectionUri),
109109
)

stac_fastapi/extensions/stac_fastapi/extensions/core/transaction.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ class TransactionExtension(ApiExtension):
2222
The transaction extension adds several endpoints which allow the creation, deletion, and updating of items and
2323
collections:
2424
POST /collections
25-
PUT /collections/{collectionId}
26-
DELETE /collections/{collectionId}
27-
POST /collections/{collectionId}/items
28-
PUT /collections/{collectionId}/items
29-
DELETE /collections/{collectionId}/items
25+
PUT /collections/{collection_id}
26+
DELETE /collections/{collection_id}
27+
POST /collections/{collection_id}/items
28+
PUT /collections/{collection_id}/items
29+
DELETE /collections/{collection_id}/items
3030
3131
https://github.com/radiantearth/stac-api-spec/blob/master/ogcapi-features/extensions/transaction/README.md
3232
@@ -68,10 +68,10 @@ def _create_endpoint(
6868
raise NotImplementedError
6969

7070
def register_create_item(self):
71-
"""Register create item endpoint (POST /collections/{collectionId}/items)."""
71+
"""Register create item endpoint (POST /collections/{collection_id}/items)."""
7272
self.router.add_api_route(
7373
name="Create Item",
74-
path="/collections/{collectionId}/items",
74+
path="/collections/{collection_id}/items",
7575
response_model=Item if self.settings.enable_response_models else None,
7676
response_class=self.response_class,
7777
response_model_exclude_unset=True,
@@ -81,10 +81,10 @@ def register_create_item(self):
8181
)
8282

8383
def register_update_item(self):
84-
"""Register update item endpoint (PUT /collections/{collectionId}/items)."""
84+
"""Register update item endpoint (PUT /collections/{collection_id}/items)."""
8585
self.router.add_api_route(
8686
name="Update Item",
87-
path="/collections/{collectionId}/items",
87+
path="/collections/{collection_id}/items",
8888
response_model=Item if self.settings.enable_response_models else None,
8989
response_class=self.response_class,
9090
response_model_exclude_unset=True,
@@ -94,10 +94,10 @@ def register_update_item(self):
9494
)
9595

9696
def register_delete_item(self):
97-
"""Register delete item endpoint (DELETE /collections/{collectionId}/items/{itemId})."""
97+
"""Register delete item endpoint (DELETE /collections/{collection_id}/items/{item_id})."""
9898
self.router.add_api_route(
9999
name="Delete Item",
100-
path="/collections/{collectionId}/items/{itemId}",
100+
path="/collections/{collection_id}/items/{item_id}",
101101
response_model=Item if self.settings.enable_response_models else None,
102102
response_class=self.response_class,
103103
response_model_exclude_unset=True,
@@ -137,10 +137,10 @@ def register_update_collection(self):
137137
)
138138

139139
def register_delete_collection(self):
140-
"""Register delete collection endpoint (DELETE /collections/{collectionId})."""
140+
"""Register delete collection endpoint (DELETE /collections/{collection_id})."""
141141
self.router.add_api_route(
142142
name="Delete Collection",
143-
path="/collections/{collectionId}",
143+
path="/collections/{collection_id}",
144144
response_model=Collection if self.settings.enable_response_models else None,
145145
response_class=self.response_class,
146146
response_model_exclude_unset=True,

stac_fastapi/extensions/stac_fastapi/extensions/third_party/bulk_transactions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ def bulk_item_insert(
5555
class BulkTransactionExtension(ApiExtension):
5656
"""Bulk Transaction Extension.
5757
58-
Bulk Transaction extension adds the `POST /collections/{collectionId}/bulk_items` endpoint to the application
58+
Bulk Transaction extension adds the `POST /collections/{collection_id}/bulk_items` endpoint to the application
5959
for efficient bulk insertion of items.
6060
"""
6161

@@ -77,7 +77,7 @@ def register(self, app: FastAPI) -> None:
7777
router = APIRouter()
7878
router.add_api_route(
7979
name="Bulk Create Item",
80-
path="/collections/{collectionId}/bulk_items",
80+
path="/collections/{collection_id}/bulk_items",
8181
response_model=str,
8282
response_model_exclude_unset=True,
8383
response_model_exclude_none=True,

stac_fastapi/extensions/stac_fastapi/extensions/third_party/tiles.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def stac_demo(request: Request):
205205

206206
app.add_api_route(
207207
name="Get OGC Tiles Resource",
208-
path="/collections/{collectionId}/items/{itemId}/tiles",
208+
path="/collections/{collection_id}/items/{item_id}/tiles",
209209
response_model=TileSetResource,
210210
response_model_exclude_none=True,
211211
response_model_exclude_unset=True,

stac_fastapi/pgstac/stac_fastapi/pgstac/core.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ async def all_collections(self, **kwargs) -> Collections:
7474
async def get_collection(self, id: str, **kwargs) -> Collection:
7575
"""Get collection by id.
7676
77-
Called with `GET /collections/{collectionId}`.
77+
Called with `GET /collections/{collection_id}`.
7878
7979
Args:
8080
id: Id of the collection.
@@ -179,7 +179,7 @@ async def item_collection(
179179
) -> ItemCollection:
180180
"""Get all items from a specific collection.
181181
182-
Called with `GET /collections/{collectionId}/items`
182+
Called with `GET /collections/{collection_id}/items`
183183
184184
Args:
185185
id: id of the collection.
@@ -203,7 +203,7 @@ async def item_collection(
203203
async def get_item(self, item_id: str, collection_id: str, **kwargs) -> Item:
204204
"""Get item by id.
205205
206-
Called with `GET /collections/{collectionId}/items/{itemId}`.
206+
Called with `GET /collections/{collection_id}/items/{item_id}`.
207207
208208
Args:
209209
id: Id of the item.

stac_fastapi/pgstac/tests/api/test_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
STAC_CORE_ROUTES = [
66
"GET /",
77
"GET /collections",
8-
"GET /collections/{collectionId}",
9-
"GET /collections/{collectionId}/items",
10-
"GET /collections/{collectionId}/items/{itemId}",
8+
"GET /collections/{collection_id}",
9+
"GET /collections/{collection_id}/items",
10+
"GET /collections/{collection_id}/items/{item_id}",
1111
"GET /conformance",
1212
"GET /search",
1313
"POST /search",
1414
]
1515

1616
STAC_TRANSACTION_ROUTES = [
17-
"DELETE /collections/{collectionId}",
18-
"DELETE /collections/{collectionId}/items/{itemId}",
17+
"DELETE /collections/{collection_id}",
18+
"DELETE /collections/{collection_id}/items/{item_id}",
1919
"POST /collections",
20-
"POST /collections/{collectionId}/items",
20+
"POST /collections/{collection_id}/items",
2121
"PUT /collections",
22-
"PUT /collections/{collectionId}/items",
22+
"PUT /collections/{collection_id}/items",
2323
]
2424

2525

stac_fastapi/sqlalchemy/tests/api/test_api.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
STAC_CORE_ROUTES = [
66
"GET /",
77
"GET /collections",
8-
"GET /collections/{collectionId}",
9-
"GET /collections/{collectionId}/items",
10-
"GET /collections/{collectionId}/items/{itemId}",
8+
"GET /collections/{collection_id}",
9+
"GET /collections/{collection_id}/items",
10+
"GET /collections/{collection_id}/items/{item_id}",
1111
"GET /conformance",
1212
"GET /search",
1313
"POST /search",
1414
]
1515

1616
STAC_TRANSACTION_ROUTES = [
17-
"DELETE /collections/{collectionId}",
18-
"DELETE /collections/{collectionId}/items/{itemId}",
17+
"DELETE /collections/{collection_id}",
18+
"DELETE /collections/{collection_id}/items/{item_id}",
1919
"POST /collections",
20-
"POST /collections/{collectionId}/items",
20+
"POST /collections/{collection_id}/items",
2121
"PUT /collections",
22-
"PUT /collections/{collectionId}/items",
22+
"PUT /collections/{collection_id}/items",
2323
]
2424

2525

0 commit comments

Comments
 (0)