From 51be73b747829972fe6bf8fdcc76b2328fc82ed1 Mon Sep 17 00:00:00 2001 From: Hassan Kibirige Date: Fri, 26 Jul 2024 21:59:28 +0300 Subject: [PATCH] TYP: Fix typechecking --- plotnine/geoms/geom_map.py | 2 +- plotnine/stats/stat_density.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/plotnine/geoms/geom_map.py b/plotnine/geoms/geom_map.py index 9b115dec9..c32288753 100644 --- a/plotnine/geoms/geom_map.py +++ b/plotnine/geoms/geom_map.py @@ -293,7 +293,7 @@ def ccw_coords(ring: LinearRing) -> npt.NDArray[Any]: # and the interiors _exterior = [] _interior = [] - for p in obj.geoms: + for p in obj.geoms: # type: ignore _exterior.append(Path(cw_coords(p.exterior))) _interior.extend([Path(ccw_coords(ring)) for ring in p.interiors]) diff --git a/plotnine/stats/stat_density.py b/plotnine/stats/stat_density.py index d05c2635f..1ee3fa9a7 100644 --- a/plotnine/stats/stat_density.py +++ b/plotnine/stats/stat_density.py @@ -227,7 +227,11 @@ def compute_density(x, weight, range, **params): # Evaluating values beyond the ptp range helps us calculate a # boundary corrections. So we widen the range over which we will # evaluate, so that it contains all points supported by the grid. - x2 = np.linspace(kde.support[0], kde.support[-1], params["n"]) + x2 = np.linspace( + kde.support[0], # pyright: ignore + kde.support[-1], # pyright: ignore + params["n"], + ) else: x2 = np.linspace(range[0], range[1], params["n"]) @@ -294,7 +298,7 @@ def nrd0(x: FloatArrayLike) -> float: ) std: float = np.std(x, ddof=1) # pyright: ignore - std_estimate: float = iqr(x) / 1.349 # pyright: ignore + std_estimate: float = iqr(x) / 1.349 low_std = min(std, std_estimate) if low_std == 0: low_std = std_estimate or np.abs(np.asarray(x)[0]) or 1