Skip to content

Commit dbe7642

Browse files
authored
Fix imports at runtime (#694)
1 parent d1a3d40 commit dbe7642

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

matter_server/common/models.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44

55
from collections.abc import Callable
66
from dataclasses import dataclass, field
7+
from datetime import datetime # noqa: TCH003
78
from enum import Enum
8-
from typing import TYPE_CHECKING, Any
9-
10-
if TYPE_CHECKING:
11-
from datetime import datetime
9+
from typing import Any
1210

1311
# Enums and constants
1412

matter_server/server/stack.py

+5-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import os
55
from typing import TYPE_CHECKING
66

7+
import chip.CertificateAuthority
78
from chip.ChipStack import ChipStack
89
import chip.logging
910
from chip.logging import (
@@ -17,7 +18,7 @@
1718
import chip.native
1819

1920
if TYPE_CHECKING:
20-
from chip.CertificateAuthority import CertificateAuthorityManager
21+
from chip.FabricAdmin import FabricAdmin
2122

2223
from .server import MatterServer
2324

@@ -111,10 +112,8 @@ def __init__(
111112

112113
# Initialize Certificate Authority Manager
113114
# yeah this is a bit weird just to prevent a circular import in the underlying SDK
114-
self.certificate_authority_manager: CertificateAuthorityManager = (
115-
chip.CertificateAuthority.CertificateAuthorityManager(
116-
chipStack=self._chip_stack
117-
)
115+
self.certificate_authority_manager: chip.CertificateAuthority.CertificateAuthorityManager = chip.CertificateAuthority.CertificateAuthorityManager(
116+
chipStack=self._chip_stack
118117
)
119118
self.certificate_authority_manager.LoadAuthoritiesFromStorage()
120119

@@ -131,7 +130,7 @@ def __init__(
131130
admin.vendorId == server.vendor_id
132131
and admin.fabricId == server.fabric_id
133132
):
134-
self.fabric_admin = admin
133+
self.fabric_admin: FabricAdmin = admin
135134
break
136135
else:
137136
self.fabric_admin = cert_auth.NewFabricAdmin(

0 commit comments

Comments
 (0)