From ea4d4c6d4bb9b9cd046670e65b2ff26da3ad2b42 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 11 Dec 2024 22:25:54 +0100 Subject: [PATCH] chore: switch to ruff (#54) --- .pre-commit-config.yaml | 25 ++++++++++++++++--------- docs/source/conf.py | 4 ++-- src/led_ble/const.py | 2 +- src/led_ble/model_db.py | 1 - src/led_ble/models.py | 1 - 5 files changed, 19 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0a7a309..e7ca61f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -37,15 +37,7 @@ repos: rev: v3.19.0 hooks: - id: pyupgrade - args: [--py37-plus] - - repo: https://github.com/PyCQA/isort - rev: 5.13.2 - hooks: - - id: isort - - repo: https://github.com/psf/black - rev: 24.10.0 - hooks: - - id: black + args: [--py39-plus] - repo: https://github.com/codespell-project/codespell rev: v2.3.0 hooks: @@ -64,3 +56,18 @@ repos: hooks: - id: bandit args: [-x, tests] + - repo: https://github.com/python-poetry/poetry + rev: 1.8.0 + hooks: + - id: poetry-check + - repo: https://github.com/pre-commit/mirrors-prettier + rev: v4.0.0-alpha.8 + hooks: + - id: prettier + args: ["--tab-width", "2"] + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.8.2 + hooks: + - id: ruff + args: [--fix, --exit-non-zero-on-fix] + - id: ruff-format diff --git a/docs/source/conf.py b/docs/source/conf.py index 6ec63c0..47a2b45 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -13,7 +13,7 @@ # import os # import sys # sys.path.insert(0, os.path.abspath('.')) -from typing import Any, List +from typing import Any # -- Project information ----------------------------------------------------- @@ -40,7 +40,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns: List[Any] = [] +exclude_patterns: list[Any] = [] # -- Options for HTML output ------------------------------------------------- diff --git a/src/led_ble/const.py b/src/led_ble/const.py index 0572ef4..cc904af 100644 --- a/src/led_ble/const.py +++ b/src/led_ble/const.py @@ -4,7 +4,7 @@ # "ffd4" - Triones:B30200000459C - legacy -STATE_COMMAND = b"\xEF\x01\x77" +STATE_COMMAND = b"\xef\x01\x77" class CharacteristicMissingError(Exception): diff --git a/src/led_ble/model_db.py b/src/led_ble/model_db.py index e1ecc00..70cb25b 100644 --- a/src/led_ble/model_db.py +++ b/src/led_ble/model_db.py @@ -11,7 +11,6 @@ @dataclass(frozen=True) class LEDBLEModel: - model_num: int # The model number aka byte 1 models: list[str] # The model names from discovery description: str # Description of the model ({type} {color_mode}) diff --git a/src/led_ble/models.py b/src/led_ble/models.py index b891d4f..e8b2059 100644 --- a/src/led_ble/models.py +++ b/src/led_ble/models.py @@ -5,7 +5,6 @@ @dataclass(frozen=True) class LEDBLEState: - power: bool = False rgb: tuple[int, int, int] = (0, 0, 0) w: int = 0