Skip to content

Commit 5de0fe4

Browse files
committed
Add stubs for geojson using scripts/create_baseline_stubs.py
1 parent ee21208 commit 5de0fe4

11 files changed

Lines changed: 105 additions & 0 deletions

File tree

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"stubs/Flask-SocketIO",
4141
"stubs/fpdf2",
4242
"stubs/gdb",
43+
"stubs/geojson",
4344
"stubs/geopandas",
4445
"stubs/google-cloud-ndb",
4546
"stubs/grpcio-channelz/grpc_channelz/v1",
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
geojson
2+
geojson.examples.SimpleWebFeature.__geo_interface__

stubs/geojson/METADATA.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version = "3.2.*"
2+
upstream-repository = "https://github.com/jazzband/geojson"

stubs/geojson/geojson/_version.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from _typeshed import Incomplete
2+
3+
__version__: str
4+
__version_info__: Incomplete

stubs/geojson/geojson/base.pyi

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class GeoJSON(dict):
2+
def __init__(self, iterable=(), **extra) -> None: ...
3+
def __getattr__(self, name): ...
4+
def __setattr__(self, name, value) -> None: ...
5+
def __delattr__(self, name) -> None: ...
6+
@property
7+
def __geo_interface__(self): ...
8+
@classmethod
9+
def to_instance(cls, ob, default=None, strict: bool = False): ...
10+
@property
11+
def is_valid(self): ...
12+
def check_list_errors(self, checkFunc, lst): ...
13+
def errors(self) -> None: ...

stubs/geojson/geojson/codec.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import json
2+
3+
class GeoJSONEncoder(json.JSONEncoder):
4+
def default(self, obj): ...
5+
6+
def dump(obj, fp, cls=..., allow_nan: bool = False, **kwargs): ...
7+
def dumps(obj, cls=..., allow_nan: bool = False, ensure_ascii: bool = False, **kwargs): ...
8+
def load(fp, cls=..., parse_constant=..., object_hook=..., **kwargs): ...
9+
def loads(s, cls=..., parse_constant=..., object_hook=..., **kwargs): ...
10+
11+
PyGFPEncoder = GeoJSONEncoder

stubs/geojson/geojson/examples.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from _typeshed import Incomplete
2+
3+
class SimpleWebFeature:
4+
id: Incomplete
5+
geometry: Incomplete
6+
properties: Incomplete
7+
def __init__(self, id=None, geometry=None, title=None, summary=None, link=None) -> None: ...
8+
def as_dict(self): ...
9+
__geo_interface__: Incomplete
10+
11+
def create_simple_web_feature(o): ...

stubs/geojson/geojson/feature.pyi

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from geojson.base import GeoJSON
2+
3+
class Feature(GeoJSON):
4+
def __init__(self, id=None, geometry=None, properties=None, **extra) -> None: ...
5+
def errors(self): ...
6+
7+
class FeatureCollection(GeoJSON):
8+
def __init__(self, features, **extra) -> None: ...
9+
def errors(self): ...
10+
def __getitem__(self, key): ...

stubs/geojson/geojson/geometry.pyi

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from geojson.base import GeoJSON
2+
3+
DEFAULT_PRECISION: int
4+
5+
class Geometry(GeoJSON):
6+
def __init__(self, coordinates=None, validate: bool = False, precision=None, **extra) -> None: ...
7+
@classmethod
8+
def clean_coordinates(cls, coords, precision): ...
9+
10+
class GeometryCollection(GeoJSON):
11+
def __init__(self, geometries=None, **extra) -> None: ...
12+
def errors(self): ...
13+
def __getitem__(self, key): ...
14+
15+
def check_point(coord): ...
16+
17+
class Point(Geometry):
18+
def errors(self): ...
19+
20+
class MultiPoint(Geometry):
21+
def errors(self): ...
22+
23+
def check_line_string(coord): ...
24+
25+
class LineString(MultiPoint):
26+
def errors(self): ...
27+
28+
class MultiLineString(Geometry):
29+
def errors(self): ...
30+
31+
def check_polygon(coord): ...
32+
33+
class Polygon(Geometry):
34+
def errors(self): ...
35+
36+
class MultiPolygon(Geometry):
37+
def errors(self): ...
38+
39+
class Default: ...

stubs/geojson/geojson/mapping.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
GEO_INTERFACE_MARKER: str
2+
3+
def is_mapping(obj): ...
4+
def to_mapping(obj): ...

0 commit comments

Comments
 (0)