aboutsummaryrefslogtreecommitdiffstats
path: root/fnme
diff options
context:
space:
mode:
Diffstat (limited to 'fnme')
-rw-r--r--fnme/cli.py4
-rw-r--r--fnme/data.py2
-rw-r--r--fnme/station.py10
3 files changed, 7 insertions, 9 deletions
diff --git a/fnme/cli.py b/fnme/cli.py
index 3d7d72e..7c0d49d 100644
--- a/fnme/cli.py
+++ b/fnme/cli.py
@@ -1,6 +1,6 @@
import argparse
import sys
-from typing import Any, Dict, List
+from typing import Any
from tabulate import tabulate
@@ -36,7 +36,7 @@ def _fmt_price(v: float | None) -> str:
return f"{v:.2f}" if v is not None else "N/A"
-def output_stations(stations: List[Dict[str, Any]]) -> None:
+def output_stations(stations: list[dict[str, Any]]) -> None:
if not stations:
print("[*] No stations found.")
return
diff --git a/fnme/data.py b/fnme/data.py
index 17f30c5..11497ce 100644
--- a/fnme/data.py
+++ b/fnme/data.py
@@ -1,6 +1,4 @@
-import os
from pathlib import Path
-from typing import Optional
import pandas as pd
import requests
diff --git a/fnme/station.py b/fnme/station.py
index 6f5427a..75afc6f 100644
--- a/fnme/station.py
+++ b/fnme/station.py
@@ -1,5 +1,5 @@
import math
-from typing import Any, Dict, List, Tuple
+from typing import Any
import numpy as np
import pandas as pd
@@ -10,7 +10,7 @@ _PRICE_KEYS = ("e5_price", "e10_price", "diesel_price")
def _bounding_box(
- dframe: pd.DataFrame, loc: Tuple[float, float], rad: int
+ dframe: pd.DataFrame, loc: tuple[float, float], rad: int
) -> pd.DataFrame:
lat, lon = loc
deg_lat = rad / 69.0
@@ -26,7 +26,7 @@ def _bounding_box(
def _haversine_miles(
- loc: Tuple[float, float], lat2: np.ndarray, lon2: np.ndarray
+ loc: tuple[float, float], lat2: np.ndarray, lon2: np.ndarray
) -> np.ndarray:
R = 3958.8
lat1, lon1 = np.radians(loc[0]), np.radians(loc[1])
@@ -45,8 +45,8 @@ def _pence_to_pounds(col: pd.Series) -> pd.Series:
def process_stations(
- dframe: pd.DataFrame, rad: int, loc: Tuple[float, float]
-) -> List[Dict[str, Any]]:
+ dframe: pd.DataFrame, rad: int, loc: tuple[float, float]
+) -> list[dict[str, Any]]:
df = _bounding_box(dframe, loc, rad).copy()
git.ajschof.me — hosted by ajschofield — powered by cgit