| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent bc1916b commit 2bb6265
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,23 +1,25 @@ | |||
| 1 | 1 | """Non-keyboard events used in bpython curtsies REPL""" | |
| 2 | + | ||
| 2 | 3 | import time | |
| 4 | + from typing import Sequence | ||
| 3 | 5 | ||
| 4 | 6 | import curtsies.events | |
| 5 | 7 | ||
| 6 | 8 | ||
| 7 | 9 | class ReloadEvent(curtsies.events.Event): | |
| 8 | 10 | """Request to rerun REPL session ASAP because imported modules changed""" | |
| 9 | 11 | ||
| 10 | - def __init__(self, files_modified=("?",)): | ||
| 12 | + def __init__(self, files_modified: Sequence[str] = ("?",)) -> None: | ||
| 11 | 13 | self.files_modified = files_modified | |
| 12 | 14 | ||
| 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)) | ||
| 15 | 17 | ||
| 16 | 18 | ||
| 17 | 19 | class RefreshRequestEvent(curtsies.events.Event): | |
| 18 | 20 | """Request to refresh REPL display ASAP""" | |
| 19 | 21 | ||
| 20 | - def __repr__(self): | ||
| 22 | + def __repr__(self) -> str: | ||
| 21 | 23 | return "<RefreshRequestEvent for now>" | |
| 22 | 24 | ||
| 23 | 25 | ||
@@ -27,11 +29,11 @@ class ScheduledRefreshRequestEvent(curtsies.events.ScheduledEvent): | |||
| 27 | 29 | Used to schedule the disappearance of status bar message that only shows | |
| 28 | 30 | for a few seconds""" | |
| 29 | 31 | ||
| 30 | - def __init__(self, when): | ||
| 32 | + def __init__(self, when: float) -> None: | ||
| 31 | 33 | super().__init__(when) | |
| 32 | 34 | ||
| 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( | ||
| 35 | 37 | self.when - time.time() | |
| 36 | 38 | ) | |
| 37 | 39 | ||
@@ -43,5 +45,5 @@ class RunStartupFileEvent(curtsies.events.Event): | |||
| 43 | 45 | class UndoEvent(curtsies.events.Event): | |
| 44 | 46 | """Request to undo.""" | |
| 45 | 47 | ||
| 46 | - def __init__(self, n=1): | ||
| 48 | + def __init__(self, n: int = 1) -> None: | ||
| 47 | 49 | self.n = n | |
| Back | FazBrowse Home | New Git URL |
0 commit comments