mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix finals
This commit is contained in:
@@ -11,13 +11,9 @@ from . import _clock
|
||||
from ._callback import invoke
|
||||
from ._easing import DEFAULT_EASING, EASING
|
||||
from ._types import CallbackType
|
||||
from ._typing import Protocol, runtime_checkable
|
||||
from .timer import Timer
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Protocol, runtime_checkable
|
||||
else: # pragma: no cover
|
||||
from typing_extensions import Protocol, runtime_checkable
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from textual.app import App
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class MapGeometry(NamedTuple):
|
||||
|
||||
|
||||
# Maps a widget on to its geometry (information that describes its position in the composition)
|
||||
CompositorMap: TypeAlias = "dict[Widget, MapGeometry]"
|
||||
CompositorMap: TypeAlias = dict[Widget, MapGeometry]
|
||||
|
||||
|
||||
@rich.repr.auto(angular=True)
|
||||
|
||||
@@ -1,15 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import sys
|
||||
from fractions import Fraction
|
||||
from typing import cast, Sequence
|
||||
from typing import Sequence, cast
|
||||
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Protocol
|
||||
else:
|
||||
from typing_extensions import Protocol # pragma: no cover
|
||||
from ._typing import Protocol
|
||||
|
||||
|
||||
class EdgeProtocol(Protocol):
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
from fractions import Fraction
|
||||
from itertools import accumulate
|
||||
from typing import cast, Sequence, TYPE_CHECKING
|
||||
from typing import TYPE_CHECKING, Sequence, cast
|
||||
|
||||
from ._typing import Literal
|
||||
from .box_model import BoxModel
|
||||
from .css.scalar import Scalar
|
||||
from .geometry import Size
|
||||
@@ -13,12 +13,6 @@ if TYPE_CHECKING:
|
||||
from .widget import Widget
|
||||
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Literal
|
||||
else:
|
||||
from typing_extensions import Literal
|
||||
|
||||
|
||||
def resolve(
|
||||
dimensions: Sequence[Scalar],
|
||||
total: int,
|
||||
|
||||
@@ -7,7 +7,6 @@ from ._typing import Protocol
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from .message import Message
|
||||
from .strip import Strip
|
||||
|
||||
|
||||
class MessageTarget(Protocol):
|
||||
|
||||
@@ -6,8 +6,15 @@ else: # pragma: no cover
|
||||
from typing_extensions import TypeAlias
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
from typing import Final, Literal, Protocol, TypedDict
|
||||
from typing import Final, Literal, Protocol, TypedDict, runtime_checkable
|
||||
else:
|
||||
from typing_extensions import Final, Literal, Protocol, TypedDict
|
||||
from typing_extensions import Final, Literal, Protocol, TypedDict, runtime_checkable
|
||||
|
||||
__all__ = ["TypeAlias", "Final", "Literal", "Protocol", "TypedDict"]
|
||||
__all__ = [
|
||||
"Final",
|
||||
"Literal",
|
||||
"Protocol",
|
||||
"runtime_checkable",
|
||||
"TypeAlias",
|
||||
"TypedDict",
|
||||
]
|
||||
|
||||
@@ -51,6 +51,7 @@ from ._event_broker import NoHandler, extract_handler_actions
|
||||
from ._filter import LineFilter, Monochrome
|
||||
from ._path import _make_path_object_relative
|
||||
from ._typing import Final, TypeAlias
|
||||
from ._wait import wait_for_idle
|
||||
from .actions import SkipAction
|
||||
from .await_remove import AwaitRemove
|
||||
from .binding import Binding, Bindings
|
||||
@@ -68,7 +69,6 @@ from .messages import CallbackType
|
||||
from .reactive import Reactive
|
||||
from .renderables.blank import Blank
|
||||
from .screen import Screen
|
||||
from ._wait import wait_for_idle
|
||||
from .widget import AwaitMount, Widget
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@@ -7,8 +7,8 @@ from .._typing import Final
|
||||
if typing.TYPE_CHECKING:
|
||||
from .types import EdgeType
|
||||
|
||||
VALID_VISIBILITY: Final = {"visible", "hidden"}
|
||||
VALID_DISPLAY: Final = {"block", "none"}
|
||||
VALID_VISIBILITY: Final[set[str]] = {"visible", "hidden"}
|
||||
VALID_DISPLAY: Final[set[str]] = {"block", "none"}
|
||||
VALID_BORDER: Final[set[EdgeType]] = {
|
||||
"none",
|
||||
"hidden",
|
||||
@@ -26,16 +26,23 @@ VALID_BORDER: Final[set[EdgeType]] = {
|
||||
"tall",
|
||||
"wide",
|
||||
}
|
||||
VALID_EDGE: Final = {"top", "right", "bottom", "left"}
|
||||
VALID_LAYOUT: Final = {"vertical", "horizontal", "grid"}
|
||||
VALID_EDGE: Final[set[str]] = {"top", "right", "bottom", "left"}
|
||||
VALID_LAYOUT: Final[set[str]] = {"vertical", "horizontal", "grid"}
|
||||
|
||||
VALID_BOX_SIZING: Final = {"border-box", "content-box"}
|
||||
VALID_OVERFLOW: Final = {"scroll", "hidden", "auto"}
|
||||
VALID_ALIGN_HORIZONTAL: Final = {"left", "center", "right"}
|
||||
VALID_ALIGN_VERTICAL: Final = {"top", "middle", "bottom"}
|
||||
VALID_TEXT_ALIGN: Final = {"start", "end", "left", "right", "center", "justify"}
|
||||
VALID_SCROLLBAR_GUTTER: Final = {"auto", "stable"}
|
||||
VALID_STYLE_FLAGS: Final = {
|
||||
VALID_BOX_SIZING: Final[set[str]] = {"border-box", "content-box"}
|
||||
VALID_OVERFLOW: Final[set[str]] = {"scroll", "hidden", "auto"}
|
||||
VALID_ALIGN_HORIZONTAL: Final[set[str]] = {"left", "center", "right"}
|
||||
VALID_ALIGN_VERTICAL: Final[set[str]] = {"top", "middle", "bottom"}
|
||||
VALID_TEXT_ALIGN: Final[set[str]] = {
|
||||
"start",
|
||||
"end",
|
||||
"left",
|
||||
"right",
|
||||
"center",
|
||||
"justify",
|
||||
}
|
||||
VALID_SCROLLBAR_GUTTER: Final[set[str]] = {"auto", "stable"}
|
||||
VALID_STYLE_FLAGS: Final[set[str]] = {
|
||||
"b",
|
||||
"blink",
|
||||
"bold",
|
||||
@@ -53,4 +60,5 @@ VALID_STYLE_FLAGS: Final = {
|
||||
"uu",
|
||||
}
|
||||
|
||||
NULL_SPACING: Final = Spacing.all(0)
|
||||
|
||||
NULL_SPACING: Final[Spacing] = Spacing.all(0)
|
||||
|
||||
Reference in New Issue
Block a user