Skip to content

Commit f4b64b0

Browse files
committed
Merge branch 'use-pywin32-stubs-fork' of https://github.com/Avasam/Auto-Split into More-capture-options
2 parents a7a1308 + fa6037b commit f4b64b0

21 files changed

+25
-66195
lines changed

.flake8

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,17 @@ color=always
33
max-line-length=120
44
; Auto generated
55
exclude=src/gen/
6-
; Linebreak before binary operator
7-
; Allow default value other than "..."
8-
; Allow imports at the bottom of file
9-
ignore=W503,Y015,E402
6+
ignore=
7+
W503, ; Linebreak before binary operator
8+
Y015, ; Allow default value other than "..."
9+
E402, ; Allow imports at the bottom of file
10+
Y026, ; Not using typing_extensions
1011
per-file-ignores=
11-
; Function bodys contain other than just ... (eg: raise)
12-
; Default values for typed arguments
13-
typings/win32typing/__init__.pyi: Q000,E704,E501,N8, Y021,Y020, Y010,Y011
14-
typings/win32-stubs/win32gui.pyi: Q000,E704,E501,N8, Y021,Y020, Y010,Y011
15-
16-
; Docstrings in type stubs
17-
; Quoted annotations
18-
; TypeAlias
19-
typings/win32*/*: Q000,E704,E501,N8, Y021,Y020,Y026
20-
2112
; Docstrings in type stubs
2213
; Function bodys contain other than just ... (eg: raise)
23-
; TypeAlias
14+
2415
; Single quote docstrings
25-
typings/cv2-stubs/__init__.pyi: Q000,E704,E501,N8, Y021,Y010,Y026, Q002
16+
typings/cv2-stubs/__init__.pyi: Q000,E704,E501,N8, Y021,Y010, Q002
2617

2718
; Quotes
2819
; Allow ... on same line as def

.vscode/settings.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@
6666
"python.linting.flake8CategorySeverity.F": "Warning",
6767
// PEP8 Naming convention
6868
"python.linting.flake8CategorySeverity.N": "Warning",
69+
// PYI
70+
"python.linting.flake8CategorySeverity.Y": "Warning",
6971
// PyRight obsoletes mypy
7072
"python.linting.mypyEnabled": false,
7173
// Is already wrapped by Flake8, prospector and pylama

pyproject.toml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,21 @@ aggressive = 3
1616
pythonPlatform = "Windows"
1717
typeCheckingMode = "strict"
1818
# Extra strict
19-
reportPropertyTypeMismatch=true
20-
reportUninitializedInstanceVariable=true
21-
reportCallInDefaultInitializer=true
22-
reportImplicitStringConcatenation=true
23-
ignore = [
19+
reportImplicitStringConcatenation="error"
20+
reportCallInDefaultInitializer="error"
21+
reportMissingSuperCall="none" # False positives on base classes
22+
reportPropertyTypeMismatch="error"
23+
reportUninitializedInstanceVariable="error"
24+
reportUnnecessaryTypeIgnoreComment="error"
25+
reportUnusedCallResult="none"
26+
exclude = [
2427
# Auto generated
2528
"src/gen/",
2629
# We expect stub files to be incomplete or contain useless statements
2730
"typings/",
2831
]
29-
reportMissingTypeStubs = "information"
32+
# Type stubs may not be completable
33+
reportMissingTypeStubs = "warning"
3034
# False positives with TYPE_CHECKING
3135
reportImportCycles = "information"
3236
# False positives with PyQt .connect. pylint(no-member) works instead

scripts/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ bandit
3030
flake8
3131
flake8-pyi
3232
flake8-quotes
33-
pylint
34-
pywin32-stubs
33+
pylint>=2.13
34+
git+https://github.com/Avasam/pywin32-stubs.git#egg=pywin32-stubs # https://github.com/kaluluosi/pywin32-stubs/pull/4
3535
simplejson
3636
types-simplejson>=3.17.2
3737
types-requests

src/AutoSplit.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -753,8 +753,7 @@ def __get_capture_for_comparison(self):
753753
if capture is None:
754754
# Try to recover by using the window name
755755
self.live_image.setText("Trying to recover window...")
756-
# https://github.com/kaluluosi/pywin32-stubs/issues/7
757-
hwnd = win32gui.FindWindow(None, self.settings_dict["captured_window_title"]) # type: ignore
756+
hwnd = win32gui.FindWindow(None, self.settings_dict["captured_window_title"])
758757
# Don't fallback to desktop
759758
if hwnd:
760759
self.hwnd = hwnd

src/capture_windows.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,7 @@ def __bit_blt_capture(hwnd: int, selection: Region, render_full_content: bool =
4141
# If the window closes while it's being manipulated, it could cause a crash
4242
try:
4343
window_dc: int = win32gui.GetWindowDC(hwnd)
44-
# https://github.com/kaluluosi/pywin32-stubs/issues/6
45-
dc_object: PyCDC = win32ui.CreateDCFromHandle(window_dc) # type: ignore
44+
dc_object: PyCDC = win32ui.CreateDCFromHandle(window_dc)
4645

4746
# Causes a 10-15x performance drop. But allows recording hardware accelerated windows
4847
if render_full_content:

src/menu_bar.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ def get_default_settings_from_ui(autosplit: AutoSplit):
210210
"pause_hotkey": default_settings_dialog.pause_input.text(),
211211
"fps_limit": default_settings_dialog.fps_limit_spinbox.value(),
212212
"live_capture_region": default_settings_dialog.live_capture_region_checkbox.isChecked(),
213-
"capture_method": get_capture_method_by_index(default_settings_dialog.capture_method_combobox.currentIndex()),
213+
"capture_method": get_capture_method_by_index(0),
214214
"default_comparison_method": default_settings_dialog.default_comparison_method.currentIndex(),
215215
"default_similarity_threshold": default_settings_dialog.default_similarity_threshold_spinbox.value(),
216216
"default_delay_time": default_settings_dialog.default_delay_time_spinbox.value(),

src/user_profile.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,7 @@ def __load_settings_from_file(autosplit: AutoSplit, load_settings_file_path: str
143143
set_hotkey(autosplit, "pause", autosplit.settings_dict["pause_hotkey"])
144144

145145
if autosplit.settings_dict["captured_window_title"]:
146-
# https://github.com/kaluluosi/pywin32-stubs/issues/7
147-
hwnd = win32gui.FindWindow(None, autosplit.settings_dict["captured_window_title"]) # type: ignore
146+
hwnd = win32gui.FindWindow(None, autosplit.settings_dict["captured_window_title"])
148147
if hwnd:
149148
autosplit.hwnd = hwnd
150149
else:

typings/d3dshot/capture_outputs/__init__.pyi

Lines changed: 0 additions & 4 deletions
This file was deleted.

typings/d3dshot/display.pyi

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,6 @@ class Display:
3636
dxgi_adapter=...) -> None:
3737
...
3838

39-
def __repr__(self) -> str:
40-
...
41-
4239
def capture(self, process_func, region=...) -> None:
4340
...
4441

typings/d3dshot/dll/__init__.pyi

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)