Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotfix/types are not flagged by static type checking #171

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions geojson_pydantic/geometries.py
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ def wkt(self) -> str:
class Point(_GeometryBase):
"""Point Model"""

type: Literal["Point"]
type: Literal["Point"] = "Point"
coordinates: Position

def __wkt_coordinates__(self, coordinates: Any, force_z: bool) -> str:
@@ -125,7 +125,7 @@ def has_z(self) -> bool:
class MultiPoint(_GeometryBase):
"""MultiPoint Model"""

type: Literal["MultiPoint"]
type: Literal["MultiPoint"] = "MultiPoint"
coordinates: MultiPointCoords

def __wkt_coordinates__(self, coordinates: Any, force_z: bool) -> str:
@@ -144,7 +144,7 @@ def has_z(self) -> bool:
class LineString(_GeometryBase):
"""LineString Model"""

type: Literal["LineString"]
type: Literal["LineString"] = "LineString"
coordinates: LineStringCoords

def __wkt_coordinates__(self, coordinates: Any, force_z: bool) -> str:
@@ -160,7 +160,7 @@ def has_z(self) -> bool:
class MultiLineString(_GeometryBase):
"""MultiLineString Model"""

type: Literal["MultiLineString"]
type: Literal["MultiLineString"] = "MultiLineString"
coordinates: MultiLineStringCoords

def __wkt_coordinates__(self, coordinates: Any, force_z: bool) -> str:
@@ -176,7 +176,7 @@ def has_z(self) -> bool:
class Polygon(_GeometryBase):
"""Polygon Model"""

type: Literal["Polygon"]
type: Literal["Polygon"] = "Polygon"
coordinates: PolygonCoords

def __wkt_coordinates__(self, coordinates: Any, force_z: bool) -> str:
@@ -224,7 +224,7 @@ def from_bounds(
class MultiPolygon(_GeometryBase):
"""MultiPolygon Model"""

type: Literal["MultiPolygon"]
type: Literal["MultiPolygon"] = "MultiPolygon"
coordinates: MultiPolygonCoords

def __wkt_coordinates__(self, coordinates: Any, force_z: bool) -> str:
@@ -248,7 +248,7 @@ def check_closure(cls, coordinates: List) -> List:
class GeometryCollection(_GeoJsonBase):
"""GeometryCollection Model"""

type: Literal["GeometryCollection"]
type: Literal["GeometryCollection"] = "GeometryCollection"
geometries: List[Geometry]

def __iter__(self) -> Iterator[Geometry]: # type: ignore [override]
@@ -273,7 +273,7 @@ def wkt(self) -> str:

# Get the wkt from each of the geometries in the collection
geometries = (
f'({", ".join(geom.wkt for geom in self.geometries)})'
f"({', '.join(geom.wkt for geom in self.geometries)})"
if self.geometries
else "EMPTY"
)