-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configured VSCode and Markdownlint settings Added and configured the following linters as strict as I could: pylint, flake8, mypy, bandit, pyright Partially filled in some type stubs: cv2, imagehash, keyboard, pyautogui, pythonwin, win32helper [Breaking change] Using interpolation=cv2.INTER_NEAREST everywhere as it is the fastest interlpolation method Hide generated/compiled files SelectRegionWidget width and height as functions Added validate_images_before_parsing() to validate images both before maxFPS and starting autosplitter
- Loading branch information
Showing
48 changed files
with
120,602 additions
and
4,007 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
[flake8] | ||
color=always | ||
max-line-length=120 | ||
; TODO: Bring WAY down | ||
max-complexity=55 | ||
; Auto generated | ||
exclude=src/gen/ | ||
; TODO: We want to configure this | ||
ignore=W503,N801,N802,N803,N806,N815,N816 | ||
per-file-ignores = | ||
; imported but unused | ||
; line too long | ||
; mixed case | ||
__init__.pyi:F401,E501,N816 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"default": true, | ||
"MD025": false, | ||
"MD013": false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
; https://mypy.readthedocs.io/en/stable/command_line.html#disallow-dynamic-typing | ||
[mypy] | ||
show_column_numbers=True | ||
show_error_codes=True | ||
no_color_output=False | ||
color_output=True | ||
|
||
ignore_missing_imports=True | ||
follow_imports=silent | ||
|
||
; Note: exclude is ignored when linting file by file so VSCode will still show errors in typings | ||
; typings are incomplete as we only add types for what we need, cannot disable specific rules per file | ||
; Auto generated | ||
exclude=(typings/|src/gen/) | ||
|
||
; Redundant | ||
disallow_untyped_defs=False | ||
; Doesn't see our cv2 type stubs | ||
warn_return_any=False | ||
; False positives when it's needed for other linting libraries | ||
warn_unused_ignores=False | ||
; Doesn't see imports from src/gen/ | ||
disallow_any_unimported=False | ||
disallow_subclassing_any=False | ||
; False positives with ndarray | ||
disable_error_code=no-untyped-def | ||
|
||
strict=True | ||
; Doesn't see types from some imports | ||
disallow_any_expr=False | ||
disallow_any_decorated=True | ||
disallow_any_explicit=True | ||
warn_unreachable=True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
; http://pylint-messages.wikidot.com/all-codes | ||
[MASTER] | ||
max-line-length=120 | ||
ignore-paths= | ||
; Haven't looked into disabling specific rules per file | ||
^typings/.*$, | ||
; Auto generated | ||
^src/gen/.*$ | ||
disable= | ||
missing-docstring, | ||
; TODO: We want to configure this | ||
; https://pylint.pycqa.org/en/latest/user_guide/options.html#naming-styles | ||
invalid-name, | ||
; We group imports | ||
wrong-import-position, | ||
; Already taken care of and grayed out. Also conflicts with Pylance reportIncompatibleMethodOverride | ||
unused-argument, | ||
; Already taken care of by Flake8 | ||
unused-import, | ||
extension-pkg-allow-list=PyQt6,win32ui | ||
|
||
[TYPECHECK] | ||
generated-members=cv2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"typeCheckingMode": "strict", | ||
// Auto generated | ||
"ignore": [ | ||
// "src/gen/", | ||
"typings/", | ||
], | ||
"reportMissingTypeStubs": "information", | ||
// False positives with TYPE_CHECKING | ||
"reportImportCycles": "information", | ||
// PyQt .connect | ||
"reportFunctionMemberAccess": "information", | ||
// Extra runtime safety | ||
"reportUnnecessaryComparison": "warning", | ||
// Flake8 does a better job | ||
"reportUnusedImport": "none", | ||
// numpy has way too many complex types that triggers this | ||
"reportUnknownMemberType": "none", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
CALL "%~p0compile_resources.bat" | ||
pyinstaller -w -F --icon=res\icon.ico "%~p0..\src\AutoSplit.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
cd "%~dp0.." | ||
pyuic6 ".\res\about.ui" -o ".\src\about.py" | ||
pyuic6 ".\res\design.ui" -o ".\src\design.py" | ||
pyuic6 ".\res\update_checker.ui" -o ".\src\update_checker.py" | ||
pyside6-rcc ".\res\resources.qrc" -o ".\src\resources_rc.py" | ||
pyuic6 ".\res\about.ui" -o ".\src\gen\about.py" | ||
pyuic6 ".\res\design.ui" -o ".\src\gen\design.py" | ||
pyuic6 ".\res\update_checker.ui" -o ".\src\gen\update_checker.py" | ||
pyside6-rcc ".\res\resources.qrc" -o ".\src\gen\resources_rc.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
py -3.9 -m pip install wheel | ||
py -3.9 -m pip install -r "%~p0requirements.txt" | ||
@REM https://github.com/python/mypy/issues/10600 --non-interactive may still have issues | ||
mypy --install-types --non-interactive | ||
npm install -g pyright | ||
CALL "%~p0compile_resources.bat" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
pylint --score=n --output-format=text,colorized $(git ls-files '**/*.py*') | ||
# pylint --reports=y --output-format=text,colorized $(git ls-files '**/*.py*') | ||
mypy . | ||
# mypy --pretty src | ||
pyright | ||
bandit -f custom --silent --severity-level medium -r . | ||
# bandit -n 1 --severity-level medium -r src | ||
flake8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
CALL "%~p0compile_resources.bat" | ||
py -3.9 "%~p0..\src\AutoSplit.py" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
from __future__ import annotations | ||
from typing import TYPE_CHECKING | ||
if TYPE_CHECKING: | ||
from AutoSplit import AutoSplit | ||
from PyQt6 import QtCore | ||
|
||
import error_messages | ||
|
||
|
||
class AutoControlledWorker(QtCore.QObject): | ||
def __init__(self, autosplit: AutoSplit): | ||
self.autosplit = autosplit | ||
super().__init__() | ||
|
||
def run(self): | ||
while True: | ||
try: | ||
line = input() | ||
except RuntimeError: | ||
self.autosplit.showErrorSignal.emit(error_messages.stdinLostError) | ||
break | ||
# TODO: "AutoSplit Integration" needs to call this and wait instead of outright killing the app. | ||
# TODO: See if we can also get LiveSplit to wait on Exit in "AutoSplit Integration" | ||
# For now this can only used in a Development environment | ||
if line == 'kill': | ||
self.autosplit.closeEvent() | ||
break | ||
elif line == 'start': | ||
self.autosplit.startAutoSplitter() | ||
elif line == 'split' or line == 'skip': | ||
self.autosplit.startSkipSplit() | ||
elif line == 'undo': | ||
self.autosplit.startUndoSplit() | ||
elif line == 'reset': | ||
self.autosplit.startReset() | ||
elif line.startswith('settings'): | ||
# Allow for any split character between "settings" and the path | ||
self.autosplit.load_settings_file_path = line[9:] | ||
self.autosplit.loadSettings(load_settings_from_livesplit=True) | ||
# TODO: Not yet implemented in AutoSplit Integration | ||
# elif line == 'pause': | ||
# self.startPause() |
Oops, something went wrong.