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."""
|
||||
|
||||
from pathlib import Path
|
||||
from typing import 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 typing import TYPE_CHECKING, cast
|
||||
|
||||
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):
|
||||
"""The help screen for the application."""
|
||||
|
||||
@@ -19,6 +19,5 @@ __all__ = [
|
||||
"Literal",
|
||||
"Protocol",
|
||||
"runtime_checkable",
|
||||
"TypeAlias",
|
||||
"TypedDict",
|
||||
]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Iterable, Iterator
|
||||
from typing import Iterable, Iterator, TYPE_CHECKING
|
||||
|
||||
import rich.repr
|
||||
from rich.console import RenderableType
|
||||
@@ -15,11 +15,12 @@ from .dom import DOMNode
|
||||
from .timer import Timer
|
||||
from ._types import CallbackType
|
||||
from .geometry import Offset, Region, Size
|
||||
from ._typing import Final
|
||||
from .reactive import Reactive
|
||||
from .renderables.blank import Blank
|
||||
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:
|
||||
UPDATE_PERIOD: Final[float] = 1 / 120
|
||||
|
||||
Reference in New Issue
Block a user