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
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.2
rev: v0.16.9
hooks:
- id: ruff
- id: ruff-check
args: ["--fix", "--exit-non-zero-on-fix", "--config", "pyproject.toml"]
- id: ruff-format
args: ["--config", "pyproject.toml"]

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
rev: v2.4.3
hooks:
- id: codespell
additional_dependencies: [tomli]
Expand All @@ -18,7 +18,7 @@ repos:
hooks:
- id: mypy
name: mypy
entry: uv run --frozen mypy
entry: uv run --frozen --group testing mypy
language: system
types_or: [python, pyi]
require_serial: true
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ asyncio_default_fixture_loop_scope = "function"

[tool.ruff]
required-version = ">=0.5.0"
target-version = "py39"
target-version = "py312"
line-length = 88

exclude = [
Expand Down
9 changes: 4 additions & 5 deletions zigpy_ziggurat/zigbee/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import asyncio
from collections.abc import AsyncGenerator
from datetime import datetime, timedelta, timezone
from datetime import UTC, datetime, timedelta
import logging
import math
import os
Expand Down Expand Up @@ -156,7 +156,7 @@ async def start_network(self) -> None:
url
)

self._start_time = datetime.now(timezone.utc)
self._start_time = datetime.now(UTC)

def _register_coordinator_device(self) -> None:
coordinator = ZigguratCoordinator(
Expand Down Expand Up @@ -435,7 +435,7 @@ async def _packet_capture(
):
packet = cast(p.CapturedPacket, packet)
yield t.CapturedPacket(
timestamp=datetime.now(timezone.utc),
timestamp=datetime.now(UTC),
rssi=packet.rssi,
lqi=packet.lqi,
channel=packet.channel,
Expand Down Expand Up @@ -868,8 +868,7 @@ async def send_packet(self, packet: t.ZigbeePacket) -> None:
# stack to reduce routing congestion
if device is not None and (
self._start_time is None
or datetime.now(timezone.utc) - self._start_time
< ROUTE_HINT_DURATION
or datetime.now(UTC) - self._start_time < ROUTE_HINT_DURATION
):
maybe_relays = self.build_source_route_to(device)

Expand Down
12 changes: 8 additions & 4 deletions zigpy_ziggurat/zigbee/wire.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,16 @@ class SendUnicastPayload(t.Struct):
priority: t.int8s
route: RouteControl
next_hop: t.NWK = t.StructField( # type: ignore[assignment]
requires=lambda s: cast(SendUnicastPayload, s).route
in (RouteControl.HINT_NEXT_HOP, RouteControl.FORCE_NEXT_HOP)
requires=lambda s: (
cast(SendUnicastPayload, s).route
in (RouteControl.HINT_NEXT_HOP, RouteControl.FORCE_NEXT_HOP)
)
)
relays: SourceRouteRelays = t.StructField( # type: ignore[assignment]
requires=lambda s: cast(SendUnicastPayload, s).route
in (RouteControl.HINT_SOURCE_ROUTE, RouteControl.FORCE_SOURCE_ROUTE)
requires=lambda s: (
cast(SendUnicastPayload, s).route
in (RouteControl.HINT_SOURCE_ROUTE, RouteControl.FORCE_SOURCE_ROUTE)
)
)
asdu: t.LongOctetString

Expand Down
Loading