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
14 changes: 7 additions & 7 deletions matter_server/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import asyncio
import logging
from typing import TYPE_CHECKING, Any, Final, Optional, cast
from typing import TYPE_CHECKING, Any, Final, cast
import uuid

from chip.clusters import Objects as Clusters
Expand Down Expand Up @@ -80,9 +80,9 @@ def server_info(self) -> ServerInfoMessage | None:
def subscribe_events(
self,
callback: Callable[[EventType, Any], None],
event_filter: Optional[EventType] = None,
node_filter: Optional[int] = None,
attr_path_filter: Optional[str] = None,
event_filter: EventType | None = None,
node_filter: int | None = None,
attr_path_filter: str | None = None,
) -> Callable[[], None]:
"""
Subscribe to node and server events.
Expand Down Expand Up @@ -191,7 +191,7 @@ async def open_commissioning_window(
timeout: int = 300, # noqa: ASYNC109 timeout parameter required for native timeout
iteration: int = 1000,
option: int = 1,
discriminator: Optional[int] = None,
discriminator: int | None = None,
) -> CommissioningParameters:
"""
Open a commissioning window to commission a device present on this controller to another.
Expand Down Expand Up @@ -771,8 +771,8 @@ def _signal_event(
self,
event: EventType,
data: Any = None,
node_id: Optional[int] = None,
attribute_path: Optional[str] = None,
node_id: int | None = None,
attribute_path: str | None = None,
) -> None:
"""Signal event to all subscribers."""
# instead of iterating all subscribers we iterate over subscription keys
Expand Down
2 changes: 1 addition & 1 deletion matter_server/common/helpers/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def dataclass_to_dict(obj_in: DataclassInstance) -> dict:

def parse_utc_timestamp(datetime_string: str) -> datetime:
"""Parse datetime from string."""
return datetime.fromisoformat(datetime_string.replace("Z", "+00:00"))
return datetime.fromisoformat(datetime_string)


def _get_descriptor_key(descriptor: ClusterObjectDescriptor, key: str | int) -> str:
Expand Down
2 changes: 1 addition & 1 deletion matter_server/server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _setup_logging() -> None:
)
threading.excepthook = lambda args: logger.exception(
"Uncaught thread exception",
exc_info=( # type: ignore[arg-type]
exc_info=( # type: ignore[arg-type] # noqa: LOG014
args.exc_type,
args.exc_value,
args.exc_traceback,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test = [
"pytest-asyncio==1.0.0",
"pytest-aiohttp==1.1.0",
"pytest-cov==6.2.1",
"ruff==0.11.13",
"ruff==0.12.0",
"tomli==2.2.1",
]

Expand Down
6 changes: 3 additions & 3 deletions tests/common/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from dataclasses import dataclass
import datetime
from enum import Enum, IntEnum
from typing import Optional, Union
from typing import Union

from chip.clusters.Types import Nullable, NullValue
import pytest
Expand Down Expand Up @@ -34,7 +34,7 @@ class BasicModelChild:
a: int
b: str
c: str
d: Optional[int]
d: int | None


@dataclass
Expand All @@ -44,7 +44,7 @@ class BasicModel:
a: int
b: float
c: str
d: Optional[int]
d: int | None
e: BasicModelChild
f: datetime.datetime
g: MatterEnum
Expand Down
5 changes: 0 additions & 5 deletions tests/server/test_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,6 @@ def chip_stack_fixture() -> Generator[MagicMock, None, None]:
@pytest.fixture(name="certificate_authority_manager")
def certificate_authority_manager_fixture() -> Generator[MagicMock, None, None]:
"""Return a mocked certificate authority manager."""

# Necessary for patching within tests
# pylint: disable=unused-import,import-outside-toplevel
import chip.CertificateAuthority # noqa: F401

with patch(
"matter_server.server.stack.chip.CertificateAuthority.CertificateAuthorityManager",
autospec=True,
Expand Down