diff --git a/read_in.py b/read_in.py index f65b4a0..afffe5f 100644 --- a/read_in.py +++ b/read_in.py @@ -41,7 +41,7 @@ def read_single_elevation(dat: str) -> Result[int, str]: try_(replace(dat), float, dat) ) -def read_elevation_line(line: str) -> Result[Iterator[int], Tuple[int, str]]: +def read_elevation_line(line: str) -> Result[Sequence[int], Tuple[int, str]]: """ Reads a line of elevations @@ -168,7 +168,7 @@ class UnrecognizedColor(NamedTuple): y: int "The y coordinate of the unidentifided color" -def load_gb_pixels_as_map(pixels: Iterable[Tuple[int, int]]) -> Result[Iterator[Terrain], UnrecognizedColor]: +def load_gb_pixels_as_map(pixels: Iterable[Tuple[int, int]]) -> Result[Sequence[Terrain], UnrecognizedColor]: """ Interpret the green and blue bands of an image as pixels on a map @@ -192,7 +192,7 @@ def load_gb_pixels_as_map(pixels: Iterable[Tuple[int, int]]) -> Result[Iterator[ for (pix_no, gb) in enumerate(pixels) ]) -def load_image(path: str) -> Result[List[Terrain], UnrecognizedColor]: +def load_image(path: str) -> Result[Sequence[Terrain], UnrecognizedColor]: "Run `load_gb_pixels_as_map` on an image read from a path" with Image.open(path) as im: return load_gb_pixels_as_map(zip(im.getdata(1), im.getdata(2)))