/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:351:5 - error: "geometry" overrides symbol of same name in class "Element"
Variable is mutable so its type is invariant
Override type "Point | None" is not the same as base type "BaseGeometry | None" (reportIncompatibleVariableOverride)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:377:5 - error: "geometry" overrides symbol of same name in class "Element"
Variable is mutable so its type is invariant
Override type "LineString | LinearRing | Polygon | None" is not the same as base type "BaseGeometry | None" (reportIncompatibleVariableOverride)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:416:5 - error: "geometry" overrides symbol of same name in class "Element"
Variable is mutable so its type is invariant
Override type "Polygon | MultiPolygon | None" is not the same as base type "BaseGeometry | None" (reportIncompatibleVariableOverride)
My intention with adding the geometry property to Element was to emulate an abstract property, that all the subclasses need to extend with some BaseGeometry. pyright is right to complain here though.
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:623:49 - error: Argument of type "GeometrySequence[MultiPolygon*]*" cannot be assigned to parameter "geometries" of type "OptGeoArrayLike" in function "intersection_all"
Type "GeometrySequence[MultiPolygon*]*" is incompatible with type "OptGeoArrayLike"
"GeometrySequence[MultiPolygon*]*" is incompatible with "Geometry"
"GeometrySequence[MultiPolygon*]*" is incompatible with "None"
"GeometrySequence[MultiPolygon*]*" is incompatible with protocol "SupportsArray[dtype[Any]]"
"__array__" is not present
"GeometrySequence[MultiPolygon*]*" is incompatible with "Sequence[SupportsArray[dtype[Any]]]"
"GeometrySequence[MultiPolygon*]*" is incompatible with "Sequence[Sequence[SupportsArray[dtype[Any]]]]"
"GeometrySequence[MultiPolygon*]*" is incompatible with "Sequence[Sequence[Sequence[SupportsArray[dtype[Any]]]]]"
... (reportArgumentType)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:636:20 - error: Expression of type "GeometryDetails[Polygon]" is incompatible with return type "GeometryDetails[G@_try_validate_geometry]"
"GeometryDetails[Polygon]" is incompatible with "GeometryDetails[G@_try_validate_geometry]"
Type parameter "G@GeometryDetails" is invariant, but "Polygon" is not the same as "G@_try_validate_geometry" (reportReturnType)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:645:20 - error: Expression of type "GeometryDetails[MultiPolygon]" is incompatible with return type "GeometryDetails[G@_try_validate_geometry]"
"GeometryDetails[MultiPolygon]" is incompatible with "GeometryDetails[G@_try_validate_geometry]"
Type parameter "G@GeometryDetails" is invariant, but "MultiPolygon" is not the same as "G@_try_validate_geometry" (reportReturnType)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:709:27 - error: Argument of type "BaseGeometry" cannot be assigned to parameter "shell" of type "_PolygonShellLike" in function "__new__"
Type "BaseGeometry" is incompatible with type "_PolygonShellLike"
"BaseGeometry" is incompatible with "Polygon"
"BaseGeometry" is incompatible with "LineString"
"BaseGeometry" is incompatible with protocol "SupportsArray[dtype[Any]]"
"__array__" is not present
"BaseGeometry" is incompatible with "Sequence[SupportsArray[dtype[Any]]]"
"BaseGeometry" is incompatible with "Sequence[Sequence[SupportsArray[dtype[Any]]]]"
"BaseGeometry" is incompatible with "Sequence[Sequence[Sequence[SupportsArray[dtype[Any]]]]]"
... (reportArgumentType)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:709:40 - error: Argument of type "list[BaseGeometry]" cannot be assigned to parameter "holes" of type "_PolygonHolesLike" in function "__new__" (reportArgumentType)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/element.py:868:34 - error: Argument of type "(lat: float, lon: float) -> tuple[float, float]" cannot be assigned to parameter "func" of type "(float, float, float | None) -> tuple[float, ...]" in function "transform"
Type "(lat: float, lon: float) -> tuple[float, float]" is incompatible with type "(float, float, float | None) -> tuple[float, ...]"
Function accepts too many positional parameters; expected 2 but received 3 (reportArgumentType)
/home/runner/work/aio-overpass/aio-overpass/aio_overpass/pt_ordered.py:225:53 - error: Expression of type "Generator[Iterator[LineString | None], None, None]" is incompatible with declared type "Iterator[Iterator[LineString]]"
"Generator[Iterator[LineString | None], None, None]" is incompatible with "Iterator[Iterator[LineString]]"
Type parameter "_T_co@Iterator" is covariant, but "Iterator[LineString | None]" is not a subtype of "Iterator[LineString]"
"Iterator[LineString | None]" is incompatible with "Iterator[LineString]"
Type parameter "_T_co@Iterator" is covariant, but "LineString | None" is not a subtype of "LineString"
Type "LineString | None" is incompatible with type "LineString" (reportAssignmentType)
Updating
pyright
introduced a number of new error reports:geometry
type errorhttps://github.com/timwie/aio-overpass/blob/868443de2958cc9353b31ee3bbf128d62a9d4298/aio_overpass/element.py#L237
My intention with adding the
geometry
property toElement
was to emulate an abstract property, that all the subclasses need to extend with someBaseGeometry
.pyright
is right to complain here though._try_validate_geometry()
type errorshttps://github.com/timwie/aio-overpass/blob/868443de2958cc9353b31ee3bbf128d62a9d4298/aio_overpass/element.py#L613-L651
_try_validate_geometry()
type errorshttps://github.com/timwie/aio-overpass/blob/868443de2958cc9353b31ee3bbf128d62a9d4298/aio_overpass/element.py#L705-L711
_geometry()
type error https://github.com/timwie/aio-overpass/blob/868443de2958cc9353b31ee3bbf128d62a9d4298/aio_overpass/element.py#L868OrderedRouteView.path
type errorhttps://github.com/timwie/aio-overpass/blob/868443de2958cc9353b31ee3bbf128d62a9d4298/aio_overpass/pt_ordered.py#L216-L227