Skip to content

Commit 8d16a71

Browse files
committed
Change the type to CursorAwareWindow
Pass None in the tests. This is good enough.
1 parent 80bd3e0 commit 8d16a71

File tree

4 files changed

+19
-6
lines changed

4 files changed

+19
-6
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
)
3737
from curtsies.configfile_keynames import keymap as key_dispatch
3838
from curtsies.input import is_main_thread
39-
from curtsies.window import BaseWindow
39+
from curtsies.window import CursorAwareWindow
4040
from cwcwidth import wcswidth
4141
from pygments import format as pygformat
4242
from pygments.formatters import TerminalFormatter
@@ -326,7 +326,7 @@ class BaseRepl(Repl):
326326
def __init__(
327327
self,
328328
config: Config,
329-
window: Optional[BaseWindow] = None,
329+
window: CursorAwareWindow,
330330
locals_: Optional[Dict[str, Any]] = None,
331331
banner: Optional[str] = None,
332332
interp: Optional[Interp] = None,

bpython/test/test_brackets_completion.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import os
2+
from typing import cast
23

34
from bpython.test import FixLanguageTestCase as TestCase, TEST_CONFIG
45
from bpython.curtsiesfrontend import repl as curtsiesrepl
56
from bpython import config
67

8+
from curtsies.window import CursorAwareWindow
9+
710

811
def setup_config(conf):
912
config_struct = config.Config(TEST_CONFIG)
@@ -18,7 +21,9 @@ def create_repl(brackets_enabled=False, **kwargs):
1821
config = setup_config(
1922
{"editor": "true", "brackets_completion": brackets_enabled}
2023
)
21-
repl = curtsiesrepl.BaseRepl(config, **kwargs)
24+
repl = curtsiesrepl.BaseRepl(
25+
config, cast(None, CursorAwareWindow), **kwargs
26+
)
2227
os.environ["PAGER"] = "true"
2328
os.environ.pop("PYTHONSTARTUP", None)
2429
repl.width = 50

bpython/test/test_curtsies_painting.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
import sys
66

77
from contextlib import contextmanager
8+
from typing import cast
89
from curtsies.formatstringarray import (
910
fsarray,
1011
assertFSArraysEqual,
1112
assertFSArraysEqualIgnoringFormatting,
1213
)
1314
from curtsies.fmtfuncs import cyan, bold, green, yellow, on_magenta, red
15+
from curtsies.window import CursorAwareWindow
1416
from unittest import mock
1517

1618
from bpython.curtsiesfrontend.events import RefreshRequestEvent
@@ -56,7 +58,7 @@ class TestRepl(BaseRepl):
5658
def _request_refresh(inner_self):
5759
pass
5860

59-
self.repl = TestRepl(config=setup_config())
61+
self.repl = TestRepl(setup_config(), cast(None, CursorAwareWindow))
6062
self.repl.height, self.repl.width = (5, 10)
6163

6264
@property
@@ -284,7 +286,9 @@ class TestRepl(BaseRepl):
284286
def _request_refresh(inner_self):
285287
self.refresh()
286288

287-
self.repl = TestRepl(banner="", config=setup_config())
289+
self.repl = TestRepl(
290+
setup_config(), cast(None, CursorAwareWindow), banner=""
291+
)
288292
self.repl.height, self.repl.width = (5, 32)
289293

290294
def send_key(self, key):

bpython/test/test_curtsies_repl.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import sys
44
import tempfile
55
import io
6+
from typing import cast
67
import unittest
78

89
from contextlib import contextmanager
@@ -23,6 +24,7 @@
2324
)
2425

2526
from curtsies import events
27+
from curtsies.window import CursorAwareWindow
2628
from importlib import invalidate_caches
2729

2830

@@ -231,7 +233,9 @@ def captured_output():
231233

232234
def create_repl(**kwargs):
233235
config = setup_config({"editor": "true"})
234-
repl = curtsiesrepl.BaseRepl(config, **kwargs)
236+
repl = curtsiesrepl.BaseRepl(
237+
config, cast(CursorAwareWindow, None), **kwargs
238+
)
235239
os.environ["PAGER"] = "true"
236240
os.environ.pop("PYTHONSTARTUP", None)
237241
repl.width = 50

0 commit comments

Comments
 (0)