Skip to content

Commit 2bb6265

Browse files
committed
Add type hints
1 parent bc1916b commit 2bb6265

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

bpython/curtsiesfrontend/events.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,25 @@
11
"""Non-keyboard events used in bpython curtsies REPL"""
2+
23
import time
4+
from typing import Sequence
35

46
import curtsies.events
57

68

79
class ReloadEvent(curtsies.events.Event):
810
"""Request to rerun REPL session ASAP because imported modules changed"""
911

10-
def __init__(self, files_modified=("?",)):
12+
def __init__(self, files_modified: Sequence[str] = ("?",)) -> None:
1113
self.files_modified = files_modified
1214

13-
def __repr__(self):
14-
return "<ReloadEvent from %s>" % (" & ".join(self.files_modified))
15+
def __repr__(self) -> str:
16+
return "<ReloadEvent from {}>".format(" & ".join(self.files_modified))
1517

1618

1719
class RefreshRequestEvent(curtsies.events.Event):
1820
"""Request to refresh REPL display ASAP"""
1921

20-
def __repr__(self):
22+
def __repr__(self) -> str:
2123
return "<RefreshRequestEvent for now>"
2224

2325

@@ -27,11 +29,11 @@ class ScheduledRefreshRequestEvent(curtsies.events.ScheduledEvent):
2729
Used to schedule the disappearance of status bar message that only shows
2830
for a few seconds"""
2931

30-
def __init__(self, when):
32+
def __init__(self, when: float) -> None:
3133
super().__init__(when)
3234

33-
def __repr__(self):
34-
return "<RefreshRequestEvent for %s seconds from now>" % (
35+
def __repr__(self) -> str:
36+
return "<RefreshRequestEvent for {} seconds from now>".format(
3537
self.when - time.time()
3638
)
3739

@@ -43,5 +45,5 @@ class RunStartupFileEvent(curtsies.events.Event):
4345
class UndoEvent(curtsies.events.Event):
4446
"""Request to undo."""
4547

46-
def __init__(self, n=1):
48+
def __init__(self, n: int = 1) -> None:
4749
self.n = n

0 commit comments

Comments
 (0)