diff --git a/spiel/app.py b/spiel/app.py index 8b01e07..1e1e9f0 100644 --- a/spiel/app.py +++ b/spiel/app.py @@ -11,7 +11,7 @@ from functools import cached_property, partial from pathlib import Path from time import monotonic -from typing import Callable, ContextManager, Iterator +from typing import Callable, ClassVar, ContextManager, Iterator, List from rich.style import Style from rich.text import Text @@ -67,7 +67,7 @@ def load_deck(path: Path) -> Deck: class SpielApp(App[None]): CSS_PATH = "spiel.css" - BINDINGS = [ + BINDINGS: ClassVar[List[Binding]] = [ Binding("d", "switch_screen('deck')", "Go to the Deck view."), Binding("question_mark", "push_screen('help')", "Go to the Help view."), Binding("i", "repl", "Switch to the REPL."), diff --git a/spiel/screens/deck.py b/spiel/screens/deck.py index de56f77..d78a785 100644 --- a/spiel/screens/deck.py +++ b/spiel/screens/deck.py @@ -1,5 +1,7 @@ from __future__ import annotations +from typing import ClassVar, List + from textual.app import ComposeResult from textual.binding import Binding @@ -9,7 +11,7 @@ class DeckScreen(SpielScreen): - BINDINGS = [ + BINDINGS: ClassVar[List[Binding]] = [ Binding("right", "next_slide", "Go to next slide."), Binding("left", "prev_slide", "Go to previous slide."), Binding("down", "next_row", "Go to next row of slides."), diff --git a/spiel/screens/help.py b/spiel/screens/help.py index 025d478..3c4d9d6 100644 --- a/spiel/screens/help.py +++ b/spiel/screens/help.py @@ -1,5 +1,7 @@ from __future__ import annotations +from typing import ClassVar, List + from textual.app import ComposeResult from textual.binding import Binding from textual.containers import Container @@ -19,7 +21,7 @@ class HelpScreen(SpielScreen): } """ - BINDINGS = [ + BINDINGS: ClassVar[List[Binding]] = [ Binding("escape,enter", "pop_screen", "Return to the previous view."), ] diff --git a/spiel/screens/slide.py b/spiel/screens/slide.py index cc6ce40..a3e2025 100644 --- a/spiel/screens/slide.py +++ b/spiel/screens/slide.py @@ -1,6 +1,7 @@ from __future__ import annotations import inspect +from typing import ClassVar, List from textual.app import ComposeResult from textual.binding import Binding @@ -14,7 +15,7 @@ class SlideScreen(SpielScreen): - BINDINGS = [ + BINDINGS: ClassVar[List[Binding]] = [ Binding("right", "next_slide", "Go to next slide."), Binding("left", "prev_slide", "Go to previous slide."), Binding("t", "trigger", "Trigger the current slide."), diff --git a/tests/cli/test_help.py b/tests/cli/test_help.py index 92aa50e..5f00831 100644 --- a/tests/cli/test_help.py +++ b/tests/cli/test_help.py @@ -14,6 +14,6 @@ def test_help(runner: CliRunner) -> None: def test_help_via_main() -> None: - result = subprocess.run([sys.executable, "-m", PACKAGE_NAME, "--help"]) + result = subprocess.run([sys.executable, "-m", PACKAGE_NAME, "--help"], check=False) assert result.returncode == 0