Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
- id: mixed-line-ending
- id: check-case-conflict
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.0 # must match requirements.txt
rev: v0.9.1 # must match requirements.txt
hooks:
- id: ruff
- id: ruff-format
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[project]
name = "python-stubs"
version = "0.0.0"
requires-python = ">=3.8"
requires-python = ">=3.9"

[tool.ruff]
line-length = 130
Expand Down
12 changes: 6 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ django-types==0.20.0
# via -r requirements.in
djangorestframework-types==0.9.0
# via -r requirements.in
folium==0.19.3
folium==0.19.4
# via -r requirements.in
fonttools==4.55.3
# via matplotlib
Expand All @@ -41,7 +41,7 @@ matplotlib==3.10.0
# via -r requirements.in
mdurl==0.1.2
# via markdown-it-py
mypy==1.14.0
mypy==1.14.1
# via -r requirements.in
mypy-extensions==1.0.0
# via mypy
Expand Down Expand Up @@ -70,15 +70,15 @@ pandas==2.2.3
# via geopandas
pandas-stubs==2.2.3.241126
# via -r requirements.in
pillow==11.0.0
pillow==11.1.0
# via matplotlib
pluggy==1.5.0
# via pytest
pygments==2.18.0
pygments==2.19.1
# via rich
pyogrio==0.10.0
# via geopandas
pyparsing==3.2.0
pyparsing==3.2.1
# via matplotlib
pyproj==3.7.0
# via geopandas
Expand All @@ -100,7 +100,7 @@ rich-argparse==1.6.0
# via -r requirements.in
rtree==1.3.0
# via -r requirements.in
ruff==0.8.4
ruff==0.9.1
# via -r requirements.in
shapely==2.0.6
# via geopandas
Expand Down
114 changes: 58 additions & 56 deletions stubs/geopandas-stubs/array.pyi
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import builtins
from _typeshed import Incomplete, Unused
from collections.abc import Callable, Sequence
from typing import Any, ClassVar, Literal, NoReturn, SupportsIndex, overload
from typing import Any, ClassVar, Literal, NoReturn, SupportsIndex, TypeVar, overload
from typing_extensions import Self, TypeAlias, deprecated

import numpy as np
Expand All @@ -15,6 +15,8 @@ from shapely.geometry.base import BaseGeometry
from geopandas.base import _AffinityOrigin, _ConvertibleToCRS
from geopandas.sindex import SpatialIndex

_ScalarType = TypeVar("_ScalarType", bound=np.generic)
_Array1D: TypeAlias = np.ndarray[tuple[int], np.dtype[_ScalarType]]
_ArrayOrGeom: TypeAlias = GeometryArray | ArrayLike | Geometry

TransformerFromCRS = Transformer.from_crs
Expand All @@ -30,18 +32,18 @@ class GeometryDtype(ExtensionDtype):

