From 45fdd8c7a2abefff7a307a35b49ecbe9befb553f Mon Sep 17 00:00:00 2001 From: Christian Ledermann Date: Mon, 13 Nov 2023 17:45:09 +0000 Subject: [PATCH] update type annotations for mypy 1.7 --- pygeoif/functions.py | 9 +++------ pygeoif/geometry.py | 4 +--- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/pygeoif/functions.py b/pygeoif/functions.py index d9f5190d..19cd7b75 100644 --- a/pygeoif/functions.py +++ b/pygeoif/functions.py @@ -44,12 +44,9 @@ def signed_area(coords: LineType) -> float: xs, ys = map(list, zip(*(coord[:2] for coord in coords))) xs.append(xs[1]) # pragma: no mutate ys.append(ys[1]) # pragma: no mutate - return ( - sum( - xs[i] * (ys[i + 1] - ys[i - 1]) # type: ignore [operator] - for i in range(1, len(coords)) - ) - / 2.0 + return cast( + float, + sum(xs[i] * (ys[i + 1] - ys[i - 1]) for i in range(1, len(coords))) / 2.0, ) diff --git a/pygeoif/geometry.py b/pygeoif/geometry.py index 58ed051a..fdbe7164 100644 --- a/pygeoif/geometry.py +++ b/pygeoif/geometry.py @@ -955,9 +955,7 @@ def __init__(self, polygons: Sequence[PolygonType], unique: bool = False) -> Non tuple( Polygon( shell=polygon[0], - holes=polygon[1] # type: ignore [misc] - if len(polygon) == 2 # noqa: PLR2004 - else None, + holes=polygon[1] if len(polygon) == 2 else None, # noqa: PLR2004 ) for polygon in polygons ),