Skip to content

Commit

Permalink
fix imports for typing
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulcahey committed Oct 21, 2024
1 parent c08566b commit a949ac6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions zha/websocket/server/api/platforms/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from zha.websocket.server.api.platforms import PlatformEntityCommand

if TYPE_CHECKING:
from zha.websocket.client import Client
from zha.websocket.server.client import Client
from zha.websocket.server.gateway import WebSocketGateway as Server

_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -48,10 +48,10 @@ async def execute_platform_entity_command(
try:
action = getattr(platform_entity, method_name)
arg_spec = inspect.getfullargspec(action)
if arg_spec.varkw: # the only argument is self
if arg_spec.varkw:
await action(**command.model_dump(exclude_none=True))
else:
await action()
await action() # the only argument is self

except Exception as err:
_LOGGER.exception("Error executing command: %s", method_name, exc_info=err)
Expand Down Expand Up @@ -84,6 +84,7 @@ async def refresh_state(
await execute_platform_entity_command(server, client, command, "async_update")


# pylint: disable=import-outside-toplevel
def load_platform_entity_apis(server: Server) -> None:
"""Load the ws apis for all platform entities types."""
from zha.websocket.server.api.platforms.alarm_control_panel.api import (
Expand Down
3 changes: 2 additions & 1 deletion zha/websocket/server/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from zha.websocket.server.gateway_api import load_api as load_zigbee_controller_api

if TYPE_CHECKING:
from zha.websocket.client import Client
from zha.websocket.server.client import Client

BLOCK_LOG_TIMEOUT: Final[int] = 60
_LOGGER = logging.getLogger(__name__)
Expand Down Expand Up @@ -159,6 +159,7 @@ async def __aexit__(

def _register_api_commands(self) -> None:
"""Load server API commands."""
# pylint: disable=import-outside-toplevel
from zha.websocket.server.client import load_api as load_client_api

register_api_command(self, stop_server)
Expand Down

0 comments on commit a949ac6

Please sign in to comment.