Tweak a couple types

This commit is contained in:
Emi Simpson 2023-02-12 11:09:53 -05:00
parent 0d728f62bd
commit e188ff2210
Signed by: Emi
GPG Key ID: A12F2C2FFDC3D847
1 changed files with 3 additions and 3 deletions

View File

@ -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)))