|
| 1 | +import os |
| 2 | +from collections.abc import Collection, Mapping |
| 3 | +from typing import Any, Literal, overload |
| 4 | + |
| 5 | +import geopandas as gpd |
| 6 | +import pandas as pd |
| 7 | +import shapely as shp |
| 8 | + |
| 9 | +from ._typing import ArrayLikeInt, ReadPathOrBuffer, WritePathOrBuffer |
| 10 | + |
| 11 | +@overload |
| 12 | +def read_dataframe( |
| 13 | + path_or_buffer: ReadPathOrBuffer | os.PathLike[str], |
| 14 | + /, |
| 15 | + layer: int | str | None = None, |
| 16 | + encoding: str | None = None, |
| 17 | + columns: Collection[str] | None = None, |
| 18 | + read_geometry: Literal[True] = True, |
| 19 | + force_2d: bool = False, |
| 20 | + skip_features: int = 0, |
| 21 | + max_features: int | None = None, |
| 22 | + where: str | None = None, |
| 23 | + bbox: tuple[float, float, float, float] | None = None, |
| 24 | + mask: shp.Geometry | None = None, |
| 25 | + fids: ArrayLikeInt | None = None, |
| 26 | + sql: str | None = None, |
| 27 | + sql_dialect: str | None = None, |
| 28 | + fid_as_index: bool = False, |
| 29 | + use_arrow: bool | None = None, |
| 30 | + on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise", |
| 31 | + arrow_to_pandas_kwargs: Mapping[str, Any] | None = None, |
| 32 | + datetime_as_string: bool = False, |
| 33 | + mixed_offsets_as_utc: bool = True, |
| 34 | + **kwargs: Any, # Dataset open options passed to OGR |
| 35 | +) -> gpd.GeoDataFrame: ... |
| 36 | +@overload |
| 37 | +def read_dataframe( |
| 38 | + path_or_buffer: ReadPathOrBuffer | os.PathLike[str], |
| 39 | + /, |
| 40 | + layer: int | str | None = None, |
| 41 | + encoding: str | None = None, |
| 42 | + columns: Collection[str] | None = None, |
| 43 | + *, |
| 44 | + read_geometry: Literal[False], |
| 45 | + force_2d: bool = False, |
| 46 | + skip_features: int = 0, |
| 47 | + max_features: int | None = None, |
| 48 | + where: str | None = None, |
| 49 | + bbox: tuple[float, float, float, float] | None = None, |
| 50 | + mask: shp.Geometry | None = None, |
| 51 | + fids: ArrayLikeInt | None = None, |
| 52 | + sql: str | None = None, |
| 53 | + sql_dialect: str | None = None, |
| 54 | + fid_as_index: bool = False, |
| 55 | + use_arrow: bool | None = None, |
| 56 | + on_invalid: Literal["raise", "warn", "ignore", "fix"] = "raise", |
| 57 | + arrow_to_pandas_kwargs: Mapping[str, Any] | None = None, |
| 58 | + datetime_as_string: bool = False, |
| 59 | + mixed_offsets_as_utc: bool = True, |
| 60 | + **kwargs: Any, # Dataset open options passed to OGR |
| 61 | +) -> pd.DataFrame: ... |
| 62 | + |
| 63 | +def write_dataframe( |
| 64 | + df: pd.DataFrame, |
| 65 | + path: WritePathOrBuffer, |
| 66 | + layer: str | None = None, |
| 67 | + driver: str | None = None, |
| 68 | + encoding: str | None = None, |
| 69 | + geometry_type: str | None = None, |
| 70 | + promote_to_multi: bool | None = None, |
| 71 | + nan_as_null: bool = True, |
| 72 | + append: bool = False, |
| 73 | + use_arrow: bool | None = None, |
| 74 | + dataset_metadata: dict[str, Any] | None = None, |
| 75 | + layer_metadata: dict[str, Any] | None = None, |
| 76 | + metadata: dict[str, Any] | None = None, |
| 77 | + dataset_options: dict[str, Any] | None = None, |
| 78 | + layer_options: dict[str, Any] | None = None, |
| 79 | + **kwargs: Any, # Additional driver-specific dataset or layer creation options passed to OGR |
| 80 | +) -> None: ... |
0 commit comments