Skip to content

Commit

Permalink
Fix mypy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
natekspencer committed Apr 26, 2024
1 parent c1d9150 commit 1a1190c
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions vivintpy/vivintskyapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import grpc
from aiohttp import ClientResponseError
from aiohttp.client import _RequestContextManager
from google.protobuf.message import Message
from google.protobuf.message import Message # type: ignore

from .const import (
AuthenticationResponse,
Expand Down Expand Up @@ -141,15 +141,17 @@ async def reboot_camera(
) -> None:
"""Reboot a camera."""

async def _cb(stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]):
async def _callback(
stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]
) -> Message:
return await stub.RebootCamera(
beam_pb2.RebootCameraRequest( # pylint: disable=no-member
panel_id=panel_id, device_id=device_id, device_type=device_type
),
metadata=metadata,
)

await self._send_grpc(_cb)
await self._send_grpc(_callback)

async def reboot_panel(self, panel_id: int) -> None:
"""Reboot a panel."""
Expand Down Expand Up @@ -201,7 +203,9 @@ async def set_camera_as_doorbell_chime_extender(
) -> None:
"""Set the camera to be used as a doorbell chime extender."""

async def _cb(stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]):
async def _callback(
stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]
) -> Message:
return await stub.SetUseAsDoorbellChimeExtender(
beam_pb2.SetUseAsDoorbellChimeExtenderRequest( # pylint: disable=no-member
panel_id=panel_id,
Expand All @@ -211,37 +215,41 @@ async def _cb(stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]):
metadata=metadata,
)

await self._send_grpc(_cb)
await self._send_grpc(_callback)

async def set_camera_privacy_mode(
self, panel_id: int, device_id: int, state: bool
) -> None:
"""Set the camera privacy mode."""

async def _cb(stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]):
async def _callback(
stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]
) -> Message:
return await stub.SetCameraPrivacyMode(
beam_pb2.SetCameraPrivacyModeRequest( # pylint: disable=no-member
panel_id=panel_id, device_id=device_id, privacy_mode=state
),
metadata=metadata,
)

await self._send_grpc(_cb)
await self._send_grpc(_callback)

async def set_camera_deter_mode(
self, panel_id: int, device_id: int, state: bool
) -> None:
"""Set the camera deter mode."""

async def _cb(stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]):
async def _callback(
stub: beam_pb2_grpc.BeamStub, metadata: list[tuple[str, str]]
) -> Message:
return await stub.SetDeterOverride(
beam_pb2.SetDeterOverrideRequest( # pylint: disable=no-member
panel_id=panel_id, device_id=device_id, enabled=state
),
metadata=metadata,
)

await self._send_grpc(_cb)
await self._send_grpc(_callback)

async def set_garage_door_state(
self, panel_id: int, partition_id: int, device_id: int, state: int
Expand Down Expand Up @@ -536,7 +544,7 @@ async def __call(
async def _send_grpc(
self,
callback: Callable[[beam_pb2_grpc.BeamStub, list[tuple[str, str]]], Message],
):
) -> None:
"""Send gRPC."""
creds = grpc.ssl_channel_credentials()
assert (cookie := self._get_session_cookie())
Expand Down

0 comments on commit 1a1190c

Please sign in to comment.