Skip to content

Commit 4285863

Browse files
committed
rename base_edr instance functions (#2298)
1 parent a80043a commit 4285863

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

docs/source/plugins.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -306,11 +306,11 @@ The below template provides a minimal example (let's call the file ``mycooledrda
306306
307307
self.covjson = {...}
308308
309-
def get_instances(self):
309+
def instances(self):
310310
return ['foo', 'bar']
311311
312-
def get_instance(self, instance):
313-
return instance in get_instances()
312+
def instance(self, instance):
313+
return instance in instances()
314314
315315
def position(self, **kwargs):
316316
return self.covjson
@@ -320,8 +320,8 @@ The below template provides a minimal example (let's call the file ``mycooledrda
320320
321321
322322
For brevity, the ``position`` function returns ``self.covjson`` which is a
323-
dictionary of a CoverageJSON representation. ``get_instances`` returns a list
324-
of instances associated with the collection/plugin, and ``get_instance`` returns
323+
dictionary of a CoverageJSON representation. ``instances`` returns a list
324+
of instances associated with the collection/plugin, and ``instance`` returns
325325
a boolean of whether a given instance exists/is valid. EDR query types are subject
326326
to the query functions defined in the plugin. In the example above, the plugin
327327
implements ``position`` and ``trajectory`` queries, which will be advertised as

pygeoapi/api/environmental_data_retrieval.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ def get_collection_edr_instances(api: API, request: APIRequest,
113113

114114
if instance_id is not None:
115115
try:
116-
if p.get_instance(instance_id):
116+
if p.instance(instance_id):
117117
instances = [instance_id]
118118
except ProviderItemNotFoundError:
119119
msg = 'Instance not found'
120120
return api.get_exception(
121121
HTTPStatus.NOT_FOUND, headers, request.format, 'NotFound', msg)
122122
else:
123-
instances = p.get_instances()
123+
instances = p.instances()
124124

125125
for instance in instances:
126126
instance_dict = {
@@ -281,7 +281,7 @@ def get_collection_edr_query(api: API, request: APIRequest,
281281
err.http_status_code, headers, request.format,
282282
err.ogc_exception_code, err.message)
283283

284-
if instance is not None and not p.get_instance(instance):
284+
if instance is not None and not p.instance(instance):
285285
msg = 'Invalid instance identifier'
286286
return api.get_exception(
287287
HTTPStatus.BAD_REQUEST, headers,

pygeoapi/provider/base_edr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init_subclass__(cls, **kwargs):
7878
'but requests will be routed to a feature provider'
7979
)
8080

81-
def get_instances(self):
81+
def instances(self):
8282
"""
8383
Get a list of instance identifiers
8484
@@ -87,7 +87,7 @@ def get_instances(self):
8787

8888
return NotImplementedError()
8989

90-
def get_instance(self, instance):
90+
def instance(self, instance):
9191
"""
9292
Validate instance identifier
9393

0 commit comments

Comments
 (0)