Skip to content

Commit 9ab65a3

Browse files
committed
type overload
Signed-off-by: Thijs Baaijen <[email protected]>
1 parent 6ed33b0 commit 9ab65a3

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/power_grid_model_ds/_core/fancypy.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
"""A set of helper functions that mimic numpy functions but are specifically designed for FancyArrays."""
66

7-
from typing import TYPE_CHECKING, TypeVar, Union
7+
from typing import TYPE_CHECKING, TypeVar, Union, overload
88

99
import numpy as np
1010

@@ -26,7 +26,15 @@ def concatenate(fancy_array: T, *other_arrays: Union[T, np.ndarray]) -> T:
2626
return fancy_array.__class__(data=concatenated)
2727

2828

29-
def unique(array: T, **kwargs):
29+
@overload
30+
def unique(array: T) -> T: ...
31+
32+
33+
@overload
34+
def unique(array: T, **kwargs) -> tuple[T, ...]: ...
35+
36+
37+
def unique(array, **kwargs):
3038
"""Return the unique elements of the array."""
3139
for column in array.columns:
3240
if np.issubdtype(array.dtype[column], np.floating) and np.isnan(array[column]).any():

0 commit comments

Comments
 (0)