mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix typing of tuple[] for py3.7
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import functools
|
||||
from typing import Iterable, cast
|
||||
from typing import Iterable, Tuple, cast
|
||||
|
||||
from rich.cells import cell_len
|
||||
from rich.color import Color
|
||||
@@ -63,13 +63,16 @@ class TextOpacity:
|
||||
_from_color = Style.from_color
|
||||
if opacity == 0:
|
||||
for text, style, control in cast(
|
||||
Iterable[tuple[str, Style, object]], segments
|
||||
# use Tuple rather than tuple so Python 3.7 doesn't complain
|
||||
Iterable[Tuple[str, Style, object]],
|
||||
segments,
|
||||
):
|
||||
invisible_style = _from_color(bgcolor=style.bgcolor)
|
||||
yield _Segment(cell_len(text) * " ", invisible_style)
|
||||
else:
|
||||
for segment in segments:
|
||||
text, style, control = cast(tuple[str, Style, object], segment)
|
||||
# use Tuple rather than tuple so Python 3.7 doesn't complain
|
||||
text, style, control = cast(Tuple[str, Style, object], segment)
|
||||
if not style:
|
||||
yield segment
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user