From bc1bf2869a217ac736034fc6d5c0ddcbf0345d34 Mon Sep 17 00:00:00 2001 From: Ali Hamdan Date: Sun, 31 May 2026 22:18:40 +0200 Subject: [PATCH] Add pyrefly --- .github/workflows/tests.yml | 12 ++++ pyproject.toml | 20 +++++-- run.py | 1 + stubs/pandapower-stubs/auxiliary.pyi | 2 +- .../plotting/plotly/draw_layers.pyi | 2 +- .../plotting/plotly/layers_plotly.pyi | 2 +- .../plotting/plotly/pf_res_plotly.pyi | 2 +- .../plotting/plotly/simple_plotly.pyi | 2 +- .../plotting/plotly/traces.pyi | 2 +- .../plotting/plotly/vlevel_plotly.pyi | 2 +- .../topology/graph_tool_interface.pyi | 2 +- stubs/psqlextra-stubs/error.pyi | 2 +- tests/__init__.py | 8 +-- tests/geopandas/test_explore.py | 8 +-- tests/geopandas/test_geodataframe.py | 32 +++++----- tests/geopandas/test_geoseries.py | 18 +++--- tests/geopandas/test_io.py | 4 +- tests/shapely/test_affinity.py | 6 +- tests/shapely/test_constructive.py | 4 +- tests/shapely/test_coordinates.py | 6 +- tests/shapely/test_creation.py | 14 ++--- tests/shapely/test_geometry.py | 58 ++++++++++--------- tests/shapely/test_io.py | 6 +- tests/shapely/test_linear.py | 12 ++-- tests/shapely/test_ops.py | 4 +- tests/shapely/test_set_operations.py | 21 +++---- tests/shapely/test_strtree.py | 10 ++-- uv.lock | 19 ++++++ 28 files changed, 164 insertions(+), 117 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 429459d..d32432d 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -95,3 +95,15 @@ jobs: - name: Install dependencies run: uv sync --frozen - run: uv run python run.py ty-check + pyrefly: + name: Run pyrefly on the tests and on the stubs + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - name: Install uv + uses: astral-sh/setup-uv@v7 + with: + save-cache: "false" + - name: Install dependencies + run: uv sync --frozen + - run: uv run python run.py pyrefly-check diff --git a/pyproject.toml b/pyproject.toml index 3c2ef6b..9645787 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dev = [ "mypy[native-parser]>=2.1.0", "pyright>=1.1.409", "ty>=0.0.40", + "pyrefly>=1.0.0", { include-group = "tests" }, ] @@ -94,9 +95,6 @@ native_parser = true # Project settings stubPath = "stubs/" enableTypeIgnoreComments = false # Leave "type: ignore" comments to mypy -ignore = [ - "**/site-packages/", # Disable annoying checks in third-party library code -] # Strict mode typeCheckingMode = "strict" @@ -124,8 +122,22 @@ reportSelfClsParameterName = "none" [tool.ty] analysis.respect-type-ignore-comments = false -rules.invalid-method-override = "ignore" # out of control of the stubs (inherited from implementation) terminal.output-format = "concise" +[tool.ty.rules] +deprecated = "error" +invalid-method-override = "ignore" # out of control of the stubs (inherited from implementation) + +[tool.pyrefly] +search-path = ["stubs/"] +enabled-ignores = ["pyrefly"] +output-format = "min-text" + +[tool.pyrefly.errors] +deprecated = "error" +# Out of control of the stubs (inherited from implementation) +bad-override = false +inconsistent-inheritance = false + [tool.pytest.ini_options] testpaths = ["tests"] diff --git a/run.py b/run.py index 9223fae..d90f494 100755 --- a/run.py +++ b/run.py @@ -16,6 +16,7 @@ "mypy": ["tests", "stubs"], "pyright": ["tests", "stubs"], "ty-check": ["tests", "stubs"], + "pyrefly-check": ["tests", "stubs"], "stubtest": ["--allowlist=stubtest_allowlist.txt", "pandapower", "pyogrio"], "pytest": [], } diff --git a/stubs/pandapower-stubs/auxiliary.pyi b/stubs/pandapower-stubs/auxiliary.pyi index 1afe665..e62a82f 100644 --- a/stubs/pandapower-stubs/auxiliary.pyi +++ b/stubs/pandapower-stubs/auxiliary.pyi @@ -131,7 +131,7 @@ class GeoAccessor: @property def type(self) -> str: ... @property - def as_shapely_obj(self) -> pd.Series[BaseGeometry]: ... # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-type-arguments] + def as_shapely_obj(self) -> pd.Series[BaseGeometry]: ... # type: ignore[type-var] # pyright: ignore[reportInvalidTypeArguments] # ty:ignore[invalid-type-arguments] # pyrefly:ignore[bad-specialization] @property def as_geoseries(self) -> gpd.GeoSeries: ... def __getattr__(self, item: str) -> Any: ... diff --git a/stubs/pandapower-stubs/plotting/plotly/draw_layers.pyi b/stubs/pandapower-stubs/plotting/plotly/draw_layers.pyi index 461a05c..53346db 100644 --- a/stubs/pandapower-stubs/plotting/plotly/draw_layers.pyi +++ b/stubs/pandapower-stubs/plotting/plotly/draw_layers.pyi @@ -2,7 +2,7 @@ from collections.abc import Sequence from pathlib import Path from typing import Any, Literal -import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] def version_check() -> None: ... def draw_layers( diff --git a/stubs/pandapower-stubs/plotting/plotly/layers_plotly.pyi b/stubs/pandapower-stubs/plotting/plotly/layers_plotly.pyi index e581712..096ef57 100644 --- a/stubs/pandapower-stubs/plotting/plotly/layers_plotly.pyi +++ b/stubs/pandapower-stubs/plotting/plotly/layers_plotly.pyi @@ -1,7 +1,7 @@ from _typeshed import SupportsGetItem from typing import Literal -import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] from pandapower.auxiliary import pandapowerNet diff --git a/stubs/pandapower-stubs/plotting/plotly/pf_res_plotly.pyi b/stubs/pandapower-stubs/plotting/plotly/pf_res_plotly.pyi index 0b15962..94ded48 100644 --- a/stubs/pandapower-stubs/plotting/plotly/pf_res_plotly.pyi +++ b/stubs/pandapower-stubs/plotting/plotly/pf_res_plotly.pyi @@ -1,6 +1,6 @@ from typing import Literal -import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] from pandapower.auxiliary import pandapowerNet from pandapower.plotting.plotly.mapbox_plot import * diff --git a/stubs/pandapower-stubs/plotting/plotly/simple_plotly.pyi b/stubs/pandapower-stubs/plotting/plotly/simple_plotly.pyi index 850afb7..eec845e 100644 --- a/stubs/pandapower-stubs/plotting/plotly/simple_plotly.pyi +++ b/stubs/pandapower-stubs/plotting/plotly/simple_plotly.pyi @@ -2,7 +2,7 @@ from collections.abc import Iterable, Mapping from typing import Any, Literal, overload import pandas as pd -import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] from pandapower.auxiliary import pandapowerNet from pandapower.plotting.plotly.mapbox_plot import * diff --git a/stubs/pandapower-stubs/plotting/plotly/traces.pyi b/stubs/pandapower-stubs/plotting/plotly/traces.pyi index d65dc79..1d65367 100644 --- a/stubs/pandapower-stubs/plotting/plotly/traces.pyi +++ b/stubs/pandapower-stubs/plotting/plotly/traces.pyi @@ -3,7 +3,7 @@ from collections.abc import Collection, Iterable, Mapping from typing import Any, Literal import pandas as pd -import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] from pandapower._typing import Float, Int from pandapower.auxiliary import pandapowerNet diff --git a/stubs/pandapower-stubs/plotting/plotly/vlevel_plotly.pyi b/stubs/pandapower-stubs/plotting/plotly/vlevel_plotly.pyi index 7e7b9f9..5f2e08f 100644 --- a/stubs/pandapower-stubs/plotting/plotly/vlevel_plotly.pyi +++ b/stubs/pandapower-stubs/plotting/plotly/vlevel_plotly.pyi @@ -1,6 +1,6 @@ from typing import Literal -import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +import plotly.graph_objs as go # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] from pandapower.auxiliary import pandapowerNet from pandapower.plotting.plotly.traces import _MapStyle diff --git a/stubs/pandapower-stubs/topology/graph_tool_interface.pyi b/stubs/pandapower-stubs/topology/graph_tool_interface.pyi index 4c10cee..699d8fb 100644 --- a/stubs/pandapower-stubs/topology/graph_tool_interface.pyi +++ b/stubs/pandapower-stubs/topology/graph_tool_interface.pyi @@ -2,7 +2,7 @@ from _typeshed import Incomplete from collections.abc import Iterable from typing import Literal -from graph_tool import ( # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +from graph_tool import ( # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] Graph, ) diff --git a/stubs/psqlextra-stubs/error.pyi b/stubs/psqlextra-stubs/error.pyi index 58d869e..40f82e6 100644 --- a/stubs/psqlextra-stubs/error.pyi +++ b/stubs/psqlextra-stubs/error.pyi @@ -1,5 +1,5 @@ from django import db -from psycopg import ( # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] +from psycopg import ( # type: ignore[import-not-found] # pyright: ignore[reportMissingImports] # ty:ignore[unresolved-import] # pyrefly:ignore[missing-import] Error as _Psycopg3Error, ) from psycopg2 import Error as _Psycopg2Error diff --git a/tests/__init__.py b/tests/__init__.py index 7518837..9b86512 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -7,7 +7,7 @@ import numpy as np from shapely.geometry.base import BaseMultipartGeometry, GeometrySequence -type _ClassInfo = type | UnionType | tuple["_ClassInfo", ...] # see isinstance +type _ClassInfo = type | UnionType | tuple[_ClassInfo, ...] # see isinstance # Make stubs generic classes generic at runtime setattr(BaseMultipartGeometry, "__class_getitem__", classmethod(GenericAlias)) @@ -16,20 +16,20 @@ def check[T](obj: T, cls: _ClassInfo, dtype: _ClassInfo | None = None) -> T: __tracebackhide__ = True - if not isinstance(obj, cls): + if not isinstance(obj, cls): # pyrefly:ignore[invalid-argument] raise RuntimeError(f"Expected type '{cls}' but got '{type(obj)}'") if dtype is None: return obj value: Any if isinstance(obj, np.ndarray): - value = np.asarray(obj).flatten()[0] # pyright: ignore[reportUnknownArgumentType] + value = np.asarray(obj).flatten()[0] # pyright:ignore[reportUnknownArgumentType] elif hasattr(obj, "__iter__"): value = next(iter(cast(Iterable[Any], obj))) else: value = obj - if not isinstance(value, dtype): + if not isinstance(value, dtype): # pyrefly:ignore[invalid-argument] raise RuntimeError(f"Expected type '{dtype}' but got '{type(value)}'") return obj diff --git a/tests/geopandas/test_explore.py b/tests/geopandas/test_explore.py index 34d597b..06f3006 100644 --- a/tests/geopandas/test_explore.py +++ b/tests/geopandas/test_explore.py @@ -14,8 +14,8 @@ def test_explore() -> None: if TYPE_CHECKING: assert_type(GDF.explore(tooltip=False, popup=True, k=4, map_kwds={}), folium.Map) assert_type(_explore(GDF, tooltip=False, popup=True, k=4, map_kwds={}), folium.Map) - GDF.explore(map_kwds=False) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] - _explore(GDF, map_kwds=False) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + GDF.explore(map_kwds=False) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] + _explore(GDF, map_kwds=False) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] def test_geoseries_explore() -> None: @@ -27,5 +27,5 @@ def test_geoseries_explore() -> None: _explore_geoseries(GDF.geometry, highlight=False, control_scale=False, map_kwds={}), folium.Map, ) - GDF.geometry.explore(map_kwds=False) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] - _explore_geoseries(GDF.geometry, map_kwds=False) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + GDF.geometry.explore(map_kwds=False) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] + _explore_geoseries(GDF.geometry, map_kwds=False) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] diff --git a/tests/geopandas/test_geodataframe.py b/tests/geopandas/test_geodataframe.py index 5fdcf20..87245f0 100644 --- a/tests/geopandas/test_geodataframe.py +++ b/tests/geopandas/test_geodataframe.py @@ -30,9 +30,9 @@ def test_geometry() -> None: gdf.geometry = geo.values gdf.geometry = [Point(1, 2), Point(3, 4)] with pytest.raises(Exception): - gdf.geometry = "geometry" # type: ignore[assignment] # pyright: ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] + gdf.geometry = "geometry" # type: ignore[assignment] # pyright:ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - gdf.geometry = [1, 2] # type: ignore[list-item] # pyright: ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] + gdf.geometry = [1, 2] # type: ignore[list-item] # pyright:ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] # pyrefly:ignore[bad-argument-type] # set_geometry check(assert_type(gdf.set_geometry(geo), GeoDataFrame), GeoDataFrame) @@ -41,7 +41,7 @@ def test_geometry() -> None: check(assert_type(gdf.set_geometry([Point(1, 2), Point(3, 4)]), GeoDataFrame), GeoDataFrame) check(assert_type(gdf.set_geometry("geometry"), GeoDataFrame), GeoDataFrame) with pytest.raises(Exception): - gdf.set_geometry([1, 2]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] + gdf.set_geometry([1, 2]) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # pyrefly:ignore[bad-argument-type] # rename_geometry check(assert_type(gdf.rename_geometry("geom"), GeoDataFrame), GeoDataFrame) @@ -66,7 +66,7 @@ def test_crs() -> None: gdf.crs = "EPSG:4326" gdf.crs = 4326 with pytest.raises(Exception): - gdf.crs = 1.5 # type: ignore[assignment] # pyright: ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] + gdf.crs = 1.5 # type: ignore[assignment] # pyright:ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] # pyrefly:ignore[bad-argument-type] # set_crs check(assert_type(gdf.set_crs(crs), GeoDataFrame), GeoDataFrame) @@ -76,11 +76,11 @@ def test_crs() -> None: check(assert_type(gdf.set_crs(crs=4326), GeoDataFrame), GeoDataFrame) check(assert_type(gdf.set_crs(epsg=4326), GeoDataFrame), GeoDataFrame) with pytest.raises(Exception): - gdf.set_crs() # type: ignore[call-overload] # pyright: ignore[reportCallIssue] # ty:ignore[no-matching-overload] + gdf.set_crs() # type: ignore[call-overload] # pyright:ignore[reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gdf.set_crs(None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gdf.set_crs(None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - gdf.set_crs(None, None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + gdf.set_crs(None, None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] # to_crs check(assert_type(gdf.to_crs(crs), GeoDataFrame), GeoDataFrame) @@ -90,24 +90,24 @@ def test_crs() -> None: check(assert_type(gdf.to_crs(crs=4326), GeoDataFrame), GeoDataFrame) check(assert_type(gdf.to_crs(epsg=4326), GeoDataFrame), GeoDataFrame) with pytest.raises(Exception): - gdf.to_crs() # type: ignore[call-overload] # pyright: ignore[reportCallIssue] # ty:ignore[no-matching-overload] + gdf.to_crs() # type: ignore[call-overload] # pyright:ignore[reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gdf.to_crs(None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gdf.to_crs(None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - gdf.to_crs(None, None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + gdf.to_crs(None, None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gdf.to_crs(inplace=True) # type: ignore[call-overload] # pyright: ignore[reportCallIssue] # ty:ignore[no-matching-overload] + gdf.to_crs(inplace=True) # type: ignore[call-overload] # pyright:ignore[reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gdf.to_crs(None, inplace=True) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + gdf.to_crs(None, inplace=True) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gdf.to_crs(None, None, inplace=True) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + gdf.to_crs(None, None, inplace=True) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gdf.to_crs(None, None, True) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + gdf.to_crs(None, None, True) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] # estimate_utm_crs check(assert_type(gdf.estimate_utm_crs(), CRS), CRS) check(assert_type(gdf.estimate_utm_crs("WGS 84"), CRS), CRS) with pytest.raises(Exception): - gdf.estimate_utm_crs(84) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gdf.estimate_utm_crs(84) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - gdf.estimate_utm_crs(CRS) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gdf.estimate_utm_crs(CRS) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] diff --git a/tests/geopandas/test_geoseries.py b/tests/geopandas/test_geoseries.py index a836f6e..38639ba 100644 --- a/tests/geopandas/test_geoseries.py +++ b/tests/geopandas/test_geoseries.py @@ -43,7 +43,7 @@ def test_crs() -> None: gs.crs = 4326 assert isinstance(gs.crs, CRS) with pytest.raises(Exception): - gs.crs = 1.5 # type: ignore[assignment] # pyright: ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] + gs.crs = 1.5 # type: ignore[assignment] # pyright:ignore[reportAttributeAccessIssue] # ty:ignore[invalid-assignment] # pyrefly:ignore[bad-argument-type] # set_crs check(assert_type(gs.set_crs(crs), GeoSeries), GeoSeries) @@ -53,11 +53,11 @@ def test_crs() -> None: check(assert_type(gs.set_crs(crs=4326), GeoSeries), GeoSeries) check(assert_type(gs.set_crs(epsg=4326), GeoSeries), GeoSeries) with pytest.raises(Exception): - gs.set_crs() # type: ignore[call-overload] # pyright: ignore[reportCallIssue] # ty:ignore[no-matching-overload] + gs.set_crs() # type: ignore[call-overload] # pyright:ignore[reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gs.set_crs(None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gs.set_crs(None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - gs.set_crs(None, None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + gs.set_crs(None, None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] # to_crs check(assert_type(gs.to_crs(crs), GeoSeries), GeoSeries) @@ -65,16 +65,16 @@ def test_crs() -> None: check(assert_type(gs.to_crs(crs=4326), GeoSeries), GeoSeries) check(assert_type(gs.to_crs(epsg=4326), GeoSeries), GeoSeries) with pytest.raises(Exception): - gs.to_crs() # type: ignore[call-overload] # pyright: ignore[reportCallIssue] # ty:ignore[no-matching-overload] + gs.to_crs() # type: ignore[call-overload] # pyright:ignore[reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - gs.to_crs(None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gs.to_crs(None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - gs.to_crs(None, None) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + gs.to_crs(None, None) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] # estimate_utm_crs check(assert_type(gs.estimate_utm_crs(), CRS), CRS) check(assert_type(gs.estimate_utm_crs("WGS 84"), CRS), CRS) with pytest.raises(Exception): - gs.estimate_utm_crs(84) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gs.estimate_utm_crs(84) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - gs.estimate_utm_crs(CRS) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gs.estimate_utm_crs(CRS) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] diff --git a/tests/geopandas/test_io.py b/tests/geopandas/test_io.py index a257c8f..127f535 100644 --- a/tests/geopandas/test_io.py +++ b/tests/geopandas/test_io.py @@ -33,7 +33,7 @@ def test_read_file(tmp_path: Path) -> None: assert not isinstance(df, gpd.GeoDataFrame) with pytest.raises(Exception): - gpd.read_file(file, engine="toto") # type: ignore[call-overload] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + gpd.read_file(file, engine="toto") # type: ignore[call-overload] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[no-matching-overload] def test_infer_schema() -> None: @@ -41,7 +41,7 @@ def test_infer_schema() -> None: heterogeneous_schema = infer_schema(gpd.GeoDataFrame({"x": [1, 2], "geometry": [P, LS]})) check( assert_type(schema, _Schema), - _Schema, # pyright: ignore[reportGeneralTypeIssues] + _Schema, # pyright:ignore[reportGeneralTypeIssues] dtype=str, ) check(assert_type(schema["geometry"], str | list[str]), str) diff --git a/tests/shapely/test_affinity.py b/tests/shapely/test_affinity.py index 453c1f8..e8c58b4 100644 --- a/tests/shapely/test_affinity.py +++ b/tests/shapely/test_affinity.py @@ -57,7 +57,7 @@ def test_rotate() -> None: check(assert_type(shapely.affinity.rotate(LS, 90, origin=(x, y, 0)), LineString), LineString) with pytest.raises(Exception): - shapely.affinity.rotate(LS, 90, origin="centred") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.affinity.rotate(LS, 90, origin="centred") # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] def test_scale() -> None: @@ -77,7 +77,7 @@ def test_scale() -> None: check(assert_type(shapely.affinity.scale(LS, 90, origin=(1, 1.0, 0.0)), LineString), LineString) with pytest.raises(Exception): - shapely.affinity.scale(PO, origin="centred") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.affinity.scale(PO, origin="centred") # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] def test_skew() -> None: @@ -93,7 +93,7 @@ def test_skew() -> None: check(assert_type(shapely.affinity.skew(PO, 20, origin=(1.0, 2.0, 0)), Polygon), Polygon) with pytest.raises(Exception): - shapely.affinity.skew(PO, 20, origin="centred") # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.affinity.skew(PO, 20, origin="centred") # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] def test_translate() -> None: diff --git a/tests/shapely/test_constructive.py b/tests/shapely/test_constructive.py index ee762ad..c377e21 100644 --- a/tests/shapely/test_constructive.py +++ b/tests/shapely/test_constructive.py @@ -316,7 +316,7 @@ def test_polygonize() -> None: dtype=GeometryCollection, ) with pytest.raises(Exception): - shapely.polygonize(LS) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.polygonize(LS) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_polygonize_full() -> None: @@ -352,7 +352,7 @@ def test_polygonize_full() -> None: dtype=np.ndarray, ) with pytest.raises(Exception): - shapely.polygonize_full(LS) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.polygonize_full(LS) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_remove_repeated_points() -> None: diff --git a/tests/shapely/test_coordinates.py b/tests/shapely/test_coordinates.py index a300a34..7d3668f 100644 --- a/tests/shapely/test_coordinates.py +++ b/tests/shapely/test_coordinates.py @@ -129,8 +129,8 @@ def test_set_coordinates() -> None: dtype=Point, ) with pytest.raises(Exception): - shapely.set_coordinates(None, []) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.set_coordinates(None, []) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - shapely.set_coordinates(None, [1, 1]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.set_coordinates(None, [1, 1]) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - shapely.set_coordinates(None, [[1, 1]]) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.set_coordinates(None, [[1, 1]]) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] diff --git a/tests/shapely/test_creation.py b/tests/shapely/test_creation.py index acda793..280a91e 100644 --- a/tests/shapely/test_creation.py +++ b/tests/shapely/test_creation.py @@ -73,9 +73,9 @@ def test_points() -> None: # wrong with pytest.raises(Exception): - shapely.points(0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.points(0) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - shapely.points(0, None, 1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.points(0, None, 1) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): shapely.points(0, 1, indices=[0]) # False negative (difficult to catch) @@ -107,7 +107,7 @@ def test_linestrings() -> None: # wrong with pytest.raises(Exception): - shapely.linestrings(0, 1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.linestrings(0, 1) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_linearrings() -> None: @@ -149,7 +149,7 @@ def test_linearrings() -> None: # wrong with pytest.raises(Exception): - shapely.linearrings(0, 1) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.linearrings(0, 1) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_polygons() -> None: @@ -473,11 +473,11 @@ def test_destroy_prepared() -> None: # despite its name, this function doesn't accept PreparedGeometry with pytest.raises(Exception): - shapely.destroy_prepared(PreparedGeometry(P)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.destroy_prepared(PreparedGeometry(P)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - shapely.destroy_prepared([PreparedGeometry(P)]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.destroy_prepared([PreparedGeometry(P)]) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): - shapely.destroy_prepared((PreparedGeometry(P), None)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.destroy_prepared((PreparedGeometry(P), None)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] def test_empty() -> None: diff --git a/tests/shapely/test_geometry.py b/tests/shapely/test_geometry.py index 7275ab8..c6ac89a 100644 --- a/tests/shapely/test_geometry.py +++ b/tests/shapely/test_geometry.py @@ -40,7 +40,9 @@ def test_base_geometry_constructor() -> None: with pytest.warns(FutureWarning): - check(assert_type(BaseGeometry(), GeometryCollection), GeometryCollection) # pyright: ignore[reportDeprecated] + # TODO[mypy]: https://github.com/python/mypy/issues/20103 + # TODO[ty]: https://github.com/astral-sh/ty/issues/843 + check(assert_type(BaseGeometry(), GeometryCollection), GeometryCollection) # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] def test_geometry_operators() -> None: @@ -262,9 +264,9 @@ def test_point() -> None: Point(float(i) for i in range(2)) with pytest.raises(TypeError): - Point(1) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + Point(1) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - Point(1, 2, 3, 4) # type: ignore # pyright: ignore # ty:ignore[no-matching-overload] + Point(1, 2, 3, 4) # type: ignore # pyright:ignore # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] # Test new attributes check(assert_type(P.x, float), float) @@ -291,11 +293,11 @@ def test_linestring() -> None: LineString(HasArray(np.array([[1, 2], [3, 4]]))) with pytest.raises(TypeError): - LineString(1) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + LineString(1) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - LineString(P) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + LineString(P) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - LineString([P, LS]) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + LineString([P, LS]) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] # Test new attributes check(assert_type(LS.offset_curve(1.5), LineString | MultiLineString), LineString) @@ -322,11 +324,11 @@ def test_linearring() -> None: LinearRing(HasArray(np.array(coords))) with pytest.raises(TypeError): - LinearRing(1) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + LinearRing(1) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - LinearRing(P) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + LinearRing(P) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - LinearRing([P, LR]) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + LinearRing([P, LR]) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] # Test new attributes check(assert_type(LR.offset_curve(1.5), LineString | MultiLineString), LineString) @@ -352,9 +354,9 @@ def test_polygon() -> None: Polygon(np.array(coords)) with pytest.raises(TypeError): - Polygon(1.0, 2) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type] + Polygon(1.0, 2) # type: ignore # pyright:ignore # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - Polygon(1, 2, 3, 4) # type: ignore # pyright: ignore # ty:ignore[invalid-argument-type, too-many-positional-arguments] + Polygon(coords, [coords], 3, 4) # type: ignore # pyright:ignore # ty:ignore[too-many-positional-arguments] # pyrefly:ignore[bad-argument-count] # Test new attributes check(assert_type(PO.exterior, LinearRing), LinearRing) @@ -382,15 +384,15 @@ def test_multipoint() -> None: t: tuple[Point | tuple[float, float] | list[float], ...] = (P, (1, 2), [1, 2]) MultiPoint(t) with pytest.raises(TypeError): - MultiPoint(o for o in [LS, LS, LS]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPoint(o for o in [LS, LS, LS]) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiPoint(BG) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPoint(BG) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiPoint((PO,)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPoint((PO,)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiPoint((None,)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPoint((None,)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiPoint((P, PO, None)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPoint((P, PO, None)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] # Test BaseGeometry overrides check(assert_type(MP.boundary, GeometryCollection), GeometryCollection) @@ -405,15 +407,15 @@ def test_multilinestring() -> None: t: tuple[LineString | list[Point], ...] = (LS, LS, LS, [P, P]) MultiLineString(t) with pytest.raises(TypeError): - MultiLineString(o for o in [LS, LS, LS]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiLineString(o for o in [LS, LS, LS]) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiLineString(BG) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiLineString(BG) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiLineString((PO,)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiLineString((PO,)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(shapely.errors.ShapelyError): - MultiLineString((None,)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiLineString((None,)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiLineString((P, PO, None)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiLineString((P, PO, None)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] # Test BaseGeometry overrides check(assert_type(MLS.boundary, MultiPoint), MultiPoint) @@ -430,13 +432,13 @@ def test_multipolygon() -> None: t: tuple[Polygon, None] = (PO, None) MultiPolygon(t) with pytest.raises(TypeError): - MultiPolygon(o for o in [LS, LS, LS]) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPolygon(o for o in [LS, LS, LS]) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiPolygon(BG) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPolygon(BG) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiPolygon((MLS,)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPolygon((MLS,)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(TypeError): - MultiPolygon((P, PO, None)) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + MultiPolygon((P, PO, None)) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] # Test BaseGeometry overrides check(assert_type(MPO.boundary, MultiLineString), MultiLineString) @@ -450,7 +452,7 @@ def test_geometry_collection() -> None: GeometryCollection([None]) GeometryCollection([P, PO, None]) with pytest.raises(Exception): - GeometryCollection(o for o in [P, PO, None]) # type: ignore[call-overload] # pyright: ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] + GeometryCollection(o for o in (P, PO, None)) # type: ignore[call-overload] # pyright:ignore[reportArgumentType,reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] # Test BaseGeometry overrides check(assert_type(GC.boundary, None), NoneType) @@ -598,8 +600,8 @@ def test_generic_getset() -> None: dtype=Point, ) with pytest.raises(Exception): - shapely.set_precision(LS, 1.0, mode="something") # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue] # ty:ignore[no-matching-overload] - shapely.set_precision(LS, 1.0, mode=10) # type: ignore[call-overload] # pyright: ignore[reportArgumentType, reportCallIssue] # ty:ignore[no-matching-overload] + shapely.set_precision(LS, 1.0, mode="something") # type: ignore[call-overload] # pyright:ignore[reportArgumentType, reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] + shapely.set_precision(LS, 1.0, mode=10) # type: ignore[call-overload] # pyright:ignore[reportArgumentType, reportCallIssue] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] # force_dimension check(assert_type(shapely.force_2d(None), None), NoneType) diff --git a/tests/shapely/test_io.py b/tests/shapely/test_io.py index ec176b9..1d2aab6 100644 --- a/tests/shapely/test_io.py +++ b/tests/shapely/test_io.py @@ -112,7 +112,7 @@ def test_ragged_array() -> None: ) shapely.to_ragged_array([PO, None]) with pytest.raises(Exception): - shapely.to_ragged_array(PO) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.to_ragged_array(PO) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] check( assert_type(shapely.from_ragged_array(*ra), NDArray[np.object_]), np.ndarray, dtype=Polygon @@ -187,6 +187,6 @@ def write(self, wkb: str, /) -> None: check(assert_type(shapely.wkb.dump(P, WkbHexWriter(), hex=True), None), NoneType) with pytest.raises(Exception): - shapely.wkb.dump(P, WkbWriter(), hex=True) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.wkb.dump(P, WkbWriter(), hex=True) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - shapely.wkb.dump(P, WkbHexWriter(), hex=False) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.wkb.dump(P, WkbHexWriter(), hex=False) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] diff --git a/tests/shapely/test_linear.py b/tests/shapely/test_linear.py index 1530cc5..0cf69a5 100644 --- a/tests/shapely/test_linear.py +++ b/tests/shapely/test_linear.py @@ -49,7 +49,7 @@ def test_line_interpolate_point() -> None: dtype=Point, ) with pytest.raises(TypeError): - shapely.line_interpolate_point(P, 1.0) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.line_interpolate_point(P, 1.0) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_line_locate_point() -> None: @@ -83,10 +83,10 @@ def test_line_locate_point() -> None: dtype=np.float64, ) with pytest.raises(Exception): - shapely.line_locate_point(P, P) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.line_locate_point(P, P) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - shapely.line_locate_point(MLS, LS) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.line_locate_point(MLS, LS) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_line_merge() -> None: @@ -139,11 +139,11 @@ def test_shared_paths() -> None: dtype=GeometryCollection, ) with pytest.raises(Exception): - shapely.shared_paths(MLS, P) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.shared_paths(MLS, P) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - shapely.shared_paths(P, MLS) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.shared_paths(P, MLS) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - shapely.shared_paths(GeometryCollection(MLS), LS) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + shapely.shared_paths(GeometryCollection(MLS), LS) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_shortest_line() -> None: diff --git a/tests/shapely/test_ops.py b/tests/shapely/test_ops.py index 775b4bd..9bff933 100644 --- a/tests/shapely/test_ops.py +++ b/tests/shapely/test_ops.py @@ -192,7 +192,7 @@ def wrong_id_func(x: float, y: float, z: float) -> tuple[float, ...]: return x, y, z with pytest.raises(TypeError): - shapely.ops.transform(wrong_id_func, P) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.ops.transform(wrong_id_func, P) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] wgs84_pt = Point(-72.2495, 43.886) wgs84 = pyproj.CRS("EPSG:4326") @@ -218,7 +218,7 @@ def test_shared_paths() -> None: shared = shapely.ops.shared_paths(LS, PO.exterior) check(assert_type(shared, GeometryCollection[MultiLineString]), GeometryCollection) with pytest.raises(Exception): - shapely.ops.shared_paths(LS, PO) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.ops.shared_paths(LS, PO) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] def test_split() -> None: diff --git a/tests/shapely/test_set_operations.py b/tests/shapely/test_set_operations.py index cae4dbf..95c96fc 100644 --- a/tests/shapely/test_set_operations.py +++ b/tests/shapely/test_set_operations.py @@ -136,22 +136,23 @@ def test_symmetric_difference() -> None: def test_symmetric_difference_all() -> None: with pytest.deprecated_call(): - check(assert_type(shapely.symmetric_difference_all(P), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright: ignore[reportDeprecated] - check(assert_type(shapely.symmetric_difference_all(None), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright: ignore[reportDeprecated] - check(assert_type(shapely.symmetric_difference_all([P]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright: ignore[reportDeprecated] - check(assert_type(shapely.symmetric_difference_all([None]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright: ignore[reportDeprecated] - check(assert_type(shapely.symmetric_difference_all([P, P]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright: ignore[reportDeprecated] - check(assert_type(shapely.symmetric_difference_all([P, None]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright: ignore[reportDeprecated] + # TODO[ty]: https://github.com/astral-sh/ty/issues/842 + check(assert_type(shapely.symmetric_difference_all(P), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] + check(assert_type(shapely.symmetric_difference_all(None), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] + check(assert_type(shapely.symmetric_difference_all([P]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] + check(assert_type(shapely.symmetric_difference_all([None]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] + check(assert_type(shapely.symmetric_difference_all([P, P]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] + check(assert_type(shapely.symmetric_difference_all([P, None]), BaseGeometry), BaseGeometry) # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] check( assert_type( - shapely.symmetric_difference_all([P], axis=0), # type: ignore[deprecated] # pyright: ignore[reportDeprecated] + shapely.symmetric_difference_all([P], axis=0), # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] BaseGeometry | NDArray[np.object_], ), BaseGeometry, ) check( assert_type( - shapely.symmetric_difference_all([[P]], axis=0), # type: ignore[deprecated] # pyright: ignore[reportDeprecated] + shapely.symmetric_difference_all([[P]], axis=0), # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] BaseGeometry | NDArray[np.object_], ), np.ndarray, @@ -159,14 +160,14 @@ def test_symmetric_difference_all() -> None: ) check( assert_type( - shapely.symmetric_difference_all([None], axis=0), # type: ignore[deprecated] # pyright: ignore[reportDeprecated] + shapely.symmetric_difference_all([None], axis=0), # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] BaseGeometry | NDArray[np.object_], ), BaseGeometry, ) check( assert_type( - shapely.symmetric_difference_all([[None]], axis=0), # type: ignore[deprecated] # pyright: ignore[reportDeprecated] + shapely.symmetric_difference_all([[None]], axis=0), # type: ignore[deprecated] # pyright:ignore[reportDeprecated] # pyrefly:ignore[deprecated] BaseGeometry | NDArray[np.object_], ), np.ndarray, diff --git a/tests/shapely/test_strtree.py b/tests/shapely/test_strtree.py index 3ede8a8..bf714fd 100644 --- a/tests/shapely/test_strtree.py +++ b/tests/shapely/test_strtree.py @@ -18,7 +18,7 @@ def test_strtree() -> None: with pytest.raises(Exception): - shapely.STRtree(P) # type: ignore[arg-type] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + shapely.STRtree(P) # type: ignore[arg-type] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] check(assert_type(TREE.geometries, NDArray[np.object_]), np.ndarray, dtype=Point) _ = len(TREE) @@ -65,10 +65,10 @@ def test_strtree_query() -> None: ) with pytest.raises(Exception): # needs distance - tree.query(BOXES, predicate="dwithin") # type: ignore[call-overload] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + tree.query(BOXES, predicate="dwithin") # type: ignore[call-overload] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] with pytest.raises(Exception): # invalid predicate - tree.query(BOXES, predicate="yes") # type: ignore[call-overload] # pyright: ignore[reportArgumentType] # ty:ignore[invalid-argument-type] + tree.query(BOXES, predicate="yes") # type: ignore[call-overload] # pyright:ignore[reportArgumentType] # ty:ignore[invalid-argument-type] # pyrefly:ignore[bad-argument-type] def test_strtree_nearest() -> None: @@ -86,9 +86,9 @@ def test_strtree_nearest() -> None: ) with pytest.raises(Exception): - TREE.nearest(None) # type: ignore[call-overload] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + TREE.nearest(None) # type: ignore[call-overload] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] with pytest.raises(Exception): - TREE.nearest((shapely.box(0, 0, 1, 1), None)) # type: ignore[arg-type] # pyright: ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] + TREE.nearest((shapely.box(0, 0, 1, 1), None)) # type: ignore[arg-type] # pyright:ignore[reportCallIssue, reportArgumentType] # ty:ignore[no-matching-overload] # pyrefly:ignore[no-matching-overload] def test_strtree_query_nearest() -> None: diff --git a/uv.lock b/uv.lock index 91d0961..4c84e80 100644 --- a/uv.lock +++ b/uv.lock @@ -1260,6 +1260,23 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/15/73/a7141a1a0559bf1a7aa42a11c879ceb19f02f5c6c371c6d57fd86cefd4d1/pyproj-3.7.2-cp314-cp314t-win_arm64.whl", hash = "sha256:d9d25bae416a24397e0d85739f84d323b55f6511e45a522dd7d7eae70d10c7e4", size = 6391844, upload-time = "2025-08-14T12:05:40.745Z" }, ] +[[package]] +name = "pyrefly" +version = "1.0.0" +source = { registry = "https://pypi.org/simple" } +sdist = { url = "https://files.pythonhosted.org/packages/9f/3a/9045b0097ac58979c7c30a4fa0e673db942d4adbc7b6d439bd54ae58c441/pyrefly-1.0.0.tar.gz", hash = "sha256:5c2b810ffcebd84be71de5df1223651edee951653a66935c6f091e957c452455", size = 5677995, upload-time = "2026-05-12T20:12:46.812Z" } +wheels = [ + { url = "https://files.pythonhosted.org/packages/f4/c6/90788819bac9c61dd7bacba53b79f3c12d47ccbe5e51b3d6d89f2387e1d2/pyrefly-1.0.0-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:e355a0908555348ed4b9585ef25c76ff566673e345c866c325f1633f44d890b6", size = 13122950, upload-time = "2026-05-12T20:12:20.711Z" }, + { url = "https://files.pythonhosted.org/packages/82/91/a3cf2a1e87d336eaa804a1e6fc93266faf6dc2a97eecdbc7eae289628022/pyrefly-1.0.0-py3-none-macosx_11_0_arm64.whl", hash = "sha256:a7038efc3a40f8294edee339895633cf22db268c0d434cdbcbefc34f78a9ecc3", size = 12599494, upload-time = "2026-05-12T20:12:23.495Z" }, + { url = "https://files.pythonhosted.org/packages/cd/ab/74d1e11e737e99b1c003ecc5d7d2e846c4ea1f328966bfdbbd0ac63fad0a/pyrefly-1.0.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:da331ca515ed1c08791da2b5f664cf9c1294c48fd802133262e7d5d51e0f4416", size = 12995507, upload-time = "2026-05-12T20:12:25.951Z" }, + { url = "https://files.pythonhosted.org/packages/7c/ac/2df0899f8464c97e5d995f994c97c5cb5b0f58610432aa90d26d924e1db5/pyrefly-1.0.0-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:c74219d8f3e63cdaa5501a0b21d1c9d37011820f9606728d0ed06f09ae86a878", size = 13947693, upload-time = "2026-05-12T20:12:29.188Z" }, + { url = "https://files.pythonhosted.org/packages/6b/3e/b247c24321e36f04b7d51f9ccf3df93e5009e4b29939524b36ec2e17dc2a/pyrefly-1.0.0-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:c0d05543b1bb6ee6d64149eb5d6b2fb15aa72d3962d6a97abca0afaca8b0c131", size = 13925803, upload-time = "2026-05-12T20:12:31.904Z" }, + { url = "https://files.pythonhosted.org/packages/61/16/cfa2d61a4aa1e1f7bca48bb37acd01c6a09db4864b16a54f9587092765ff/pyrefly-1.0.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1382d5b1fcdb49a4de9f34d112d2bddf290a78ff93ee8149492ad5f1077ddffc", size = 13470398, upload-time = "2026-05-12T20:12:35.302Z" }, + { url = "https://files.pythonhosted.org/packages/cb/2b/6372c7dddb326223e24a46b17efd0d4bd7b4fe22c821e523157577eed2d2/pyrefly-1.0.0-py3-none-win32.whl", hash = "sha256:aa8b5d0e47080e3202a2547b39f7a5a61d2c781c712b3b67884f745ca2c759d2", size = 12222643, upload-time = "2026-05-12T20:12:38.618Z" }, + { url = "https://files.pythonhosted.org/packages/be/ad/1d23be700b6b2ddaeb362360c7145917a8edbbf7240ae428d40541772fce/pyrefly-1.0.0-py3-none-win_amd64.whl", hash = "sha256:c8abcb0f2082e83c890375128f9cff4aa4d3f210b85eea7b3046c1ae764e77f5", size = 13146369, upload-time = "2026-05-12T20:12:41.423Z" }, + { url = "https://files.pythonhosted.org/packages/8c/38/16589134f3012fd097a10dcc85771555f1a5fb76e04b682597180743af30/pyrefly-1.0.0-py3-none-win_arm64.whl", hash = "sha256:d150fa9e40e8392832be81c3bcfc0497c146674ce4d0f8e04e1ec29e775ffb8c", size = 12538326, upload-time = "2026-05-12T20:12:43.996Z" }, +] + [[package]] name = "pyright" version = "1.1.409" @@ -1318,6 +1335,7 @@ dev = [ { name = "pandapower" }, { name = "pandas-stubs" }, { name = "pyarrow-stubs" }, + { name = "pyrefly" }, { name = "pyright" }, { name = "pytest" }, { name = "rich-argparse" }, @@ -1364,6 +1382,7 @@ dev = [ { name = "pandapower", specifier = ">=3.1.2" }, { name = "pandas-stubs", specifier = ">=2.2.2" }, { name = "pyarrow-stubs", specifier = ">=20.0.0" }, + { name = "pyrefly", specifier = ">=1.0.0" }, { name = "pyright", specifier = ">=1.1.409" }, { name = "pytest", specifier = ">=9.0" }, { name = "rich-argparse", specifier = ">=1.8.0" },