FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

shapely: narrower types for geom_type in BaseGeometry subclasses by hamdanal · Pull Request #15955 · python/typeshed · GitHub

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .pyi  (7) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
4 changes: 3 additions & 1 deletion stubs/shapely/shapely/geometry/collection.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Collection
from typing import overload
from typing import Literal, overload
from typing_extensions import Self

from .._typing import OptGeoArrayLike
Expand All @@ -18,4 +18,6 @@ class GeometryCollection(BaseMultipartGeometry[_GeoT_co]):

# more precise base overrides
@property
def geom_type(self) -> Literal["GeometryCollection"]: ...
@property
def boundary(self) -> None: ...
2 changes: 2 additions & 0 deletions stubs/shapely/shapely/geometry/linestring.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ class LineString(BaseGeometry):
) -> LineString | MultiLineString: ...
# more precise base overrides
@property
def geom_type(self) -> Literal["LineString", "LinearRing"]: ... # LinearRing is a subclass of LineString
@property
def boundary(self) -> MultiPoint: ...
@property
def convex_hull(self) -> LineString: ...
Expand Down
3 changes: 3 additions & 0 deletions stubs/shapely/shapely/geometry/multilinestring.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import Collection
from typing import Literal
from typing_extensions import Self

from .base import BaseMultipartGeometry
Expand All @@ -13,4 +14,6 @@ class MultiLineString(BaseMultipartGeometry[LineString]):
def svg(self, scale_factor: float = 1.0, stroke_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override]
# more precise base overrides
@property
def geom_type(self) -> Literal["MultiLineString"]: ...
@property
def boundary(self) -> MultiPoint: ...
3 changes: 3 additions & 0 deletions stubs/shapely/shapely/geometry/multipoint.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import Collection
from typing import Literal
from typing_extensions import Self

from .base import BaseMultipartGeometry
Expand All @@ -18,4 +19,6 @@ class MultiPoint(BaseMultipartGeometry[Point]):
def svg(self, scale_factor: float = 1.0, fill_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override]
# more precise base overrides
@property
def geom_type(self) -> Literal["MultiPoint"]: ...
@property
def boundary(self) -> GeometryCollection: ... # empty geometry collection
3 changes: 3 additions & 0 deletions stubs/shapely/shapely/geometry/multipolygon.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from collections.abc import Collection
from typing import Literal
from typing_extensions import Self

from .base import BaseMultipartGeometry
Expand All @@ -20,4 +21,6 @@ class MultiPolygon(BaseMultipartGeometry[Polygon]):
def svg(self, scale_factor: float = 1.0, fill_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override]
# more precise base overrides
@property
def geom_type(self) -> Literal["MultiPolygon"]: ...
@property
def boundary(self) -> MultiLineString: ...
4 changes: 3 additions & 1 deletion stubs/shapely/shapely/geometry/point.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Iterable
from typing import TypeAlias, overload
from typing import Literal, TypeAlias, overload
from typing_extensions import Self

from .._typing import ArrayLikeSeq
Expand Down Expand Up @@ -33,6 +33,8 @@ class Point(BaseGeometry):
def svg(self, scale_factor: float = 1.0, fill_color: str | None = None, opacity: float | None = None) -> str: ... # type: ignore[override]
# more precise base overrides
@property
def geom_type(self) -> Literal["Point"]: ...
@property
def boundary(self) -> GeometryCollection: ... # empty geometry collection
@property
def convex_hull(self) -> Point: ...
Expand Down
6 changes: 5 additions & 1 deletion stubs/shapely/shapely/geometry/polygon.pyi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from collections.abc import Collection
from typing import NoReturn, TypeAlias, overload
from typing import Literal, NoReturn, TypeAlias, overload
from typing_extensions import Self

from .base import BaseGeometry
Expand All @@ -17,6 +17,8 @@ class LinearRing(LineString):
def __new__(self, coordinates: _ConvertibleToLinearRing | None = None) -> Self: ...
@property
def is_ccw(self) -> bool: ...
@property
def geom_type(self) -> Literal["LinearRing"]: ...

class InteriorRingSequence:
def __init__(self, parent: Polygon) -> None: ...
Expand All @@ -43,6 +45,8 @@ class Polygon(BaseGeometry):
def from_bounds(cls, xmin: float, ymin: float, xmax: float, ymax: float) -> Self: ...
# more precise base overrides
@property
def geom_type(self) -> Literal["Polygon"]: ...
@property
def boundary(self) -> MultiLineString: ...

def orient(polygon: Polygon, sign: float = 1.0) -> Polygon: ...
Loading

Back | FazBrowse Home | New Git URL