From ce419a58476132c42c807cadbda4c0d51f64e1ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Rodrigo?= Date: Wed, 1 May 2024 13:29:20 +0200 Subject: [PATCH] Lint python code --- control/insight.py | 2 +- modules/GeoJSONTypes.py | 10 ++++++---- modules/query_meta.py | 9 +++++---- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/control/insight.py b/control/insight.py index 1dea7ca0..b7c02535 100644 --- a/control/insight.py +++ b/control/insight.py @@ -76,7 +76,7 @@ async def update_matrix( for analyser in matrix: min: Optional[float] = None max: Optional[float] = None - sum = 0 + sum = 0.0 for country in matrix[analyser]: v = matrix[analyser][country][0] min = v if not min or v < min else min diff --git a/modules/GeoJSONTypes.py b/modules/GeoJSONTypes.py index ec717c84..75498b08 100644 --- a/modules/GeoJSONTypes.py +++ b/modules/GeoJSONTypes.py @@ -1,9 +1,11 @@ from typing import Any, Dict, List, Literal + try: - # for python < 3.12 - from typing_extensions import TypedDict -except: - from typing import TypedDict + # for python < 3.12 + from typing_extensions import TypedDict +except ImportError: + from typing import TypedDict + class GeoJSONFeature(TypedDict): type: Literal["Feature"] diff --git a/modules/query_meta.py b/modules/query_meta.py index 288f3c17..23656296 100644 --- a/modules/query_meta.py +++ b/modules/query_meta.py @@ -1,10 +1,11 @@ from collections import defaultdict from typing import Any, Dict, List, Optional + try: - # for python < 3.12 - from typing_extensions import TypedDict -except: - from typing import TypedDict + # for python < 3.12 + from typing_extensions import TypedDict +except ImportError: + from typing import TypedDict from asyncpg import Connection