From c0d156e9d7044c75173cda4cbbb7f6934e680fc6 Mon Sep 17 00:00:00 2001 From: "ZhengYu, Xu" Date: Sat, 14 Sep 2024 10:42:27 +0800 Subject: [PATCH] fix: fix the array return type (#89) --- pyarrow-stubs/__lib_pxi/array.pyi | 348 +++++++++++------------------- 1 file changed, 128 insertions(+), 220 deletions(-) diff --git a/pyarrow-stubs/__lib_pxi/array.pyi b/pyarrow-stubs/__lib_pxi/array.pyi index 5888e83..fac68c8 100644 --- a/pyarrow-stubs/__lib_pxi/array.pyi +++ b/pyarrow-stubs/__lib_pxi/array.pyi @@ -185,353 +185,274 @@ def array( @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: _DataTypeT, - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[Scalar[_DataTypeT]]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["null"], - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[scalar.NullScalar]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["bool", "boolean"], - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[scalar.BooleanScalar]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["i1", "int8"], - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[scalar.Int8Scalar]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["i2", "int16"], + type: Literal["null"] | types.NullType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.Int16Scalar]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["i4", "int32"], - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[scalar.Int32Scalar]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["i8", "int64"], - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[scalar.Int64Scalar]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["u1", "uint8"], - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[scalar.UInt8Scalar]: ... -@overload -def array( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["u2", "uint16"], - mask: Mask | None = None, - size: int | None = None, - from_pandas: bool | None = None, - safe: bool = True, - memory_pool: MemoryPool | None = None, -) -> Array[scalar.UInt16Scalar]: ... +) -> NullArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["u4", "uint32"], + type: Literal["bool", "boolean"] | types.BoolType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.UInt32Scalar]: ... +) -> BooleanArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["u8", "uint64"], + type: Literal["i1", "int8"] | types.Int8Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.UInt64Scalar]: ... +) -> Int8Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["f2", "halffloat", "float16"], + type: Literal["i2", "int16"] | types.Int16Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.HalfFloatScalar]: ... +) -> Int16Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["f4", "float", "float32"], + type: Literal["i4", "int32"] | types.Int32Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.FloatScalar]: ... +) -> Int32Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["f8", "double", "float64"], + type: Literal["i8", "int64"] | types.Int64Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.DoubleScalar]: ... +) -> Int64Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["string", "str", "utf8"], + type: Literal["u1", "uint8"] | types.Int8Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.StringScalar]: ... +) -> UInt8Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["binary"], + type: Literal["u2", "uint16"] | types.Uint16Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.BinaryScalar]: ... +) -> UInt16Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["large_string", "large_str", "large_utf8"], + type: Literal["u4", "uint32"] | types.Uint32Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.LargeStringScalar]: ... +) -> UInt32Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["large_binary"], + type: Literal["u8", "uint64"] | types.Uint64Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.LargeBinaryScalar]: ... +) -> UInt64Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["binary_view"], + type: Literal["f2", "halffloat", "float16"] | types.Float16Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.BinaryViewScalar]: ... +) -> HalfFloatArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["string_view"], + type: Literal["f4", "float", "float32"] | types.Float32Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.StringViewScalar]: ... +) -> FloatArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["date32", "date32[day]"], + type: Literal["f8", "double", "float64"] | types.Float64Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.Date32Scalar]: ... +) -> DoubleArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["date64", "date64[ms]"], + type: Literal["string", "str", "utf8"] | types.StringType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.Date64Scalar]: ... +) -> StringArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["time32[s]"], + type: Literal["binary"] | types.BinaryType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.Time32Scalar[Literal["s"]]]: ... +) -> BinaryArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["time32[ms]"], + type: Literal["large_string", "large_str", "large_utf8"] | types.LargeStringType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.Time32Scalar[Literal["ms"]]]: ... +) -> LargeStringArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["time64[us]"], + type: Literal["large_binary"] | types.LargeBinaryType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.Time64Scalar[Literal["us"]]]: ... +) -> LargeBinaryArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["time64[ns]"], + type: Literal["binary_view"] | types.BinaryViewType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.Time64Scalar[Literal["ns"]]]: ... +) -> BinaryViewArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["timestamp[s]"], + type: Literal["string_view"] | types.StringViewType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.TimestampScalar[Literal["s"]]]: ... +) -> StringViewArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["timestamp[ms]"], + type: Literal["date32", "date32[day]"] | types.Date32Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.TimestampScalar[Literal["ms"]]]: ... +) -> Date32Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["timestamp[us]"], + type: Literal["date64", "date64[ms]"] | types.Date64Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.TimestampScalar[Literal["us"]]]: ... +) -> Date64Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["timestamp[ns]"], + type: Literal["time32[s]", "time32[ms]"] | types.Time32Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.TimestampScalar[Literal["ns"]]]: ... +) -> Time32Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["duration[s]"], + type: Literal["time64[us]", "time64[ns]"] | types.Time64Type, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.DurationScalar[Literal["s"]]]: ... +) -> Time64Array: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["duration[ms]"], + type: Literal["timestamp[s]", "timestamp[ms]", "timestamp[us]"] | types.TimestampType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.DurationScalar[Literal["ms"]]]: ... +) -> TimestampArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["duration[us]"], + type: Literal["duration[s]", "duration[ms]", "duration[us]", "duration[ns]"] + | types.DurationType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.DurationScalar[Literal["us"]]]: ... +) -> DurationArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["duration[ns]"], + type: Literal["month_day_nano_interval"] | types.MonthDayNanoIntervalType, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.DurationScalar[Literal["ns"]]]: ... +) -> MonthDayNanoIntervalArray: ... @overload def array( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["month_day_nano_interval"], + type: _DataTypeT, mask: Mask | None = None, size: int | None = None, from_pandas: bool | None = None, safe: bool = True, memory_pool: MemoryPool | None = None, -) -> Array[scalar.MonthDayNanoIntervalScalar]: ... +) -> Array[Scalar[_DataTypeT]]: ... @overload def asarray(values: NullableIterable[bool]) -> BooleanArray: ... @overload @@ -555,153 +476,140 @@ def asarray(values: NullableIterable[list]) -> ListArray: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: _DataTypeT, -) -> Array[Scalar[_DataTypeT]]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["null"] -) -> Array[scalar.NullScalar]: ... + type: Literal["null"] | types.NullType, +) -> NullArray: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["bool", "boolean"], -) -> Array[scalar.BooleanScalar]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["i1", "int8"] -) -> Array[scalar.Int8Scalar]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["i2", "int16"] -) -> Array[scalar.Int16Scalar]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["i4", "int32"] -) -> Array[scalar.Int32Scalar]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["i8", "int64"] -) -> Array[scalar.Int64Scalar]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["u1", "uint8"] -) -> Array[scalar.UInt8Scalar]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["u2", "uint16"] -) -> Array[scalar.UInt16Scalar]: ... -@overload -def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["u4", "uint32"] -) -> Array[scalar.UInt32Scalar]: ... + type: Literal["bool", "boolean"] | types.BoolType, +) -> BooleanArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["u8", "uint64"] -) -> Array[scalar.UInt64Scalar]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["i1", "int8"] | types.Int8Type, +) -> Int8Array: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["f2", "halffloat", "float16"], -) -> Array[scalar.HalfFloatScalar]: ... + type: Literal["i2", "int16"] | types.Int16Type, +) -> Int16Array: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["f4", "float", "float32"], -) -> Array[scalar.FloatScalar]: ... + type: Literal["i4", "int32"] | types.Int32Type, +) -> Int32Array: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["f8", "double", "float64"], -) -> Array[scalar.DoubleScalar]: ... + type: Literal["i8", "int64"] | types.Int64Type, +) -> Int64Array: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["string", "str", "utf8"], -) -> Array[scalar.StringScalar]: ... + type: Literal["u1", "uint8"] | types.Uint8Type, +) -> UInt8Array: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["binary"] -) -> Array[scalar.BinaryScalar]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["u2", "uint16"] | types.Uint16Type, +) -> UInt16Array: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["large_string", "large_str", "large_utf8"], -) -> Array[scalar.LargeStringScalar]: ... + type: Literal["u4", "uint32"] | types.Uint32Type, +) -> UInt32Array: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["large_binary"] -) -> Array[scalar.LargeBinaryScalar]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["u8", "uint64"] | types.Uint64Type, +) -> UInt64Array: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["binary_view"] -) -> Array[scalar.BinaryViewScalar]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["f2", "halffloat", "float16"] | types.Float16Type, +) -> HalfFloatArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["string_view"] -) -> Array[scalar.StringViewScalar]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["f4", "float", "float32"] | types.Float32Type, +) -> FloatArray: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["date32", "date32[day]"], -) -> Array[scalar.Date32Scalar]: ... + type: Literal["f8", "double", "float64"] | types.Float64Type, +) -> DoubleArray: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["date64", "date64[ms]"], -) -> Array[scalar.Date64Scalar]: ... + type: Literal["string", "str", "utf8"] | types.StringType, +) -> StringArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["time32[s]"] -) -> Array[scalar.Time32Scalar[Literal["s"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["binary"] | types.BinaryType, +) -> BinaryArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["time32[ms]"] -) -> Array[scalar.Time32Scalar[Literal["ms"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["large_string", "large_str", "large_utf8"] | types.LargeStringType, +) -> LargeStringArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["time64[us]"] -) -> Array[scalar.Time64Scalar[Literal["us"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["large_binary"] | types.LargeBinaryType, +) -> LargeBinaryArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["time64[ns]"] -) -> Array[scalar.Time64Scalar[Literal["ns"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["binary_view"] | types.BinaryViewType, +) -> BinaryViewArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["timestamp[s]"] -) -> Array[scalar.TimestampScalar[Literal["s"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["string_view"] | types.StringViewType, +) -> StringViewArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["timestamp[ms]"] -) -> Array[scalar.TimestampScalar[Literal["ms"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["date32", "date32[day]"] | types.Date32Type, +) -> Date32Array: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["timestamp[us]"] -) -> Array[scalar.TimestampScalar[Literal["us"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["date64", "date64[ms]"] | types.Date64Type, +) -> Date64Array: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["timestamp[ns]"] -) -> Array[scalar.TimestampScalar[Literal["ns"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["time32[s]", "time32[ms]"] | types.Time32Type, +) -> Time32Array: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["duration[s]"] -) -> Array[scalar.DurationScalar[Literal["s"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["time64[us]", "time64[ns]"] | types.Time64Type, +) -> Time64Array: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["duration[ms]"] -) -> Array[scalar.DurationScalar[Literal["ms"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["timestamp[s]", "timestamp[ms]", "timestamp[us]", "timestamp[ns]"] + | types.TimestampType, +) -> TimestampArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["duration[us]"] -) -> Array[scalar.DurationScalar[Literal["us"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["duration[s]", "duration[ms]", "duration[us]", "duration[ns]"] + | types.DurationType, +) -> DurationArray: ... @overload def asarray( - values: Iterable | SupportArrowArray | SupportArrowDeviceArray, type: Literal["duration[ns]"] -) -> Array[scalar.DurationScalar[Literal["ns"]]]: ... + values: Iterable | SupportArrowArray | SupportArrowDeviceArray, + type: Literal["month_day_nano_interval"] | types.MonthDayNanoIntervalType, +) -> MonthDayNanoIntervalArray: ... @overload def asarray( values: Iterable | SupportArrowArray | SupportArrowDeviceArray, - type: Literal["month_day_nano_interval"], -) -> Array[scalar.MonthDayNanoIntervalScalar]: ... + type: _DataTypeT, +) -> Array[Scalar[_DataTypeT]]: ... @overload def nulls(size: int, memory_pool: MemoryPool | None = None) -> NullArray: ... @overload