diff --git a/src/textual/_filter.py b/src/textual/_filter.py index 86ca9858e..3857d6812 100644 --- a/src/textual/_filter.py +++ b/src/textual/_filter.py @@ -15,7 +15,6 @@ class LineFilter(ABC): @abstractmethod def filter(self, segments: list[Segment]) -> list[Segment]: """Transform a list of segments.""" - ... class Monochrome(LineFilter): diff --git a/src/textual/_types.py b/src/textual/_types.py index 1dd59297c..60d943963 100644 --- a/src/textual/_types.py +++ b/src/textual/_types.py @@ -32,6 +32,5 @@ class EventTarget(Protocol): ... -MessageHandler = Callable[["Message"], Awaitable] Lines = List[List[Segment]] CallbackType = Union[Callable[[], Awaitable[None]], Callable[[], None]] diff --git a/src/textual/_xterm_parser.py b/src/textual/_xterm_parser.py index c1df3840c..40af686a4 100644 --- a/src/textual/_xterm_parser.py +++ b/src/textual/_xterm_parser.py @@ -9,12 +9,12 @@ from . import messages from ._ansi_sequences import ANSI_SEQUENCES_KEYS from ._parser import Awaitable, Parser, TokenCallback from ._types import MessageTarget +from .keys import KEY_NAME_REPLACEMENTS + # When trying to determine whether the current sequence is a supported/valid # escape sequence, at which length should we give up and consider our search # to be unsuccessful? -from .keys import KEY_NAME_REPLACEMENTS - _MAX_SEQUENCE_SEARCH_THRESHOLD = 20 _re_mouse_event = re.compile("^" + re.escape("\x1b[") + r"( tuple[str, tuple[object, ...]]: action_name, action_params if isinstance(action_params, tuple) else (action_params,), ) - - -if __name__ == "__main__": - - print(parse("foo")) - - print(parse("view.toggle('side')")) - - print(parse("view.toggle")) diff --git a/src/textual/app.py b/src/textual/app.py index 643ffe2d3..d286dcffe 100644 --- a/src/textual/app.py +++ b/src/textual/app.py @@ -11,17 +11,12 @@ from contextlib import redirect_stderr, redirect_stdout from datetime import datetime from pathlib import Path, PurePath from time import perf_counter -from typing import Any, Generic, Iterable, Iterator, Type, TypeVar, cast, Union +from typing import Any, Generic, Iterable, Type, TypeVar, cast, Union from weakref import WeakSet, WeakValueDictionary from ._ansi_sequences import SYNC_END, SYNC_START from ._path import _make_path_object_relative -if sys.version_info >= (3, 8): - from typing import Literal -else: - from typing_extensions import Literal # pragma: no cover - import nanoid import rich import rich.repr @@ -131,7 +126,6 @@ class App(Generic[ReturnType], DOMNode): title (str | None, optional): Title of the application. If ``None``, the title is set to the name of the ``App`` subclass. Defaults to ``None``. css_path (str | PurePath | None, optional): Path to CSS or ``None`` for no CSS file. Defaults to None. watch_css (bool, optional): Watch CSS for changes. Defaults to False. - """ # Inline CSS for quick scripts (generally css_path should be preferred.) @@ -702,11 +696,6 @@ class App(Generic[ReturnType], DOMNode): self._require_stylesheet_update.add(self.screen if node is None else node) self.check_idle() - def update_visible_styles(self) -> None: - """Update visible styles only.""" - self._require_stylesheet_update.update(self.screen.visible_widgets) - self.check_idle() - def mount(self, *anon_widgets: Widget, **widgets: Widget) -> None: """Mount widgets. Widgets specified as positional args, or keywords args. If supplied as keyword args they will be assigned an id of the key. diff --git a/src/textual/css/parse.py b/src/textual/css/parse.py index c9ba19fd2..b26f171db 100644 --- a/src/textual/css/parse.py +++ b/src/textual/css/parse.py @@ -2,7 +2,7 @@ from __future__ import annotations from functools import lru_cache from pathlib import PurePath -from typing import Iterator, Iterable, NoReturn, Sequence +from typing import Iterator, Iterable, NoReturn from rich import print diff --git a/src/textual/css/styles.py b/src/textual/css/styles.py index 76bc76371..d59bea2f6 100644 --- a/src/textual/css/styles.py +++ b/src/textual/css/styles.py @@ -67,7 +67,6 @@ else: from typing_extensions import TypedDict if TYPE_CHECKING: - from .._animator import Animation from .._layout import Layout from ..dom import DOMNode diff --git a/src/textual/css/tokenizer.py b/src/textual/css/tokenizer.py index 15dc90508..51c8bf622 100644 --- a/src/textual/css/tokenizer.py +++ b/src/textual/css/tokenizer.py @@ -13,7 +13,6 @@ from rich.syntax import Syntax from rich.text import Text from ._error_tools import friendly_list -from .._loop import loop_last class TokenError(Exception): diff --git a/src/textual/drivers/linux_driver.py b/src/textual/drivers/linux_driver.py index 23fd24c12..eb8cd95ea 100644 --- a/src/textual/drivers/linux_driver.py +++ b/src/textual/drivers/linux_driver.py @@ -17,7 +17,6 @@ if TYPE_CHECKING: import rich.repr from .. import log -from .. import events from ..driver import Driver from ..geometry import Size from .._types import MessageTarget