Removing some more unused code

This commit is contained in:
Darren Burns
2022-10-13 11:37:39 +01:00
parent 7bce50476c
commit 6b10895eac
9 changed files with 4 additions and 30 deletions

View File

@@ -15,7 +15,6 @@ class LineFilter(ABC):
@abstractmethod @abstractmethod
def filter(self, segments: list[Segment]) -> list[Segment]: def filter(self, segments: list[Segment]) -> list[Segment]:
"""Transform a list of segments.""" """Transform a list of segments."""
...
class Monochrome(LineFilter): class Monochrome(LineFilter):

View File

@@ -32,6 +32,5 @@ class EventTarget(Protocol):
... ...
MessageHandler = Callable[["Message"], Awaitable]
Lines = List[List[Segment]] Lines = List[List[Segment]]
CallbackType = Union[Callable[[], Awaitable[None]], Callable[[], None]] CallbackType = Union[Callable[[], Awaitable[None]], Callable[[], None]]

View File

@@ -9,12 +9,12 @@ from . import messages
from ._ansi_sequences import ANSI_SEQUENCES_KEYS from ._ansi_sequences import ANSI_SEQUENCES_KEYS
from ._parser import Awaitable, Parser, TokenCallback from ._parser import Awaitable, Parser, TokenCallback
from ._types import MessageTarget from ._types import MessageTarget
from .keys import KEY_NAME_REPLACEMENTS
# When trying to determine whether the current sequence is a supported/valid # 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 # escape sequence, at which length should we give up and consider our search
# to be unsuccessful? # to be unsuccessful?
from .keys import KEY_NAME_REPLACEMENTS
_MAX_SEQUENCE_SEARCH_THRESHOLD = 20 _MAX_SEQUENCE_SEARCH_THRESHOLD = 20
_re_mouse_event = re.compile("^" + re.escape("\x1b[") + r"(<?[\d;]+[mM]|M...)\Z") _re_mouse_event = re.compile("^" + re.escape("\x1b[") + r"(<?[\d;]+[mM]|M...)\Z")

View File

@@ -1,7 +1,6 @@
from __future__ import annotations from __future__ import annotations
import ast import ast
from typing import Any, Tuple
import re import re
@@ -41,12 +40,3 @@ def parse(action: str) -> tuple[str, tuple[object, ...]]:
action_name, action_name,
action_params if isinstance(action_params, tuple) else (action_params,), 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"))

View File

@@ -11,17 +11,12 @@ from contextlib import redirect_stderr, redirect_stdout
from datetime import datetime from datetime import datetime
from pathlib import Path, PurePath from pathlib import Path, PurePath
from time import perf_counter 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 weakref import WeakSet, WeakValueDictionary
from ._ansi_sequences import SYNC_END, SYNC_START from ._ansi_sequences import SYNC_END, SYNC_START
from ._path import _make_path_object_relative 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 nanoid
import rich import rich
import rich.repr 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``. 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. 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. watch_css (bool, optional): Watch CSS for changes. Defaults to False.
""" """
# Inline CSS for quick scripts (generally css_path should be preferred.) # 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._require_stylesheet_update.add(self.screen if node is None else node)
self.check_idle() 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: def mount(self, *anon_widgets: Widget, **widgets: Widget) -> None:
"""Mount widgets. Widgets specified as positional args, or keywords args. If supplied """Mount widgets. Widgets specified as positional args, or keywords args. If supplied
as keyword args they will be assigned an id of the key. as keyword args they will be assigned an id of the key.

View File

@@ -2,7 +2,7 @@ from __future__ import annotations
from functools import lru_cache from functools import lru_cache
from pathlib import PurePath from pathlib import PurePath
from typing import Iterator, Iterable, NoReturn, Sequence from typing import Iterator, Iterable, NoReturn
from rich import print from rich import print

View File

@@ -67,7 +67,6 @@ else:
from typing_extensions import TypedDict from typing_extensions import TypedDict
if TYPE_CHECKING: if TYPE_CHECKING:
from .._animator import Animation
from .._layout import Layout from .._layout import Layout
from ..dom import DOMNode from ..dom import DOMNode

View File

@@ -13,7 +13,6 @@ from rich.syntax import Syntax
from rich.text import Text from rich.text import Text
from ._error_tools import friendly_list from ._error_tools import friendly_list
from .._loop import loop_last
class TokenError(Exception): class TokenError(Exception):

View File

@@ -17,7 +17,6 @@ if TYPE_CHECKING:
import rich.repr import rich.repr
from .. import log from .. import log
from .. import events
from ..driver import Driver from ..driver import Driver
from ..geometry import Size from ..geometry import Size
from .._types import MessageTarget from .._types import MessageTarget