From 77dc91bc3d43f53a2a6c2365d2c5fb0ac0439a2f Mon Sep 17 00:00:00 2001 From: Brendan <2bndy5@gmail.com> Date: Mon, 24 Nov 2025 02:24:53 -0800 Subject: [PATCH] chore(dev): upgrade pre-commit hooks and ran the hooks with necessary typing adjustments --- .pre-commit-config.yaml | 15 +++++++-------- circuitpython_nrf24l01/fake_ble.py | 10 +++++----- circuitpython_nrf24l01/rf24.py | 2 +- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 5130f53..73df2d6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,22 +4,21 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v5.0.0 + rev: v6.0.0 hooks: - id: check-yaml exclude: ^docs/social_cards/layouts - id: end-of-file-fixer - id: trailing-whitespace - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.8 + rev: v0.14.6 hooks: - # Run the linter. - - id: ruff - args: [ --fix ] - # Run the formatter. - - id: ruff-format + # Run the linter. + - id: ruff-check + # Run the formatter. + - id: ruff-format - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.15.0 + rev: v1.18.2 hooks: - id: mypy name: mypy (library code) diff --git a/circuitpython_nrf24l01/fake_ble.py b/circuitpython_nrf24l01/fake_ble.py index bfb4831..d882374 100644 --- a/circuitpython_nrf24l01/fake_ble.py +++ b/circuitpython_nrf24l01/fake_ble.py @@ -400,12 +400,12 @@ def uuid(self) -> bytes: return self._type @property - def data(self) -> Union[int, float, str, bytes, bytearray]: + def data(self) -> Union[bytes, bytearray]: """This attribute is a `bytearray` or `bytes` object.""" return self._data @data.setter - def data(self, value: Union[int, float, str, bytes, bytearray]): + def data(self, value: Union[bytes, bytearray]) -> None: self._data = value # type: ignore[assignment] @property @@ -441,7 +441,7 @@ def data(self) -> float: return struct.unpack(" None: if isinstance(value, float): value = struct.pack(" int: return int(self._data[0]) @data.setter - def data(self, value: Union[int, bytes, bytearray]): + def data(self, value: Union[int, bytes, bytearray]) -> None: if isinstance(value, int): self._data = struct.pack("B", value) elif isinstance(value, (bytes, bytearray)): @@ -518,7 +518,7 @@ def data(self) -> str: return value @data.setter - def data(self, value: Union[str, bytes, bytearray]): + def data(self, value: Union[str, bytes, bytearray]) -> None: if isinstance(value, str): for i, b_code in enumerate(UrlServiceData.codex_prefix): if value.startswith(b_code): diff --git a/circuitpython_nrf24l01/rf24.py b/circuitpython_nrf24l01/rf24.py index e74b2ef..6bcad96 100644 --- a/circuitpython_nrf24l01/rf24.py +++ b/circuitpython_nrf24l01/rf24.py @@ -790,7 +790,7 @@ def pa_level(self) -> int: return (3 - ((self._rf_setup & 6) >> 1)) * -6 @pa_level.setter - def pa_level(self, power: Union[bool, Tuple[bool, int]]): + def pa_level(self, power: Union[int, Tuple[bool, int]]): lna_bit = True if isinstance(power, (list, tuple)) and len(power) > 1: lna_bit, power = bool(power[1]), int(power[0]) # type: ignore[assignment]