diff --git a/dungeonbattle/TermManager.py b/dungeonbattle/term_manager.py similarity index 76% rename from dungeonbattle/TermManager.py rename to dungeonbattle/term_manager.py index d4ba565..1f1d364 100644 --- a/dungeonbattle/TermManager.py +++ b/dungeonbattle/term_manager.py @@ -1,7 +1,8 @@ import curses +from types import TracebackType -class TermManager(): - + +class TermManager: def __init__(self): self.screen = curses.initscr() # convert escapes sequences to curses abstraction @@ -14,9 +15,10 @@ class TermManager(): curses.curs_set(False) def __enter__(self): - return self.screen + return self - def __exit__(self, type, value, traceback): + def __exit__(self, exc_type: type, exc_value: Exception, + exc_traceback: TracebackType) -> None: # restore the terminal to its original state self.screen.keypad(False) curses.echo()