Skip to content

Commit fa6037b

Browse files
committed
Massively sped up Flake tests
Removed 400+kb of type stubs
1 parent bbb257f commit fa6037b

File tree

19 files changed

+33
-120237
lines changed

19 files changed

+33
-120237
lines changed

.flake8

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@ 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=
12+
; Docstrings in type stubs
13+
; Function bodys contain other than just ... (eg: raise)
14+
15+
; Single quote docstrings
16+
typings/cv2-stubs/__init__.pyi: Q000,E704,E501,N8, Y021,Y010, Q002
17+
1118
; Quotes
1219
__init__.pyi:Q000
1320
; PyQt methods

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ dist/
1919

2020
# Dev settings
2121
*.pkl
22+
settings.toml

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@
5858
"python.linting.pylintCategorySeverity.refactor": "Warning",
5959
"python.linting.flake8Enabled": true,
6060
"python.linting.flake8CategorySeverity.E": "Warning",
61+
// Pyflakes
62+
"python.linting.flake8CategorySeverity.F": "Warning",
63+
// PEP8 Naming convention
64+
"python.linting.flake8CategorySeverity.N": "Warning",
65+
// PYI
66+
"python.linting.flake8CategorySeverity.Y": "Warning",
6167
// PyRight obsoletes mypy
6268
"python.linting.mypyEnabled": false,
6369
// Is already wrapped by Flake8, prospector and pylama

pyproject.toml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,22 @@ aggressive = 3
1515
[tool.pyright]
1616
pythonPlatform = "Windows"
1717
typeCheckingMode = "strict"
18+
# Extra strict
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"
1826
ignore = [
1927
# Auto generated
2028
"src/gen/",
2129
# We expect stub files to be incomplete or contain useless statements as they're external
2230
"typings/",
2331
]
24-
reportMissingTypeStubs = "information"
32+
# Type stubs may not be completable
33+
reportMissingTypeStubs = "warning"
2534
# False positives with TYPE_CHECKING
2635
reportImportCycles = "information"
2736
# PyQt .connect

scripts/requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ requests
2626
bandit
2727
flake8
2828
flake8-quotes
29-
pylint
30-
pywin32-stubs
29+
pylint>=2.13
30+
git+https://github.com/Avasam/pywin32-stubs.git#egg=pywin32-stubs # https://github.com/kaluluosi/pywin32-stubs/pull/4
3131
simplejson
3232
types-simplejson>=3.17.2
3333
types-requests

src/AutoSplit.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,8 +796,7 @@ def __get_capture_for_comparison(self):
796796
if capture is None:
797797
# Try to recover by using the window name
798798
self.live_image.setText("Trying to recover window...")
799-
# https://github.com/kaluluosi/pywin32-stubs/issues/7
800-
hwnd = win32gui.FindWindow(None, self.window_text) # type: ignore
799+
hwnd = win32gui.FindWindow(None, self.window_text)
801800
# Don't fallback to desktop
802801
if hwnd:
803802
self.hwnd = hwnd

src/capture_windows.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def capture_region(hwnd: int, selection: Rect, print_window: bool):
4545
# If the window closes while it's being manipulated, it could cause a crash
4646
try:
4747
window_dc: int = win32gui.GetWindowDC(hwnd)
48-
# https://github.com/kaluluosi/pywin32-stubs/issues/6
49-
dc_object: PyCDC = win32ui.CreateDCFromHandle(window_dc) # type: ignore
48+
dc_object: PyCDC = win32ui.CreateDCFromHandle(window_dc)
5049

5150
# Causes a 10-15x performance drop. But allows recording hardware accelerated windows
5251
if print_window:

src/settings_file.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,7 @@ def __load_settings_from_file(autosplit: AutoSplit, load_settings_file_path: str
146146
autosplit.force_print_window_checkbox.setChecked(settings[20])
147147

148148
if autosplit.window_text:
149-
# https://github.com/kaluluosi/pywin32-stubs/issues/7
150-
hwnd = win32gui.FindWindow(None, autosplit.window_text) # type: ignore
149+
hwnd = win32gui.FindWindow(None, autosplit.window_text)
151150
if hwnd:
152151
autosplit.hwnd = hwnd
153152
else:

typings/pythonwin-stubs/win32typing.pyi

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

0 commit comments

Comments
 (0)