mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
typing of Final
This commit is contained in:
@@ -1,25 +1,22 @@
|
|||||||
"""Simple version of 5x5, developed for/with Textual."""
|
"""Simple version of 5x5, developed for/with Textual."""
|
||||||
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import cast
|
from typing import TYPE_CHECKING, cast
|
||||||
import sys
|
|
||||||
|
|
||||||
if sys.version_info >= (3, 8):
|
|
||||||
from typing import Final
|
|
||||||
else:
|
|
||||||
from typing_extensions import Final
|
|
||||||
|
|
||||||
from textual.containers import Horizontal
|
|
||||||
from textual.app import App, ComposeResult
|
|
||||||
from textual.screen import Screen
|
|
||||||
from textual.widget import Widget
|
|
||||||
from textual.widgets import Footer, Button, Label
|
|
||||||
from textual.css.query import DOMQuery
|
|
||||||
from textual.reactive import reactive
|
|
||||||
from textual.binding import Binding
|
|
||||||
|
|
||||||
from rich.markdown import Markdown
|
from rich.markdown import Markdown
|
||||||
|
|
||||||
|
from textual.app import App, ComposeResult
|
||||||
|
from textual.binding import Binding
|
||||||
|
from textual.containers import Horizontal
|
||||||
|
from textual.css.query import DOMQuery
|
||||||
|
from textual.reactive import reactive
|
||||||
|
from textual.screen import Screen
|
||||||
|
from textual.widget import Widget
|
||||||
|
from textual.widgets import Button, Footer, Label
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Final
|
||||||
|
|
||||||
|
|
||||||
class Help(Screen):
|
class Help(Screen):
|
||||||
"""The help screen for the application."""
|
"""The help screen for the application."""
|
||||||
|
|||||||
@@ -19,6 +19,5 @@ __all__ = [
|
|||||||
"Literal",
|
"Literal",
|
||||||
"Protocol",
|
"Protocol",
|
||||||
"runtime_checkable",
|
"runtime_checkable",
|
||||||
"TypeAlias",
|
|
||||||
"TypedDict",
|
"TypedDict",
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from typing import Iterable, Iterator
|
from typing import Iterable, Iterator, TYPE_CHECKING
|
||||||
|
|
||||||
import rich.repr
|
import rich.repr
|
||||||
from rich.console import RenderableType
|
from rich.console import RenderableType
|
||||||
@@ -15,11 +15,12 @@ from .dom import DOMNode
|
|||||||
from .timer import Timer
|
from .timer import Timer
|
||||||
from ._types import CallbackType
|
from ._types import CallbackType
|
||||||
from .geometry import Offset, Region, Size
|
from .geometry import Offset, Region, Size
|
||||||
from ._typing import Final
|
|
||||||
from .reactive import Reactive
|
from .reactive import Reactive
|
||||||
from .renderables.blank import Blank
|
from .renderables.blank import Blank
|
||||||
from .widget import Widget
|
from .widget import Widget
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from typing import Final
|
||||||
|
|
||||||
# Screen updates will be batched so that they don't happen more often than 120 times per second:
|
# Screen updates will be batched so that they don't happen more often than 120 times per second:
|
||||||
UPDATE_PERIOD: Final[float] = 1 / 120
|
UPDATE_PERIOD: Final[float] = 1 / 120
|
||||||
|
|||||||
Reference in New Issue
Block a user