Skip to content

Commit

Permalink
Fix Lines type alias definition
Browse files Browse the repository at this point in the history
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 <module>
    from . import events
  File "~/.virtualenvs/tmp-32ba2626ac1e0/lib/python3.7/site-packages/textual/events.py", line 7, in <module>
    from .message import Message
  File "~/.virtualenvs/tmp-32ba2626ac1e0/lib/python3.7/site-packages/textual/message.py", line 7, in <module>
    from ._types import MessageTarget
  File "~/.virtualenvs/tmp-32ba2626ac1e0/lib/python3.7/site-packages/textual/_types.py", line 31, in <module>
    Lines = list[list[Segment]]
TypeError: 'type' object is not subscriptable
```
  • Loading branch information
ramiro committed Jul 5, 2021
1 parent a6a912a commit b1bed03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/textual/_types.py
Original file line number Diff line number Diff line change
@@ -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):
Expand Down Expand Up @@ -28,4 +28,4 @@ async def post_message(self, message: "Message") -> bool:

MessageHandler = Callable[["Message"], Awaitable]

Lines = list[list[Segment]]
Lines = List[List[Segment]]

0 comments on commit b1bed03

Please sign in to comment.