1- from collections .abc import Iterable
2- from typing import Any
1+ from collections .abc import Sequence
2+ from decimal import Decimal
3+ from typing import Literal , TypeAlias
34
4- from geojson import Feature
55from geojson .base import GeoJSON
66
7- DEFAULT_PRECISION : int
7+ _InputCoord : TypeAlias = float | Decimal | Geometry | Sequence [_InputCoord ]
8+ _CleanCoord : TypeAlias = float | Decimal | list [_CleanCoord ]
9+
10+ DEFAULT_PRECISION : Literal [6 ]
811
912class Geometry (GeoJSON ):
1013 def __init__ (
11- self , coordinates : None | Feature | Iterable [Any ] = None , validate : bool = False , precision : None | int = None , ** extra
14+ self ,
15+ coordinates : None | Sequence [_InputCoord ] | Geometry = None ,
16+ validate : bool = False ,
17+ precision : None | int = None ,
18+ ** extra ,
1219 ) -> None : ...
1320 @classmethod
14- def clean_coordinates (
15- cls , coords : Geometry | tuple [Any , ...] | list [tuple [Any , ...]], precision : None | int
16- ) -> None | tuple [Any , ...] | list [tuple [Any , ...]]: ...
21+ def clean_coordinates (cls , coords : Sequence [_InputCoord ] | Geometry , precision : int ) -> list [_CleanCoord ]: ...
1722
1823class GeometryCollection (GeoJSON ):
19- def __init__ (self , geometries = ... , ** extra ) -> None : ...
24+ def __init__ (self , geometries : None | Sequence [ Geometry ] = None , ** extra ) -> None : ...
2025 def errors (self ) -> list [str ] | None : ...
2126 def __getitem__ (self , key ) -> Geometry | tuple [()] | None : ...
2227
@@ -30,10 +35,10 @@ class MultiPoint(Geometry):
3035
3136def check_line_string (coord ) -> str | None : ...
3237
33- class LineString (MultiPoint ):
38+ class LineString (Geometry ):
3439 def errors (self ) -> list [str ] | None : ...
3540
36- class MultiLineString (Geometry ):
41+ class MultiLineString (MultiPoint ):
3742 def errors (self ) -> list [str ] | None : ...
3843
3944def check_polygon (coord ) -> str | None : ...
0 commit comments