Skip to content

More consistent formatting #174

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 3 commits into from
Oct 17, 2022
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
7 changes: 4 additions & 3 deletions .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ per-file-ignores=
; Docstrings in type stubs
; Function bodys contain other than just ... (eg: raise)
; Single quote docstrings
typings/cv2-stubs/__init__.pyi: Q000,E704,E501,N8,A002,A003,CCE002,F401, Y021,Y010,Q002
typings/cv2-stubs/__init__.pyi: Q000,E704,E501,N8,A001,A002,A003,CCE002,F401, Y021,Y010,Q002
; Quotes
; Allow ... on same line as def
; Line too long
; Naming conventions can't be controlled for external libraries
; Variable names can't be controlled for external libraries
; Argument names can't be controlled for external libraries
; attribute names can't be controlled for external libraries
; Attribute names can't be controlled for external libraries
; False positive Class level expression with elipsis
; Type re-exports
*.pyi: Q000,E704,E501,N8,A002,A003,CCE002,F401
*.pyi: Q000,E704,E501,N8,A001,A002,A003,CCE002,F401
; PyQt methods
ignore-names=closeEvent,paintEvent,keyPressEvent,mousePressEvent,mouseMoveEvent,mouseReleaseEvent
; McCabe max-complexity is also taken care of by Pylint and doesn't fail the build there
Expand Down
15 changes: 15 additions & 0 deletions .github/workflows/lint-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,21 @@ env:
GITHUB_HEAD_REPOSITORY: ${{ github.event.pull_request.head.repo.full_name }}