def isna(value: object) -> bool: ...
def from_shapely(data, crs: _ConvertibleToCRS | None = None) -> GeometryArray: ...
def to_shapely(geoms: GeometryArray) -> NDArray[np.object_]: ...
def to_shapely(geoms: GeometryArray) -> _Array1D[np.object_]: ...
def from_wkb(
data, crs: _ConvertibleToCRS | None = None, on_invalid: Literal["raise", "warn", "ignore"] = "raise"
) -> GeometryArray: ...
@overload
def to_wkb(geoms: GeometryArray, hex: Literal[False] = False, **kwargs) -> NDArray[np.bytes_]: ...
def to_wkb(geoms: GeometryArray, hex: Literal[False] = False, **kwargs) -> _Array1D[np.bytes_]: ...
@overload
def to_wkb(geoms: GeometryArray, hex: Literal[True], **kwargs) -> NDArray[np.str_]: ...
def to_wkb(geoms: GeometryArray, hex: Literal[True], **kwargs) -> _Array1D[np.str_]: ...
def from_wkt(
data, crs: _ConvertibleToCRS | None = None, on_invalid: Literal["raise", "warn", "ignore"] = "raise"
) -> GeometryArray: ...
def to_wkt(geoms: GeometryArray, **kwargs) -> NDArray[np.str_]: ...
def to_wkt(geoms: GeometryArray, **kwargs) -> _Array1D[np.str_]: ...
def points_from_xy(
x: ArrayLike, y: ArrayLike, z: ArrayLike | None = None, crs: _ConvertibleToCRS | None = None
) -> GeometryArray: ...
Expand All @@ -64,44 +66,44 @@ class GeometryArray(ExtensionArray):
def __getitem__(self, idx: int | np.integer[Any]) -> BaseGeometry: ... # Always 1-D, doesn't accept tuple
@overload
def __getitem__(
self, idx: slice | Sequence[SupportsIndex] | NDArray[np.bool_] | NDArray[np.integer[Any]]
self, idx: slice | Sequence[SupportsIndex] | NDArray[np.bool] | NDArray[np.integer[Any]]
) -> GeometryArray: ...
@overload
def __getitem__(
self, idx: int | np.integer[Any] | slice | Sequence[int] | NDArray[np.bool_] | NDArray[np.integer[Any]]
self, idx: int | np.integer[Any] | slice | Sequence[int] | NDArray[np.bool] | NDArray[np.integer[Any]]
) -> BaseGeometry | GeometryArray: ...
def __setitem__(self, key, value: _ArrayOrGeom | pd.DataFrame | pd.Series[Any]) -> None: ...
@property
def is_valid(self) -> NDArray[np.bool_]: ...
def is_valid_reason(self) -> NDArray[np.object_]: ...
def is_valid(self) -> _Array1D[np.bool]: ...
def is_valid_reason(self) -> _Array1D[np.object_]: ...
@property
def is_empty(self) -> NDArray[np.bool_]: ...
def is_empty(self) -> _Array1D[np.bool]: ...
@property
def is_simple(self) -> NDArray[np.bool_]: ...
def is_simple(self) -> _Array1D[np.bool]: ...
@property
def is_ring(self) -> NDArray[np.bool_]: ...
def is_ring(self) -> _Array1D[np.bool]: ...
@property
def is_closed(self) -> NDArray[np.bool_]: ...
def is_closed(self) -> _Array1D[np.bool]: ...
@property
def is_ccw(self) -> NDArray[np.bool_]: ...
def is_ccw(self) -> _Array1D[np.bool]: ...
@property
def has_z(self) -> NDArray[np.bool_]: ...
def has_z(self) -> _Array1D[np.bool]: ...
@property
def geom_type(self) -> NDArray[np.int64]: ...
def geom_type(self) -> _Array1D[np.int64]: ...
@property
def area(self) -> NDArray[np.float64]: ...
def area(self) -> _Array1D[np.float64]: ...
@property
def length(self) -> NDArray[np.float64]: ...
def count_coordinates(self) -> NDArray[np.int64]: ...
def count_geometries(self) -> NDArray[np.int64]: ...
def count_interior_rings(self) -> NDArray[np.int64]: ...
def get_precision(self) -> NDArray[np.float64]: ...
def get_geometry(self, index: SupportsIndex | ArrayLike) -> NDArray[np.object_]: ...
def length(self) -> _Array1D[np.float64]: ...
def count_coordinates(self) -> _Array1D[np.int64]: ...
def count_geometries(self) -> _Array1D[np.int64]: ...
def count_interior_rings(self) -> _Array1D[np.int64]: ...
def get_precision(self) -> _Array1D[np.float64]: ...
def get_geometry(self, index: SupportsIndex | ArrayLike) -> _Array1D[np.object_]: ...
@property
def boundary(self) -> GeometryArray: ...
@property
def centroid(self) -> GeometryArray: ...
def concave_hull(self, ratio: float, allow_holes: bool) -> NDArray[np.object_]: ...
def concave_hull(self, ratio: float, allow_holes: bool) -> _Array1D[np.object_]: ...
@property
def convex_hull(self) -> GeometryArray: ...
@property
Expand All @@ -118,12 +120,12 @@ class GeometryArray(ExtensionArray):
mitre_limit: float = 5.0,
) -> GeometryArray: ...
@property
def interiors(self) -> NDArray[np.object_]: ...
def interiors(self) -> _Array1D[np.object_]: ...
def remove_repeated_points(self, tolerance: float | ArrayLike = 0.0) -> GeometryArray: ...
def representative_point(self) -> GeometryArray: ...
def minimum_bounding_circle(self) -> GeometryArray: ...
def minimum_bounding_radius(self) -> NDArray[np.float64]: ...
def minimum_clearance(self) -> NDArray[np.float64]: ...
def minimum_bounding_radius(self) -> _Array1D[np.float64]: ...
def minimum_clearance(self) -> _Array1D[np.float64]: ...
def normalize(self) -> GeometryArray: ...
def make_valid(self) -> GeometryArray: ...
def reverse(self) -> GeometryArray: ...
Expand All @@ -137,21 +139,21 @@ class GeometryArray(ExtensionArray):
def set_precision(
self, grid_size: float, mode: Literal["valid_output", "pointwise", "keep_collapsed", 0, 1, 2] = "valid_output"
) -> GeometryArray: ...
def covers(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def covered_by(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def contains(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def contains_properly(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def crosses(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def disjoint(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def geom_equals(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def intersects(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def overlaps(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def touches(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def within(self, other: _ArrayOrGeom) -> NDArray[np.bool_]: ...
def dwithin(self, other: _ArrayOrGeom, distance: float) -> NDArray[np.bool_]: ...
def geom_equals_exact(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> NDArray[np.bool_]: ...
def covers(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def covered_by(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def contains(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def contains_properly(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def crosses(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def disjoint(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def geom_equals(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def intersects(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def overlaps(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def touches(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def within(self, other: _ArrayOrGeom) -> _Array1D[np.bool]: ...
def dwithin(self, other: _ArrayOrGeom, distance: float) -> _Array1D[np.bool]: ...
def geom_equals_exact(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> _Array1D[np.bool]: ...
@deprecated("Use method `geom_equals_exact` instead.")
def geom_almost_equals(self, other: _ArrayOrGeom, decimal: float) -> NDArray[np.bool_]: ...
def geom_almost_equals(self, other: _ArrayOrGeom, decimal: float) -> _Array1D[np.bool]: ...
def clip_by_rect(self, xmin: float, ymin: float, xmax: float, ymax: float) -> GeometryArray: ...
def difference(self, other: _ArrayOrGeom) -> GeometryArray: ...
def intersection(self, other: _ArrayOrGeom) -> GeometryArray: ...
Expand All @@ -160,15 +162,15 @@ class GeometryArray(ExtensionArray):
def shortest_line(self, other: _ArrayOrGeom) -> GeometryArray: ...
def snap(self, other: _ArrayOrGeom, tolerance: float | ArrayLike) -> GeometryArray: ...
def shared_paths(self, other: _ArrayOrGeom) -> GeometryArray: ...
def distance(self, other: _ArrayOrGeom) -> NDArray[np.float64]: ...
def hausdorff_distance(self, other: _ArrayOrGeom, **kwargs: Any) -> NDArray[np.float64]: ...
def frechet_distance(self, other: _ArrayOrGeom, **kwargs) -> NDArray[np.float64]: ...
def distance(self, other: _ArrayOrGeom) -> _Array1D[np.float64]: ...
def hausdorff_distance(self, other: _ArrayOrGeom, **kwargs: Any) -> _Array1D[np.float64]: ...
def frechet_distance(self, other: _ArrayOrGeom, **kwargs) -> _Array1D[np.float64]: ...
def buffer(self, distance: float | ArrayLike, resolution: int = 16, **kwargs) -> GeometryArray: ...
def interpolate(self, distance, normalized: bool = False) -> GeometryArray: ...
def simplify(self, tolerance: float | ArrayLike, preserve_topology: bool = True) -> GeometryArray: ...
def project(self, other: _ArrayOrGeom, normalized: bool = False) -> NDArray[np.float64]: ...
def relate(self, other: _ArrayOrGeom) -> NDArray[np.str_]: ...
def relate_pattern(self, other, pattern: str) -> NDArray[np.bool_]: ...
def project(self, other: _ArrayOrGeom, normalized: bool = False) -> _Array1D[np.float64]: ...
def relate(self, other: _ArrayOrGeom) -> _Array1D[np.str_]: ...
def relate_pattern(self, other, pattern: str) -> _Array1D[np.bool]: ...
def unary_union(self) -> BaseGeometry: ...
def union_all(self, method: Literal["coverage", "unary"] = "unary") -> BaseGeometry: ...
def intersection_all(self) -> BaseGeometry: ...
Expand All @@ -184,15 +186,15 @@ class GeometryArray(ExtensionArray):
def to_crs(self, crs: _ConvertibleToCRS | None = None, epsg: int | None = None) -> GeometryArray: ...
def estimate_utm_crs(self, datum_name: str = "WGS 84") -> CRS: ...
@property
def x(self) -> NDArray[np.float64]: ...
def x(self) -> _Array1D[np.float64]: ...
@property
def y(self) -> NDArray[np.float64]: ...
def y(self) -> _Array1D[np.float64]: ...
@property
def z(self) -> NDArray[np.float64]: ...
def z(self) -> _Array1D[np.float64]: ...
@property
def bounds(self) -> NDArray[np.float64]: ...
def bounds(self) -> _Array1D[np.float64]: ...
@property
def total_bounds(self) -> NDArray[np.float64]: ...
def total_bounds(self) -> _Array1D[np.float64]: ...
@property
def size(self) -> int: ...
@property
Expand All @@ -214,17 +216,17 @@ class GeometryArray(ExtensionArray):
copy: bool = True,
) -> GeometryArray: ...
def astype(self, dtype: DTypeLike, copy: bool = True) -> GeometryArray | ExtensionArray | NDArray[Any]: ...
def isna(self) -> NDArray[np.bool_]: ...
def isna(self) -> _Array1D[np.bool]: ...
def value_counts(self, dropna: bool = True) -> pd.Series[int]: ...
def unique(self) -> GeometryArray: ...
@property
def nbytes(self) -> int: ...
def shift(self, periods: int = 1, fill_value: Geometry | None = None) -> GeometryArray: ... # type: ignore[override]
def argmin(self, skipna: bool = True) -> NoReturn: ...
def argmax(self, skipna: bool = True) -> NoReturn: ...
def __array__(self, dtype: DTypeLike | None = None, copy: bool | None = None) -> NDArray[np.object_]: ...
def __eq__(self, other: object) -> NDArray[np.bool_]: ... # type: ignore[override]
def __ne__(self, other: object) -> NDArray[np.bool_]: ... # type: ignore[override]
def __array__(self, dtype: DTypeLike | None = None, copy: bool | None = None) -> _Array1D[np.object_]: ...
def __eq__(self, other: object) -> _Array1D[np.bool]: ... # type: ignore[override]
def __ne__(self, other: object) -> _Array1D[np.bool]: ... # type: ignore[override]
def __contains__(self, item: object) -> bool: ...

def transform(
Expand Down
4 changes: 2 additions & 2 deletions stubs/pandapower-stubs/groups.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def isin_group(
element_index: int | Iterable[int],
index: int | Iterable[int] | None = None,
drop_empty_lines: bool = True,
) -> bool | NDArray[np.bool_]: ...
) -> bool | NDArray[np.bool]: ...
def element_associated_groups(
net: pandapowerNet, element_type: str, element_index: Incomplete, return_empties: bool = True, drop_empty_lines: bool = True
) -> dict[int, list[int]]: ...
Expand All @@ -49,7 +49,7 @@ def compare_group_elements(net: pandapowerNet, index1: int, index2: int) -> bool
def check_unique_group_rows(net: pandapowerNet, raise_error: bool = True, log_level: str = "warning") -> None: ...
def remove_not_existing_group_members(net: pandapowerNet, verbose: bool = True) -> None: ...
def ensure_lists_in_group_element_column(net: pandapowerNet, drop_empty_lines: bool = True) -> None: ...
def group_entries_exist_in_element_table(net: pandapowerNet, index: int, element_type: str) -> NDArray[np.bool_]: ...
def group_entries_exist_in_element_table(net: pandapowerNet, index: int, element_type: str) -> NDArray[np.bool]: ...
def set_group_in_service(net: pandapowerNet, index: int) -> None: ...
def set_group_out_of_service(net: pandapowerNet, index: int) -> None: ...
def set_value_to_group(
Expand Down
4 changes: 2 additions & 2 deletions stubs/pandapower-stubs/io_utils.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,8 @@ def to_serializable(obj: object) -> Incomplete: ...
# def json_npint(obj: np.integer[Any]) -> dict[str, Incomplete]: ...
# @to_serializable.register(np.floating)
# def json_npfloat(obj: np.floating[Any]) -> dict[str, Incomplete]: ...
# @to_serializable.register(np.bool_)
# def json_npbool(obj: np.bool_) -> dict[str, Incomplete]: ...
# @to_serializable.register(np.bool)
# def json_npbool(obj: np.bool) -> dict[str, Incomplete]: ...
# @to_serializable.register(numbers.Number)
# def json_num(obj: numbers.Number) -> str: ...
# @to_serializable.register(complex)
Expand Down
2 changes: 1 addition & 1 deletion stubs/pandapower-stubs/toolbox.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def cosphi_from_pq(
tuple[float, float, _PMode, _QMode] | tuple[NDArray[np.float64], NDArray[np.float64], NDArray[np.str_], NDArray[np.str_]]
): ...
def dataframes_equal(df1: pd.DataFrame, df2: pd.DataFrame, ignore_index_order: bool = True, **kwargs: Incomplete) -> bool: ...
def compare_arrays(x: NDArray[Any], y: NDArray[Any]) -> NDArray[np.bool_]: ...
def compare_arrays(x: NDArray[Any], y: NDArray[Any]) -> NDArray[np.bool]: ...
def log_to_level(msg: object, passed_logger: Logger, level: str) -> None: ...
def lf_info(net: pandapowerNet, numv: int = 1, numi: int = 1) -> None: ...
def opf_task(
Expand Down
Loading
Loading