@@ -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 ,
@@ -137,21 +136,22 @@ def array( # type: ignore[overload-overlap]
137136 copy : bool = True ,
138137) -> PeriodArray : ...
139138@overload
140- def array ( # type: ignore[overload-overlap]
139+ def array (
141140 # float("nan") also works, but I don't know how to put it in
142141 data : Sequence [IntervalT | None ] | IntervalArray | IntervalIndex | Series [Interval ],
143142 dtype : IntervalDtype | None = None ,
144143 copy : bool = True ,
145144) -> IntervalArray : ...
146145@overload
147146def array (
147+ # TODO: Categorical Series pandas-dev/pandas-stubs#1415
148148 data : Categorical | CategoricalIndex ,
149149 dtype : CategoryDtypeArg | None = None ,
150150 copy : bool = True ,
151151) -> Categorical : ...
152152@overload
153153def array (
154- data : Sequence [object ] | np .typing .NDArray [np .object_ ] | RangeIndex ,
154+ data : SequenceNotStr [object ] | np .typing .NDArray [np .object_ ] | RangeIndex ,
155155 dtype : str | np .dtype | ExtensionDtype | None = None ,
156156 copy : bool = True ,
157157) -> NumpyExtensionArray : ...
@@ -169,7 +169,7 @@ def array(
169169) -> ArrowExtensionArray : ...
170170@overload
171171def array (
172- data : Sequence [Any ] | np_ndarray | ExtensionArray | Index [ Any ] | Series [ Any ] ,
172+ data : SequenceNotStr [Any ] | np_ndarray | ExtensionArray | Index | Series ,
173173 dtype : str | np .dtype | ExtensionDtype | None = None ,
174174 copy : bool = True ,
175175) -> ExtensionArray : ...
0 commit comments