now working
Some checks failed
Build and deploy the backend to staging / Build and push image (pull_request) Successful in 1m38s
Run linting on the backend code / Build (pull_request) Successful in 26s
Run testing on the backend code / Build (pull_request) Failing after 2m50s
Build and deploy the backend to staging / Deploy to staging (pull_request) Successful in 24s

This commit is contained in:
2025-01-28 11:52:07 +01:00
parent 4a904c3d3c
commit 2ac8499dfb
9 changed files with 89 additions and 80 deletions

View File

@@ -59,7 +59,7 @@ class JSONCache(CachingStrategyBase):
with open(filename, 'r', encoding='utf-8') as file:
data = json.load(file)
return data # Return the parsed JSON data
except json.JSONDecodeError as err:
except json.JSONDecodeError:
return None # Return None if parsing fails
return None
@@ -73,8 +73,8 @@ class JSONCache(CachingStrategyBase):
except IOError as e:
raise IOError(f"Error writing to cache file: {filename} - {e}") from e
def set_hollow(self, key, cell: tuple, osm_types: OSM_TYPES,
selector: str, conditions=[], out='center'):
def set_hollow(self, key, cell: tuple, osm_types: list,
selector: str, conditions: list=None, out='center'):
"""Create an empty placeholder cache entry for a future fill."""
hollow_key = f'hollow_{key}'
filename = self._filename(hollow_key)
@@ -85,7 +85,7 @@ class JSONCache(CachingStrategyBase):
"cell": list(cell),
"osm_types": list(osm_types),
"selector": selector,
"conditions": conditions if conditions else "none",
"conditions": conditions,
"out": out
}
# Write the hollow data to the cache file
@@ -130,11 +130,6 @@ class CachingStrategy:
@classmethod
def set_hollow(cls, key, cell: tuple, osm_types: OSM_TYPES,
selector: str, conditions=[], out='center'):
selector: str, conditions: list=None, out='center'):
"""Create a hollow cache entry."""
cls.__strategy.set_hollow(key, cell, osm_types, selector, conditions, out)
@classmethod
def fill_hollow(cls, key, value):
"""Fill in the hollow cache entry with actual data."""
cls.__strategy.fill_hollow(key, value)