Skip to content

Commit

Permalink
Apply pre-commit fix
Browse files Browse the repository at this point in the history
From the artifact of the previous workflow run
  • Loading branch information
geo-ghci-int[bot] committed Dec 10, 2024
1 parent bbf2831 commit e0ef724
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions geoportal/c2cgeoportal_geoportal/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
from json.decoder import JSONDecodeError
from typing import Any


import geojson
import pyramid.request
import requests
Expand All @@ -42,6 +41,7 @@

from c2cgeoportal_geoportal.lib.common_headers import Cache, set_common_headers
from c2cgeoportal_geoportal.views.raster import Raster

_LOG = logging.getLogger(__name__)

_ = TranslationStringFactory("c2cgeoportal")
Expand All @@ -52,9 +52,9 @@ class Profile(Raster):

def __init__(self, request: pyramid.request.Request):
Raster.__init__(self, request)

@staticmethod
def _to_filtered(points: list[dict[str, Any]], layers:list[str])-> list[dict[str, Any]]:
def _to_filtered(points: list[dict[str, Any]], layers: list[str]) -> list[dict[str, Any]]:
profile = []
for point in points:
filtered_alts = {key: value for key, value in point["alts"].items() if key in layers}
Expand All @@ -67,10 +67,10 @@ def _to_filtered(points: list[dict[str, Any]], layers:list[str])-> list[dict[str
}
)
return profile

def _get_profile_service_data(
self, layers: list[str], geom: dict[str, Any], rasters: dict[str, Any], nb_points: int
)-> dict[str, Any]:
) -> dict[str, Any]:
request = (
f"{rasters[layers[0]]['url']}/profile.json?geom={geom}&nbPoints={nb_points}&distinct_points=true"
)
Expand Down Expand Up @@ -114,7 +114,7 @@ def _compute_points(self) -> tuple[list[str], list[dict[str, Any]]]:
layers = list(rasters.keys())
layers.sort()

service_layers = [layer for layer in layers if rasters[layer].get('type') == 'external_url']
service_layers = [layer for layer in layers if rasters[layer].get("type") == "external_url"]

if len(service_layers) > 0:
urls = [rasters[layer]["url"] for layer in service_layers]
Expand Down
8 changes: 4 additions & 4 deletions geoportal/c2cgeoportal_geoportal/views/raster.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,12 @@ def raster(self) -> dict[str, Any]:

result = {}

service_layers = [layer for layer in layers if rasters[layer].get('type') == 'external_url']
service_layers = [layer for layer in layers if rasters[layer].get("type") == "external_url"]

if len(service_layers) > 0:
for layer in service_layers:
result.update(self._get_service_data(layer, lat, lon, rasters))

for ref in list(rasters.keys()):
if ref not in service_layers:
result[ref] = self._get_raster_value(rasters[ref], ref, lon, lat)
Expand Down Expand Up @@ -212,7 +212,7 @@ def _get_service_data(
set_common_headers(self.request, "raster", Cache.PUBLIC_NO)

return {layer: result}

@staticmethod
def _round(value: numpy.float32, round_to: float) -> decimal.Decimal | None:
if value is not None:
Expand Down

0 comments on commit e0ef724

Please sign in to comment.