11from __future__ import annotations
22
33from collections .abc import Mapping , Sequence
4- from typing import Any , SupportsIndex , Union , overload
4+ from typing import Any , SupportsIndex , Union , cast , overload
55
66import numpy as np
77import numpy .typing as npt
@@ -80,7 +80,7 @@ def from_array_1d(
8080 def from_array_1d (
8181 cls ,
8282 array : npt .NDArray [Any ] | Sequence [Any ],
83- dtype : type [_TRaw ] | np .dtype [_TRaw ] = ... ,
83+ dtype : type [_TRaw ] | np .dtype [_TRaw ],
8484 * ,
8585 copy : bool = ...,
8686 start_index : SupportsIndex | None = ...,
@@ -107,7 +107,7 @@ def from_array_1d(
107107
108108 @override
109109 @classmethod
110- def from_array_1d (
110+ def from_array_1d ( # pyright: ignore[reportIncompatibleMethodOverride]
111111 cls ,
112112 array : npt .NDArray [Any ] | Sequence [Any ],
113113 dtype : npt .DTypeLike = None ,
@@ -166,7 +166,7 @@ def from_array_2d(
166166 def from_array_2d (
167167 cls ,
168168 array : npt .NDArray [Any ] | Sequence [Sequence [Any ]],
169- dtype : type [_TRaw ] | np .dtype [_TRaw ] = ... ,
169+ dtype : type [_TRaw ] | np .dtype [_TRaw ],
170170 * ,
171171 copy : bool = ...,
172172 start_index : SupportsIndex | None = ...,
@@ -193,7 +193,7 @@ def from_array_2d(
193193
194194 @override
195195 @classmethod
196- def from_array_2d (
196+ def from_array_2d ( # pyright: ignore[reportIncompatibleMethodOverride]
197197 cls ,
198198 array : npt .NDArray [Any ] | Sequence [Sequence [Any ]],
199199 dtype : npt .DTypeLike = None ,
@@ -225,15 +225,19 @@ def from_array_2d(
225225 information, and scale mode are applied to all waveforms. Consider assigning
226226 these properties after construction.
227227 """
228- return super (ComplexWaveform , cls ).from_array_2d (
229- array ,
230- dtype ,
231- copy = copy ,
232- start_index = start_index ,
233- sample_count = sample_count ,
234- extended_properties = extended_properties ,
235- timing = timing ,
236- scale_mode = scale_mode ,
228+ # list[T] is invariant but we are using it in a covariant way here.
229+ return cast (
230+ list [ComplexWaveform [Any ]],
231+ super (ComplexWaveform , cls ).from_array_2d (
232+ array ,
233+ dtype ,
234+ copy = copy ,
235+ start_index = start_index ,
236+ sample_count = sample_count ,
237+ extended_properties = extended_properties ,
238+ timing = timing ,
239+ scale_mode = scale_mode ,
240+ ),
237241 )
238242
239243 __slots__ = ()
0 commit comments