jobs:
add-trailing-comma:
runs-on: windows-latest
steps:
- name: Checkout ${{ github.repository }}/${{ github.ref }}
uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: "pip"
cache-dependency-path: "scripts/requirements*.txt"
- run: scripts/install.ps1
shell: pwsh
- name: Analysing the code with add-trailing-comma
run: add-trailing-comma $(git ls-files '**.py*') --py36-plus
Pyright:
runs-on: windows-latest
strategy:
Expand Down
10 changes: 3 additions & 7 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,30 +5,26 @@
"davidanson.vscode-markdownlint",
"eamodio.gitlens",
"ms-python.flake8",
"ms-python.pylint",
"ms-python.python",
"ms-python.vscode-pylance",
"ms-vscode.powershell",
"pkief.material-icon-theme",
"redhat.vscode-xml",
"redhat.vscode-yaml",
"shardulm94.trailing-spaces",
"sonarsource.sonarlint-vscode",
],
"unwantedRecommendations": [
// Must disable in this workspace //
// https://github.com/microsoft/vscode/issues/40239 //
//
// VSCode has implemented an optimized version
"coenraads.bracket-pair-colorizer",
"coenraads.bracket-pair-colorizer-2",
// Lots of conflicts
"esbenp.prettier-vscode",
// Replaced by ESLint
"eg2.tslint",
"ms-vscode.vscode-typescript-tslint-plugin",
// Obsoleted by Pylance
"ms-pyright.pyright",
"ms-python.black-formatter",
// Not configurable per workspace, tends to conflict with other linters
// Use eslint-plugin-sonarjs for JS/TS projects
"sonarsource.sonarlint-vscode",
//
// Don't recommend to autoinstall //
Expand Down
14 changes: 11 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,19 @@
},
"python.analysis.diagnosticMode": "workspace",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.pylintCategorySeverity.convention": "Warning",
"python.linting.pylintCategorySeverity.refactor": "Warning",
// Use the new Pylint extension instead
"python.linting.pylintEnabled": false,
"pylint.severity": {
"convention": "Warning",
"error": "Error",
"fatal": "Error",
"refactor": "Warning",
"warning": "Warning",
"info": "Information"
},
// Use the new Flake8 extension instead
"python.linting.flake8Enabled": false,
// Partial codes don't work yet: https://github.com/microsoft/vscode-flake8/issues/7
"flake8.severity": {
"convention": "Warning",
"error": "Error",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ This program can be used to automatically start, split, and reset your preferred
- **Video Capture Device**
Uses a Video Capture Device, like a webcam, virtual cam, or capture card.
There are currently performance issues, but it might be more convenient.
If you want to use this with OBS' Virtual Camera, use the [Virtualcam plugin](https://obsproject.com/forum/resources/obs-virtualcam.949/) instead.
If you want to use this with OBS' Virtual Camera, use the [Virtualcam plugin](https://github.com/Avasam/obs-virtual-cam/releases) instead.

#### Capture Device

Expand Down
16 changes: 7 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
# https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file
[tool.black]
line-length = 120
# Auto generated
force-exclude = "src/gen/.*\\.py$"

# https://github.com/hhatto/autopep8#usage
# https://github.com/hhatto/autopep8#more-advanced-usage
[tool.autopep8]
max_line_length = 120
recursive = true
aggressive = 3
ignore = ["E70"] # Allow ... on same line as def


# https://github.com/microsoft/pyright/blob/main/docs/configuration.md#sample-pyprojecttoml-file
[tool.pyright]
Expand Down Expand Up @@ -65,10 +61,9 @@ load-plugins = [
"pylint.extensions.for_any_all",
"pylint.extensions.eq_without_hash",
"pylint.extensions.mccabe",
"pylint.extensions.no_self_use",
"pylint.extensions.overlapping_exceptions",
"pylint.extensions.private_import",
"pylint.extensions.redefined_loop_name",
# "pylint.extensions.redefined_loop_name", # 2.16
"pylint.extensions.redefined_variable_type",
"pylint.extensions.set_membership",
"pylint.extensions.typing",
Expand All @@ -79,6 +74,7 @@ load-plugins = [
# "pylint.extensions.code_style",
# "pylint.extensions.comparetozero",
# "pylint.extensions.docstyle",
# "pylint.extensions.no_self_use",
# "pylint.extensions.while_used",
]
ignore-paths = [
Expand All @@ -87,7 +83,7 @@ ignore-paths = [
# We expect stub files to be incomplete or contain useless statements
"^.*.pyi$",
]
extension-pkg-allow-list = ["PyQt6", "PySide6", "win32ui"]
extension-pkg-allow-list = ["PyQt6", "PySide6", "win32ui", "win32.win32gui"]

[tool.pylint.FORMAT]
max-line-length = 120
Expand Down Expand Up @@ -146,3 +142,5 @@ generated-members = [
[tool.isort]
line_length = 120
combine_as_imports = true
include_trailing_comma = true
multi_line_output = 5
2 changes: 2 additions & 0 deletions scripts/lint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ $exitCodes = 0
Write-Host "`nRunning autofixes..."
isort src/ typings/
autopep8 $(git ls-files '**.py*') --in-place
unify src/ --recursive --in-place --quote='"""'
add-trailing-comma $(git ls-files '**.py*') --py36-plus

Write-Host "`nRunning Pyright..."
$Env:PYRIGHT_PYTHON_FORCE_VERSION = 'latest'
Expand Down
17 changes: 10 additions & 7 deletions scripts/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,29 @@
-r requirements.txt
#
# Linters and formatters
add-trailing-comma
bandit
flake8>=5 # flake8-pyi deprecation warnings
flake8>=5 # flake8-pyi deprecation warnings
flake8-builtins
flake8-bugbear
flake8-class-attributes-order
flake8-comprehensions>=3.8 # flake8 5 support
flake8-datetimez
flake8-isort>=4.2 # flake8 5 support
flake8-pyi>=22.8.1 # flake8 5 support
flake8-isort>=4.2 # flake8 5 support
flake8-pyi>=22.10.0 # Fixes for negative numbers
flake8-quotes
flake8-simplify
pep8-naming
pylint>=2.13.9,<3.0.0 # Respect ignore configuration options with --recursive=y # 3.0 still in pre-release
pyright
pylint>=2.14,<3.0.0 # New checks # 3.0 still in pre-release
pyright>=1.1.270 # Typeshed update
unify
#
# Run `./scripts/designer.ps1` to quickly open the bundled PyQt Designer.
# Can also be downloaded externally as a non-python package
qt6-applications
# Types
pywin32-stubs>=1.0.7 # Added error types
types-d3dshot
types-keyboard
types-pyautogui
types-pyinstaller
types-pywin32
typing-extensions
18 changes: 9 additions & 9 deletions scripts/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,23 @@
# Creating an AutoSplit executable with PyInstaller: ./scripts/build.ps1
#
# Dependencies:
numpy>=1.23 # Updated types
opencv-python-headless>=4.5.4,<4.6 # https://github.com/pyinstaller/pyinstaller/issues/6889
PyQt6>=6.2.1 # Python 3.10 support
git+https://github.com/JohannesBuchner/imagehash.git#egg=ImageHash # Contains type information + setup as package not module
certifi
ImageHash>=4.3.1 # Contains type information + setup as package not module
keyboard
numpy>=1.23 # Updated types
opencv-python-headless>=4.5.4,<4.6 # https://github.com/pyinstaller/pyinstaller/issues/6889
packaging
Pillow>=7.2.0 # https://github.com/SerpentAI/D3DShot/issues/44
Pillow>=7.2.0 # https://github.com/SerpentAI/D3DShot/issues/44
psutil
PyAutoGUI
git+https://github.com/Avasam/python_grabber.git@complete-types#egg=pygrabber # https://github.com/andreaschiavinato/python_grabber/pull/18
PyQt6>=6.2.1 # Python 3.10 support
requests
certifi
toml
psutil
git+https://github.com/Avasam/python_grabber.git@complete-types#egg=pygrabber # https://github.com/andreaschiavinato/python_grabber/pull/18
# Windows-only
git+https://github.com/ranchen421/D3DShot.git#egg=D3DShot # D3DShot from PyPI with Pillow>=7.2.0 will install 0.1.3 instead of 0.1.5
pywin32>=301
winsdk>=v1.0.0b4
D3DShot
#
# Build and compile resources
PyInstaller
Expand Down
Loading