-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
geopandas improvements to publicly exported private symbols
- Loading branch information
Showing
13 changed files
with
164 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,18 @@ | ||
import numpy | ||
import pandas | ||
|
||
import geopandas | ||
|
||
from ._config import options as options | ||
from ._exports import ( | ||
gpd as gpd, | ||
list_layers as list_layers, | ||
np as np, | ||
pd as pd, | ||
read_feather as read_feather, | ||
read_file as read_file, | ||
read_parquet as read_parquet, | ||
read_postgis as read_postgis, | ||
) | ||
from .array import points_from_xy as points_from_xy | ||
from .geodataframe import GeoDataFrame as GeoDataFrame | ||
from .geoseries import GeoSeries as GeoSeries | ||
from .io.arrow import _read_feather, _read_parquet | ||
from .io.file import _list_layers, _read_file | ||
from .io.sql import _read_postgis | ||
from .tools import clip as clip, overlay as overlay, sjoin as sjoin, sjoin_nearest as sjoin_nearest | ||
from .tools._show_versions import show_versions as show_versions | ||
|
||
list_layers = _list_layers | ||
read_file = _read_file | ||
read_feather = _read_feather | ||
read_parquet = _read_parquet | ||
read_postgis = _read_postgis | ||
|
||
gpd = geopandas | ||
np = numpy | ||
pd = pandas | ||
__version__: str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from collections.abc import Callable | ||
from typing import TypeVar, overload | ||
from typing_extensions import TypeAlias | ||
|
||
_AnyCallable: TypeAlias = Callable[..., object] | ||
_Func = TypeVar("_Func", bound=_AnyCallable) | ||
|
||
# We (ab)use this decorator to also copy the signature of the source function (overload 1) | ||
# The advantages are: | ||
# - avoid copying all parameters and types manually while conserving type safety | ||
# - signature properly handeled in IDEs (at least with Pylance) | ||
# - docstring from the original function properly displayed (at least with Pylance) | ||
# Using the other overloads returns the signature of the decorated function instead | ||
@overload | ||
def doc(func: _Func, /) -> Callable[[_AnyCallable], _Func]: ... | ||
@overload | ||
def doc(docstring: str, /, *docstrings: str | _AnyCallable, **params: object) -> Callable[[_Func], _Func]: ... | ||
@overload | ||
def doc( | ||
docstring1: str | _AnyCallable, docstring2: str | _AnyCallable, /, *docstrings: str | _AnyCallable, **params: object | ||
) -> Callable[[_Func], _Func]: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Type checking-only module to export public symbols with a different name in __init__.pyi | ||
|
||
import numpy as np | ||
import pandas as pd | ||
|
||
import geopandas as gpd | ||
from geopandas.io.arrow import _read_feather as read_feather, _read_parquet as read_parquet | ||
from geopandas.io.file import _list_layers as list_layers, _read_file as read_file | ||
from geopandas.io.sql import _read_postgis as read_postgis | ||
|
||
__all__ = [ | ||
# IO functions | ||
"read_file", | ||
"read_feather", | ||
"read_parquet", | ||
"read_postgis", | ||
"list_layers", | ||
# Modules for interactive use | ||
"np", | ||
"pd", | ||
"gpd", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,9 @@ | ||
from typing import TypeVar | ||
from typing_extensions import TypeAlias | ||
|
||
from shapely import MultiPolygon, Polygon | ||
|
||
from geopandas.base import _ClipMask | ||
from geopandas.geodataframe import GeoDataFrame | ||
from geopandas.geoseries import GeoSeries | ||
|
||
_G = TypeVar("_G", GeoDataFrame, GeoSeries) | ||
_Mask: TypeAlias = GeoDataFrame | GeoSeries | Polygon | MultiPolygon | tuple[float, float, float, float] | ||
|
||
def clip(gdf: _G, mask: _Mask, keep_geom_type: bool = False, sort: bool = False) -> _G: ... | ||
def clip(gdf: _G, mask: _ClipMask, keep_geom_type: bool = False, sort: bool = False) -> _G: ... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.