Skip to content

Commit b6e73ac

Browse files
committed
Mypy fixes
1 parent 231454f commit b6e73ac

File tree

3 files changed

+13
-17
lines changed

3 files changed

+13
-17
lines changed

src/meteole/forecast.py

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
import tempfile
77
from abc import abstractmethod
88
from pathlib import Path
9-
from typing import Dict, List, Optional
109

1110
import pandas as pd
1211
import xarray as xr
@@ -59,7 +58,7 @@ def __init__(
5958
self.precision = precision
6059
self._validate_parameters()
6160

62-
self.folderpath: Optional[Path] = None
61+
self.folderpath: Path | None = None
6362
self.get_capabilities()
6463

6564
def get_capabilities(self) -> pd.DataFrame:
@@ -111,7 +110,7 @@ def _get_available_feature(grid_axis, feature_name):
111110
features = [int(feature) for feature in features]
112111
return features
113112

114-
def get_coverage_description(self, coverage_id: str) -> Dict:
113+
def get_coverage_description(self, coverage_id: str) -> dict:
115114
"""This endpoint returns the available axis (times, heights) to properly query coverage
116115
117116
TODO: other informations can be fetched from this endpoint, not yet implemented.
@@ -136,7 +135,7 @@ def get_coverage_description(self, coverage_id: str) -> Dict:
136135

137136
def get_coverages(
138137
self,
139-
coverage_ids: List[str],
138+
coverage_ids: list[str],
140139
lat: tuple = const.FRANCE_METRO_LATITUDES,
141140
long: tuple = const.FRANCE_METRO_LONGITUDES,
142141
) -> pd.DataFrame:
@@ -159,8 +158,8 @@ def get_coverages(
159158
def _get_coverage_id(
160159
self,
161160
indicator: str,
162-
run: Optional[str] = None,
163-
interval: Optional[str] = None,
161+
run: str | None = None,
162+
interval: str | None = None,
164163
) -> str:
165164
"""
166165
Get a coverage_id from `capabilities`.
@@ -234,9 +233,9 @@ def get_coverage(
234233
indicator: str | None = None,
235234
lat: tuple = const.FRANCE_METRO_LATITUDES,
236235
long: tuple = const.FRANCE_METRO_LONGITUDES,
237-
heights: List[int] | None = None,
238-
pressures: List[int] | None = None,
239-
forecast_horizons: List[int] | None = None,
236+
heights: list[int] | None = None,
237+
pressures: list[int] | None = None,
238+
forecast_horizons: list[int] | None = None,
240239
run: str | None = None,
241240
interval: str | None = None,
242241
coverage_id: str = "",
@@ -288,8 +287,8 @@ def get_coverage(
288287
return pd.concat(df_list, axis=0).reset_index(drop=True)
289288

290289
def _raise_if_invalid_or_fetch_default(
291-
self, param_name: str, inputs: List[int] | None, availables: List[int]
292-
) -> List[int]:
290+
self, param_name: str, inputs: list[int] | None, availables: list[int]
291+
) -> list[int]:
293292
"""
294293
Checks if the elements in `inputs` are in `availables` and raises a ValueError if not.
295294
If `inputs` is empty or None, uses the first element from `availables` as the default value.
@@ -345,7 +344,7 @@ def instant_indicators(self) -> str:
345344
"""The list of instant indicators"""
346345
pass
347346

348-
def _get_capabilities(self) -> Dict:
347+
def _get_capabilities(self) -> dict:
349348
"""The Capabilities of the AROME/ARPEGE service."""
350349

351350
url = f"{self.base_url}/{self.entry_point}/GetCapabilities"

src/meteole/raster.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
"""Functionnalities to deal with the raster data"""
2-
from typing import Optional
3-
42
import cartopy.crs as ccrs
53
import matplotlib.pyplot as plt
64
import rasterio
@@ -19,7 +17,7 @@ def plot_tiff_file(
1917
filename,
2018
data_type: str,
2119
unit: str,
22-
title: Optional[str] = None,
20+
title: str | None = None,
2321
):
2422
"""
2523
Plot a tiff file.

src/meteole/vigilance.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import logging
22
from io import BytesIO
3-
from typing import Tuple
43

54
import matplotlib.image as mpimg
65
import matplotlib.pyplot as plt
@@ -89,7 +88,7 @@ def get_carte_vigilance(self) -> dict:
8988

9089
return req.json()
9190

92-
def get_phenomenon(self) -> Tuple[pd.DataFrame, pd.DataFrame]:
91+
def get_phenomenon(self) -> tuple[pd.DataFrame, pd.DataFrame]:
9392
"""
9493
get risk prediction by phenomenon and by domain
9594
Returns:

0 commit comments

Comments
 (0)