From b1bed03c5eb93dbfa632f1205c5237e6ab3b8944 Mon Sep 17 00:00:00 2001 From: Ramiro Morales Date: Mon, 5 Jul 2021 13:29:35 -0300 Subject: [PATCH] Fix `Lines` type alias definition Currently it fails with ```python Traceback (most recent call last): File "~/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 193, in _run_module_as_main "__main__", mod_spec) File "~/.pyenv/versions/3.7.9/lib/python3.7/runpy.py", line 85, in _run_code exec(code, run_globals) File "~/.virtualenvs/tmp-32ba2626ac1e0/lib/python3.7/site-packages/textual/app.py", line 18, in from . import events File "~/.virtualenvs/tmp-32ba2626ac1e0/lib/python3.7/site-packages/textual/events.py", line 7, in from .message import Message File "~/.virtualenvs/tmp-32ba2626ac1e0/lib/python3.7/site-packages/textual/message.py", line 7, in from ._types import MessageTarget File "~/.virtualenvs/tmp-32ba2626ac1e0/lib/python3.7/site-packages/textual/_types.py", line 31, in Lines = list[list[Segment]] TypeError: 'type' object is not subscriptable ``` --- src/textual/_types.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/textual/_types.py b/src/textual/_types.py index 5dc7aa107a..14f6b90b4e 100644 --- a/src/textual/_types.py +++ b/src/textual/_types.py @@ -1,5 +1,5 @@ import sys -from typing import Awaitable, Callable, Optional, TYPE_CHECKING +from typing import Awaitable, Callable, List, Optional, TYPE_CHECKING from rich.segment import Segment if sys.version_info >= (3, 8): @@ -28,4 +28,4 @@ async def post_message(self, message: "Message") -> bool: MessageHandler = Callable[["Message"], Awaitable] -Lines = list[list[Segment]] \ No newline at end of file +Lines = List[List[Segment]]