Skip to content

Linting and typing fixes #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/AutoSplit.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import sys
from time import time
from types import FunctionType
from typing import NoReturn

import certifi
import cv2
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions src/error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/region_selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down