Skip to content

Commit 73a31b2

Browse files
committed
Autosort imports
1 parent 9fe5466 commit 73a31b2

21 files changed

+82
-63
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
"editor.codeActionsOnSave": {
1515
"source.fixAll": true,
1616
"source.fixAll.markdownlint": true,
17+
"source.organizeImports": true,
1718
},
1819
"files.insertFinalNewline": true,
1920
"trailing-spaces.includeEmptyLines": true,

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,3 +125,7 @@ disable = [
125125

126126
[tool.pylint.TYPECHECK]
127127
generated-members = "cv2"
128+
129+
[tool.isort]
130+
line_length = 120
131+
combine_as_imports = true

scripts/requirements.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,13 @@ PySide6
2222
pyautogui
2323
pywin32
2424
requests
25-
# Linting and Types
25+
# Linting, formatters and Types
2626
bandit
27+
isort
2728
flake8
2829
flake8-pyi
2930
flake8-quotes
31+
flake8-isort
3032
pylint>=2.13
3133
git+https://github.com/Avasam/pywin32-stubs.git#egg=pywin32-stubs # https://github.com/kaluluosi/pywin32-stubs/pull/4
3234
simplejson

src/AutoControlledWorker.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
from __future__ import annotations
2+
23
from typing import TYPE_CHECKING
3-
if TYPE_CHECKING:
4-
from AutoSplit import AutoSplit
4+
55
from PyQt6 import QtCore
66

77
import error_messages
88
import settings_file as settings
99

10+
if TYPE_CHECKING:
11+
from AutoSplit import AutoSplit
12+
1013

1114
class AutoControlledWorker(QtCore.QObject):
1215
def __init__(self, autosplit: AutoSplit):

src/AutoSplit.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,34 +7,34 @@
77
# - Externals
88
# - Internals
99
from __future__ import annotations
10-
from collections.abc import Callable
11-
from types import FunctionType, TracebackType
12-
from typing import Optional, Union
1310

14-
import sys
15-
import os
1611
import ctypes
12+
import os
1713
import signal
14+
import sys
1815
import traceback
16+
from collections.abc import Callable
1917
from time import time
18+
from types import FunctionType, TracebackType
19+
from typing import Optional, Union
2020

2121
import certifi
2222
import cv2
2323
from PyQt6 import QtCore, QtGui
2424
from PyQt6.QtTest import QTest
2525
from PyQt6.QtWidgets import QApplication, QFileDialog, QMainWindow, QMessageBox, QWidget
2626
from win32 import win32gui
27-
from AutoSplitImage import COMPARISON_RESIZE, AutoSplitImage, ImageType
2827

2928
import error_messages
3029
import settings_file as settings
3130
from AutoControlledWorker import AutoControlledWorker
31+
from AutoSplitImage import COMPARISON_RESIZE, AutoSplitImage, ImageType
3232
from capture_windows import capture_region, set_ui_image
3333
from gen import about, design, settings as settings_ui, update_checker
34-
from hotkeys import send_command, after_setting_hotkey
35-
from menu_bar import get_default_settings_from_ui, open_about, VERSION, open_settings, view_help, check_for_updates, \
36-
open_update_checker
37-
from screen_region import select_region, select_window, align_region, validate_before_parsing
34+
from hotkeys import after_setting_hotkey, send_command
35+
from menu_bar import (VERSION, check_for_updates, get_default_settings_from_ui, open_about, open_settings,
36+
open_update_checker, view_help)
37+
from screen_region import align_region, select_region, select_window, validate_before_parsing
3838
from settings_file import FROZEN
3939
from split_parser import BELOW_FLAG, DUMMY_FLAG, PAUSE_FLAG, parse_and_validate_images
4040

src/AutoSplitImage.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
from __future__ import annotations
22

3-
from enum import Enum
43
import os
5-
from typing import Optional, Union, TYPE_CHECKING
6-
if TYPE_CHECKING:
7-
from AutoSplit import AutoSplit
4+
from enum import Enum
5+
from typing import TYPE_CHECKING, Optional, Union
86

97
import cv2
108
import numpy as np
119
from win32con import MAXBYTE
10+
1211
import error_messages
1312
from compare import check_if_image_has_transparency, compare_histograms, compare_l2_norm, compare_phash
13+
from split_parser import (delay_from_filename, flags_from_filename, loop_from_filename, pause_from_filename,
14+
threshold_from_filename)
1415

16+
if TYPE_CHECKING:
17+
from AutoSplit import AutoSplit
1518

1619
# Resize to these width and height so that FPS performance increases
1720
COMPARISON_RESIZE_WIDTH = 320
@@ -120,7 +123,3 @@ def compare_with_capture(
120123
if comparison_method == 2:
121124
return compare_phash(self.bytes, capture, self.mask)
122125
return 0.0
123-
124-
125-
from split_parser import delay_from_filename, flags_from_filename, loop_from_filename, pause_from_filename, \
126-
threshold_from_filename

src/capture_windows.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
from __future__ import annotations
2-
from typing import Optional, cast
32

43
import ctypes
54
import ctypes.wintypes
65
from dataclasses import dataclass
7-
from PyQt6 import QtCore, QtGui
8-
from PyQt6.QtWidgets import QLabel
6+
from typing import Optional, cast
97

108
import cv2
119
import numpy as np
10+
import pywintypes
1211
import win32con
1312
import win32ui
14-
import pywintypes
13+
from PyQt6 import QtCore, QtGui
14+
from PyQt6.QtWidgets import QLabel
1515
from win32 import win32gui
1616

1717
# This is an undocumented nFlag value for PrintWindow

src/compare.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
from __future__ import annotations
2+
23
from typing import Optional
3-
from PIL import Image
4-
from win32con import MAXBYTE
4+
55
import cv2
66
import imagehash # https://github.com/JohannesBuchner/imagehash/issues/151
77
import numpy as np
8+
from PIL import Image
9+
from win32con import MAXBYTE
810

911
MAXRANGE = MAXBYTE + 1
1012
channels = [0, 1, 2]

src/error_messages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Error messages
21
import traceback
2+
33
from PyQt6 import QtCore, QtWidgets
44

55

src/hotkeys.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
from __future__ import annotations
2-
from typing import Literal, Optional, TYPE_CHECKING, Union
3-
from collections.abc import Callable
4-
5-
if TYPE_CHECKING:
6-
from AutoSplit import AutoSplit
72

83
import threading
4+
from collections.abc import Callable
5+
from typing import TYPE_CHECKING, Literal, Optional, Union
96

107
import keyboard # https://github.com/boppreh/keyboard/issues/505
118
import pyautogui # https://github.com/asweigart/pyautogui/issues/645
9+
10+
if TYPE_CHECKING:
11+
from AutoSplit import AutoSplit
12+
1213
# While not usually recommended, we don't manipulate the mouse, and we don't want the extra delay
1314
pyautogui.FAILSAFE = False
1415

0 commit comments

Comments
 (0)