Skip to content

Commit

Permalink
Fix imports at runtime (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
agners authored May 7, 2024
1 parent d1a3d40 commit dbe7642
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
6 changes: 2 additions & 4 deletions matter_server/common/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@

from collections.abc import Callable
from dataclasses import dataclass, field
from datetime import datetime # noqa: TCH003
from enum import Enum
from typing import TYPE_CHECKING, Any

if TYPE_CHECKING:
from datetime import datetime
from typing import Any

# Enums and constants

Expand Down
11 changes: 5 additions & 6 deletions matter_server/server/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import os
from typing import TYPE_CHECKING

import chip.CertificateAuthority
from chip.ChipStack import ChipStack
import chip.logging
from chip.logging import (
Expand All @@ -17,7 +18,7 @@
import chip.native

if TYPE_CHECKING:
from chip.CertificateAuthority import CertificateAuthorityManager
from chip.FabricAdmin import FabricAdmin

from .server import MatterServer

Expand Down Expand Up @@ -111,10 +112,8 @@ def __init__(

# Initialize Certificate Authority Manager
# yeah this is a bit weird just to prevent a circular import in the underlying SDK
self.certificate_authority_manager: CertificateAuthorityManager = (
chip.CertificateAuthority.CertificateAuthorityManager(
chipStack=self._chip_stack
)
self.certificate_authority_manager: chip.CertificateAuthority.CertificateAuthorityManager = chip.CertificateAuthority.CertificateAuthorityManager(
chipStack=self._chip_stack
)
self.certificate_authority_manager.LoadAuthoritiesFromStorage()

Expand All @@ -131,7 +130,7 @@ def __init__(
admin.vendorId == server.vendor_id
and admin.fabricId == server.fabric_id
):
self.fabric_admin = admin
self.fabric_admin: FabricAdmin = admin
break
else:
self.fabric_admin = cert_auth.NewFabricAdmin(
Expand Down

0 comments on commit dbe7642

Please sign in to comment.