|
1 | | -from typing import Iterator |
| 1 | +from typing import Iterator, Sequence |
2 | 2 | from warnings import warn |
3 | 3 |
|
4 | 4 | from tivars.models import * |
@@ -192,10 +192,10 @@ def __iter__(self) -> Iterator[pixel_type]: |
192 | 192 | for col in row: |
193 | 193 | yield col |
194 | 194 |
|
195 | | - @Loader[list, ] |
196 | | - def load_array(self, arr: list[list[pixel_type]]): |
| 195 | + @Loader[Sequence] |
| 196 | + def load_array(self, arr: Sequence[Sequence[pixel_type]]): |
197 | 197 | """ |
198 | | - Loads a two-dimensional ``list`` of pixels into this picture |
| 198 | + Loads a two-dimensional sequence of pixels into this picture |
199 | 199 |
|
200 | 200 | :param arr: The array to load |
201 | 201 | """ |
@@ -257,8 +257,8 @@ def __init__(self, init=None, *, |
257 | 257 | def get_min_os(self, data: bytes = None) -> OsVersion: |
258 | 258 | return TI_83P.OS() |
259 | 259 |
|
260 | | - @Loader[list] |
261 | | - def load_array(self, arr: list[list[pixel_type]]): |
| 260 | + @Loader[Sequence] |
| 261 | + def load_array(self, arr: Sequence[Sequence[pixel_type]]): |
262 | 262 | self.data = b''.join(L1.set(entry) for row in arr for entry in zip(*[iter(row)] * 8, strict=True)) |
263 | 263 |
|
264 | 264 | def array(self) -> list[list[pixel_type]]: |
@@ -308,8 +308,8 @@ def __init__(self, init=None, *, |
308 | 308 | def get_min_os(self, data: bytes = None) -> OsVersion: |
309 | 309 | return TI_84PCSE.OS() |
310 | 310 |
|
311 | | - @Loader[list] |
312 | | - def load_array(self, arr: list[list[pixel_type]]): |
| 311 | + @Loader[Sequence] |
| 312 | + def load_array(self, arr: Sequence[Sequence[pixel_type]]): |
313 | 313 | self.data = b''.join(RGBPalette.set(entry) for row in arr for entry in zip(row[::2], row[1::2])) |
314 | 314 |
|
315 | 315 | def array(self) -> list[list[pixel_type]]: |
@@ -400,8 +400,8 @@ def data(self) -> bytes: |
400 | 400 | def get_min_os(self, data: bytes = None) -> OsVersion: |
401 | 401 | return TI_84PCSE.OS() |
402 | 402 |
|
403 | | - @Loader[list] |
404 | | - def load_array(self, arr: list[list[pixel_type]]): |
| 403 | + @Loader[Sequence] |
| 404 | + def load_array(self, arr: Sequence[Sequence[pixel_type]]): |
405 | 405 | self.data = b''.join(RGB565.set(entry) for row in arr[::-1] for entry in row + [(0, 0, 0)]) |
406 | 406 |
|
407 | 407 | def array(self) -> list[list[pixel_type]]: |
|
0 commit comments