Skip to content
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
15 changes: 7 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions circuitpython_nrf24l01/fake_ble.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -441,7 +441,7 @@ def data(self) -> float:
return struct.unpack("<i", self._data[:3] + b"\0")[0] * 10**-2

@data.setter
def data(self, value: Union[float, bytes, bytearray]):
def data(self, value: Union[float, bytes, bytearray]) -> None:
if isinstance(value, float):
value = struct.pack("<i", int(value * 100) & 0xFFFFFF)
self._data = value[:3] + bytes([0xFE])
Expand All @@ -465,7 +465,7 @@ def data(self) -> 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)):
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion circuitpython_nrf24l01/rf24.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down