From 86cd22e8fd446067d14c8effb2734a33bf3d0d9a Mon Sep 17 00:00:00 2001 From: Avasam Date: Fri, 7 Apr 2023 21:12:42 -0400 Subject: [PATCH] Linting and typing fixes --- src/AutoSplit.py | 5 ++++- src/error_messages.py | 4 ++-- src/region_selection.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/AutoSplit.py b/src/AutoSplit.py index 4d239b82..332e02f6 100644 --- a/src/AutoSplit.py +++ b/src/AutoSplit.py @@ -8,6 +8,7 @@ import sys from time import time from types import FunctionType +from typing import NoReturn import certifi import cv2 @@ -694,6 +695,8 @@ def __similarity_threshold_loop(self, number_of_split_images: int, dummy_splits_ QTest.qWait(wait_delta_ms) + return False + def __pause_loop(self, stop_time: float, message: str): """ Wait for a certain time and show the timer to the user. @@ -870,7 +873,7 @@ def closeEvent(self, a0: QtGui.QCloseEvent | None = None): Exit safely when closing the window """ - def exit_program(): + def exit_program() -> NoReturn: if self.update_auto_control: self.update_auto_control.terminate() self.capture_method.close(self) diff --git a/src/error_messages.py b/src/error_messages.py index 0c271e03..3aa4dd53 100644 --- a/src/error_messages.py +++ b/src/error_messages.py @@ -6,7 +6,7 @@ import sys import traceback from types import TracebackType -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, NoReturn from PyQt6 import QtCore, QtWidgets @@ -185,7 +185,7 @@ def excepthook(exception_type: type[BaseException], exception: BaseException, _t return excepthook -def handle_top_level_exceptions(exception: Exception): +def handle_top_level_exceptions(exception: Exception) -> NoReturn: message = f"AutoSplit encountered an unrecoverable exception and will likely now close. {CREATE_NEW_ISSUE_MESSAGE}" # Print error to console if not running in executable if FROZEN: diff --git a/src/region_selection.py b/src/region_selection.py index 998ba92a..64b3f1ce 100644 --- a/src/region_selection.py +++ b/src/region_selection.py @@ -12,7 +12,7 @@ from PyQt6.QtTest import QTest from win32 import win32gui from win32con import SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN -from winsdk._winrt import initialize_with_window +from winsdk._winrt import initialize_with_window # pylint: disable=no-name-in-module from winsdk.windows.foundation import AsyncStatus, IAsyncOperation from winsdk.windows.graphics.capture import GraphicsCaptureItem, GraphicsCapturePicker