diff --git a/src/idlealign/extension.py b/src/idlealign/extension.py index b5f8170..66c59a1 100644 --- a/src/idlealign/extension.py +++ b/src/idlealign/extension.py @@ -35,7 +35,7 @@ from re import Pattern -class AlignDialog(SearchDialogBase): +class AlignDialog(SearchDialogBase): # type: ignore[misc,unused-ignore] """Dialog for aligning by a pattern in text.""" __slots__ = ( @@ -100,7 +100,7 @@ def store_prefs(self) -> None: self.search_params = utils.get_search_engine_params(self.engine) utils.set_search_engine_params(self.engine, self.global_search_params) - def open( # type: ignore # "override" + def open( # type: ignore[override,unused-ignore] self, searchphrase: str | None = None, insert_tags: str | list[str] | tuple[str, ...] = (), @@ -173,7 +173,7 @@ def default_command(self, _event: Event[Any] | None = None) -> bool: pattern = self.engine.getprog() if not pattern: - return False # type: ignore # "unreachable" + return False # type: ignore[unreachable,unused-ignore] space_wrap: bool = self.space_wrap_var.get() align_side: bool = self.align_side_var.get() @@ -229,14 +229,14 @@ def create_window(self) -> AlignDialog: engine: searchengine.SearchEngine = searchengine.get(root) if not hasattr(engine, "_aligndialog"): - engine._aligndialog = AlignDialog( # type: ignore[attr-defined] + engine._aligndialog = AlignDialog( # type: ignore[attr-defined,unused-ignore] root, engine, self, ) return cast( AlignDialog, - engine._aligndialog, # type: ignore[attr-defined] + engine._aligndialog, # type: ignore[attr-defined,unused-ignore] ) @utils.log_exceptions diff --git a/src/idlealign/utils.py b/src/idlealign/utils.py index 3dc94b6..899eca5 100644 --- a/src/idlealign/utils.py +++ b/src/idlealign/utils.py @@ -338,13 +338,13 @@ def wrapper(*args: PS.args, **kwargs: PS.kwargs) -> T: """Catch Exceptions, log them to log file, and re-raise.""" try: return function(*args, **kwargs) - except Exception as exc: + except Exception: if not LOGS_PATH.exists(): LOGS_PATH.mkdir(exist_ok=True) log_file = LOGS_PATH / f"{TITLE}.log" with log_file.open("a", encoding="utf-8") as fp: format_time = time.strftime("[%Y-%m-%d %H:%M:%S] ") - exception_text = "".join(traceback.format_exception(exc)) + exception_text = "".join(traceback.format_exc()) for line in exception_text.splitlines(keepends=True): fp.write(f"{format_time}{line}") raise