mirror of
https://github.com/1j01/textual-paint.git
synced 2024-10-05 20:07:45 +03:00
Fix type checker errors
Pyright doesn't understand that fill_style will never be changed, between its declaration and the inner function's scope. error: Argument of type "Color | None" cannot be assigned to parameter "b" of type "Color" in function "colors_match" Type "Color | None" cannot be assigned to type "Color" Type "None" cannot be assigned to type "Color" (reportGeneralTypeIssues)
This commit is contained in:
parent
d8206659c6
commit
2fdb832dbd
@ -186,8 +186,6 @@ def flood_fill(document: 'AnsiArtDocument', x: int, y: int, fill_ch: str, fill_f
|
||||
"""Flood fill algorithm."""
|
||||
|
||||
fill_style = Style(color=fill_fg, bgcolor=fill_bg)
|
||||
assert fill_style.color is not None
|
||||
assert fill_style.bgcolor is not None
|
||||
|
||||
# Get the original value of the cell.
|
||||
# This is the color to be replaced.
|
||||
@ -225,6 +223,8 @@ def flood_fill(document: 'AnsiArtDocument', x: int, y: int, fill_ch: str, fill_f
|
||||
assert color is not None
|
||||
assert original_style.bgcolor is not None
|
||||
assert original_style.color is not None
|
||||
assert fill_style.color is not None
|
||||
assert fill_style.bgcolor is not None
|
||||
return (
|
||||
document.ch[y][x] == original_ch and
|
||||
colors_match(bgcolor, original_style.bgcolor) and
|
||||
|
Loading…
Reference in New Issue
Block a user