|
1 | 1 | import json |
| 2 | +import os |
| 3 | +from _typeshed import SupportsWrite |
| 4 | +from collections.abc import Callable |
| 5 | +from typing import Any |
| 6 | + |
| 7 | +from geojson import GeoJSON |
2 | 8 |
|
3 | 9 | class GeoJSONEncoder(json.JSONEncoder): |
4 | | - def default(self, obj): ... |
| 10 | + def default(self, obj) -> GeoJSON: ... |
5 | 11 |
|
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): ... |
| 12 | +def dump( |
| 13 | + obj: type[GeoJSON], |
| 14 | + fp: SupportsWrite[str], |
| 15 | + cls: type[json.JSONEncoder] | None = json.JSONEncoder, |
| 16 | + allow_nan: bool = False, |
| 17 | + **kwargs, |
| 18 | +) -> None: ... |
| 19 | +def dumps( |
| 20 | + obj: type[GeoJSON], |
| 21 | + cls: type[json.JSONEncoder] | None = json.JSONEncoder, |
| 22 | + allow_nan: bool = False, |
| 23 | + ensure_ascii: bool = False, |
| 24 | + **kwargs, |
| 25 | +) -> str: ... |
| 26 | +def load( |
| 27 | + fp: os.PathLike[Any], |
| 28 | + cls: type[json.JSONDecoder] = json.JSONDecoder, |
| 29 | + parse_constant: Callable[[Any], None] = ..., |
| 30 | + object_hook: Callable[..., GeoJSON] = GeoJSON.to_instance, |
| 31 | + **kwargs, |
| 32 | +) -> GeoJSON: ... |
| 33 | +def loads( |
| 34 | + s: str, |
| 35 | + cls: type[json.JSONDecoder] = json.JSONDecoder, |
| 36 | + parse_constant: Callable[[Any], None] = ..., |
| 37 | + object_hook: Callable[..., GeoJSON] = GeoJSON.to_instance, |
| 38 | + **kwargs, |
| 39 | +) -> GeoJSON: ... |
10 | 40 |
|
11 | 41 | PyGFPEncoder = GeoJSONEncoder |
0 commit comments