Skip to content

Commit 787733e

Browse files
authored
Merge pull request #11 from sirfuzzalot/feat/postponed-evaluation-of-annotations
feat: postponed evaluation of annotations
2 parents b2e7e79 + d3ce72f commit 787733e

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

examples/simple_form.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ async def on_mount(self) -> None:
100100
)
101101
self.output = Static(
102102
renderable=Panel(
103-
"",
104-
title="Report",
105-
border_style="blue",
106-
box=rich.box.SQUARE
103+
"", title="Report", border_style="blue", box=rich.box.SQUARE
107104
)
108105
)
109106

@@ -130,12 +127,7 @@ async def action_submit(self) -> None:
130127
age: {self.age.value}
131128
"""
132129
await self.output.update(
133-
Panel(
134-
formatted,
135-
title="Report",
136-
border_style="blue",
137-
box=rich.box.SQUARE
138-
)
130+
Panel(formatted, title="Report", border_style="blue", box=rich.box.SQUARE)
139131
)
140132

141133
async def action_reset_focus(self) -> None:

src/textual_inputs/integer_input.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
"""
22
Simple integer input
33
"""
4+
from __future__ import annotations
5+
46
import string
5-
from typing import Any, List, Optional, Tuple, Union
7+
from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union
68

79
import rich.box
8-
from rich.console import RenderableType
910
from rich.panel import Panel
1011
from rich.style import Style
1112
from rich.text import Text
@@ -15,6 +16,9 @@
1516

1617
from textual_inputs.events import InputOnChange, InputOnFocus
1718

19+
if TYPE_CHECKING:
20+
from rich.console import RenderableType
21+
1822

1923
class IntegerInput(Widget):
2024
"""

src/textual_inputs/text_input.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
"""
22
Simple text input
33
"""
4-
from typing import Any, List, Optional, Tuple, Union
4+
from __future__ import annotations
5+
6+
from typing import TYPE_CHECKING, Any, List, Optional, Tuple, Union
57

68
import rich.box
7-
from rich.console import RenderableType
89
from rich.panel import Panel
910
from rich.style import Style
1011
from rich.text import Text
@@ -14,6 +15,9 @@
1415

1516
from textual_inputs.events import InputOnChange, InputOnFocus
1617

18+
if TYPE_CHECKING:
19+
from rich.console import RenderableType
20+
1721

1822
class TextInput(Widget):
1923
"""

0 commit comments

Comments
 (0)