Skip to content

Commit

Permalink
Update geopandas_.py to fix the fields test
Browse files Browse the repository at this point in the history
  • Loading branch information
C-Loftus authored Jul 23, 2024
1 parent 72b25cf commit f96862c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion pygeoapi_plugins/provider/geopandas_.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,10 @@ def __init__(self, provider_def: dict):
self.id_field
]

self.fields = self.get_fields()
self._fields = None # Initialize _fields attribute before it is set

self.fields = self.get_fields() # Assign initial fields using get_fields()


def get_fields(self) -> dict[str, any]:
"""
Expand Down Expand Up @@ -292,6 +295,19 @@ def get_fields(self) -> dict[str, any]:

return self._fields

@property
def fields(self) -> dict[str, any]:
"""Return the private _fields attribute if it exists, otherwise set it"""
if hasattr(self, '_fields'):
return self._fields
else:
return self.get_fields()

@fields.setter
def fields(self, fields_dict: dict[str, any]):
"""Set the fields attribute"""
self._fields = fields_dict

@crs_transform
def query(
self,
Expand Down

0 comments on commit f96862c

Please sign in to comment.