Skip to content

Commit

Permalink
[pre-commit.ci] pre-commit autoupdate (#256)
Browse files Browse the repository at this point in the history
* [pre-commit.ci] pre-commit autoupdate

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.0.282 → v0.0.288](astral-sh/ruff-pre-commit@v0.0.282...v0.0.288)
- https://github.com/pre-commit/mirrors-autopep8https://github.com/hhatto/autopep8
- [github.com/hhatto/autopep8: v2.0.2 → v2.0.4](hhatto/autopep8@v2.0.2...v2.0.4)
- [github.com/asottile/add-trailing-comma: v3.0.1 → v3.1.0](asottile/add-trailing-comma@v3.0.1...v3.1.0)

* Update and fix checkers

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Avasam <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and Avasam authored Sep 12, 2023
1 parent e58e5a7 commit f08a3a2
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ repos:
- id: pretty-format-ini
args: [--autofix]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.282" # Must match requirements-dev.txt
rev: "v0.0.289" # Must match requirements-dev.txt
hooks:
- id: ruff
args: [--fix]
- repo: https://github.com/pre-commit/mirrors-autopep8
rev: "v2.0.2" # Must match requirements-dev.txt
- repo: https://github.com/hhatto/autopep8
rev: "v2.0.4" # Must match requirements-dev.txt
hooks:
- id: autopep8
- repo: https://github.com/asottile/add-trailing-comma
rev: v3.0.1 # Must match requirements-dev.txt
rev: v3.1.0 # Must match requirements-dev.txt
hooks:
- id: add-trailing-comma

Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@
[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=Avasam_AutoSplit)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=security_rating)](https://sonarcloud.io/dashboard?id=Avasam_AutoSplit)
[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=code_smells)](https://sonarcloud.io/summary/new_code?id=Avasam_AutoSplit)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Avasam_AutoSplit)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=Avasam_AutoSplit&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=Avasam_AutoSplit)
[![SemVer](https://badgen.net/badge/_/SemVer%20compliant/grey?label)](https://semver.org/)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
[![autopep8](https://badgen.net/badge/code%20style/autopep8/blue)](https://github.com/hhatto/autopep8)
[![Checked with pyright](https://microsoft.github.io/pyright/img/pyright_badge.svg)](https://microsoft.github.io/pyright/)
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)

Easy to use image comparison based auto splitter for speedrunning on console or PC.

Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ ignore = [
"ICN001", # unconventional-import-alias
"N8", # Naming conventions
"PLR0913", # Argument count
"PLW3201", # misspelled dunder method name
"PYI042", # CamelCase TypeAlias
]

Expand Down
6 changes: 3 additions & 3 deletions scripts/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
-r requirements.txt
#
# Linters & Formatters
add-trailing-comma>=3.0.0 # Added support for with statement # Must match .pre-commit-config.yaml
autopep8>=2.0.2 # New checks # Must match .pre-commit-config.yaml
ruff>=0.0.276 # Fix ignored "ignore" configuration + cache fixes # Must match .pre-commit-config.yaml
add-trailing-comma>=3.1.0 # Must match .pre-commit-config.yaml
autopep8>=2.0.4 # Must match .pre-commit-config.yaml
ruff>=0.0.289 # Ignore @override for bad-dunder-name # Must match .pre-commit-config.yaml
#
# Run `./scripts/designer.ps1` to quickly open the bundled Qt Designer.
# Can also be downloaded externally as a non-python package
Expand Down
6 changes: 3 additions & 3 deletions src/capture_method/CaptureMethodBase.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def close(self, autosplit: AutoSplit):
# Some capture methods don't need an initialization process
pass

def get_frame(self, autosplit: AutoSplit) -> tuple[MatLike | None, bool]:
def get_frame(self, autosplit: AutoSplit) -> tuple[MatLike | None, bool]: # noqa: PLR6301
"""
Captures an image of the region for a window matching the given
parameters of the bounding box.
Expand All @@ -37,8 +37,8 @@ def get_frame(self, autosplit: AutoSplit) -> tuple[MatLike | None, bool]:
"""
return None, False

def recover_window(self, captured_window_title: str, autosplit: AutoSplit) -> bool:
def recover_window(self, captured_window_title: str, autosplit: AutoSplit) -> bool: # noqa: PLR6301
return False

def check_selected_region_exists(self, autosplit: AutoSplit) -> bool:
def check_selected_region_exists(self, autosplit: AutoSplit) -> bool: # noqa: PLR6301
return is_valid_hwnd(autosplit.hwnd)
12 changes: 6 additions & 6 deletions src/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from enum import IntEnum
from platform import version
from threading import Thread
from typing import TYPE_CHECKING, Any, TypeVar, cast
from typing import TYPE_CHECKING, Any, TypeVar

import win32ui
from cv2.typing import MatLike
Expand Down Expand Up @@ -48,7 +48,7 @@ class ColorChannel(IntEnum):
Alpha = 3


def decimal(value: int | float):
def decimal(value: float):
# Using ljust instead of :2f because of python float rounding errors
return f"{int(value * 100) / 100}".ljust(4, "0")

Expand Down Expand Up @@ -101,10 +101,10 @@ def get_window_bounds(hwnd: int) -> tuple[int, int, int, int]:
)

window_rect = win32gui.GetWindowRect(hwnd)
window_left_bounds = cast(int, extended_frame_bounds.left) - window_rect[0]
window_top_bounds = cast(int, extended_frame_bounds.top) - window_rect[1]
window_width = cast(int, extended_frame_bounds.right) - cast(int, extended_frame_bounds.left)
window_height = cast(int, extended_frame_bounds.bottom) - cast(int, extended_frame_bounds.top)
window_left_bounds = extended_frame_bounds.left - window_rect[0]
window_top_bounds = extended_frame_bounds.top - window_rect[1]
window_width = extended_frame_bounds.right - extended_frame_bounds.left
window_height = extended_frame_bounds.bottom - extended_frame_bounds.top
return window_left_bounds, window_top_bounds, window_width, window_height


Expand Down

0 comments on commit f08a3a2

Please sign in to comment.