@@ -30,7 +30,6 @@ from pandas.core.indexes.period import PeriodIndex
3030from pandas .core .indexes .range import RangeIndex
3131from pandas .core .indexes .timedeltas import TimedeltaIndex
3232from pandas .core .series import Series
33- from typing_extensions import Never
3433
3534from pandas ._libs .interval import Interval
3635from pandas ._libs .missing import NAType
@@ -66,13 +65,13 @@ from pandas.core.dtypes.dtypes import (
6665)
6766
6867@overload
69- def array ( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
70- data : Sequence [ Never ] | Index [ Never ] | Series [ Never ] ,
71- dtype : str | np . dtype | ExtensionDtype | None = None ,
68+ def array ( # type: ignore[overload-overlap]
69+ data : SequenceNotStr [ Any ] | np_ndarray | ExtensionArray | Index | Series ,
70+ dtype : CategoryDtypeArg ,
7271 copy : bool = True ,
73- ) -> ExtensionArray : ...
72+ ) -> Categorical : ...
7473@overload
75- def array ( # type: ignore[overload-overlap]
74+ def array ( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
7675 data : Sequence [NAType | None ],
7776 dtype : str | np .dtype | ExtensionDtype | None = None ,
7877 copy : bool = True ,
@@ -143,21 +142,22 @@ def array( # type: ignore[overload-overlap]
143142 copy : bool = True ,
144143) -> PeriodArray : ...
145144@overload
146- def array ( # type: ignore[overload-overlap]
145+ def array (
147146 # float("nan") also works, but I don't know how to put it in
148147 data : Sequence [IntervalT | None ] | IntervalArray | IntervalIndex | Series [Interval ],
149148 dtype : IntervalDtype | None = None ,
150149 copy : bool = True ,
151150) -> IntervalArray : ...
152151@overload
153152def array (
153+ # TODO: Categorical Series pandas-dev/pandas-stubs#1415
154154 data : Categorical | CategoricalIndex ,
155155 dtype : CategoryDtypeArg | None = None ,
156156 copy : bool = True ,
157157) -> Categorical : ...
158158@overload
159159def array (
160- data : Sequence [object ] | np .typing .NDArray [np .object_ ] | RangeIndex ,
160+ data : SequenceNotStr [object ] | np .typing .NDArray [np .object_ ] | RangeIndex ,
161161 dtype : str | np .dtype | ExtensionDtype | None = None ,
162162 copy : bool = True ,
163163) -> NumpyExtensionArray : ...
@@ -175,7 +175,7 @@ def array(
175175) -> ArrowExtensionArray : ...
176176@overload
177177def array (
178- data : Sequence [Any ] | np_ndarray | ExtensionArray | Index [ Any ] | Series [ Any ] ,
178+ data : SequenceNotStr [Any ] | np_ndarray | ExtensionArray | Index | Series ,
179179 dtype : str | np .dtype | ExtensionDtype | None = None ,
180180 copy : bool = True ,
181181) -> ExtensionArray : ...
0 commit comments