mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2026-01-17 23:50:42 +08:00
remove unused data classes
This commit is contained in:
parent
d13a6bfb11
commit
d3c39f38e1
@ -76,27 +76,12 @@ _LOGGER = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class MIoTLanCmdData:
|
class MIoTLanGetDevListData:
|
||||||
handler: Callable[[dict, Any], None]
|
handler: Callable[[dict, Any], None]
|
||||||
handler_ctx: Any
|
handler_ctx: Any
|
||||||
timeout_ms: int
|
timeout_ms: int
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class MIoTLanGetDevListData(MIoTLanCmdData):
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class MIoTLanCallApiData(MIoTLanCmdData):
|
|
||||||
did: str
|
|
||||||
msg: dict
|
|
||||||
|
|
||||||
|
|
||||||
class MIoTLanSendBroadcastData(MIoTLanCallApiData):
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class MIoTLanUnregisterBroadcastData:
|
class MIoTLanUnregisterBroadcastData:
|
||||||
key: str
|
key: str
|
||||||
@ -110,12 +95,12 @@ class MIoTLanRegisterBroadcastData:
|
|||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class MIoTLanUnsubDeviceState:
|
class MIoTLanUnsubDeviceData:
|
||||||
key: str
|
key: str
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class MIoTLanSubDeviceState:
|
class MIoTLanSubDeviceData:
|
||||||
key: str
|
key: str
|
||||||
handler: Callable[[str, dict, Any], Coroutine]
|
handler: Callable[[str, dict, Any], Coroutine]
|
||||||
handler_ctx: Any
|
handler_ctx: Any
|
||||||
@ -483,7 +468,7 @@ class MIoTLan:
|
|||||||
_msg_id_counter: int
|
_msg_id_counter: int
|
||||||
_pending_requests: dict[int, MIoTLanRequestData]
|
_pending_requests: dict[int, MIoTLanRequestData]
|
||||||
_device_msg_matcher: MIoTMatcher
|
_device_msg_matcher: MIoTMatcher
|
||||||
_device_state_sub_map: dict[str, MIoTLanSubDeviceState]
|
_device_state_sub_map: dict[str, MIoTLanSubDeviceData]
|
||||||
_reply_msg_buffer: dict[str, asyncio.TimerHandle]
|
_reply_msg_buffer: dict[str, asyncio.TimerHandle]
|
||||||
|
|
||||||
_lan_state_sub_map: dict[str, Callable[[bool], Coroutine]]
|
_lan_state_sub_map: dict[str, Callable[[bool], Coroutine]]
|
||||||
@ -717,14 +702,14 @@ class MIoTLan:
|
|||||||
) -> bool:
|
) -> bool:
|
||||||
self._internal_loop.call_soon_threadsafe(
|
self._internal_loop.call_soon_threadsafe(
|
||||||
self.__sub_device_state,
|
self.__sub_device_state,
|
||||||
MIoTLanSubDeviceState(
|
MIoTLanSubDeviceData(
|
||||||
key=key, handler=handler, handler_ctx=handler_ctx))
|
key=key, handler=handler, handler_ctx=handler_ctx))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@final
|
@final
|
||||||
def unsub_device_state(self, key: str) -> bool:
|
def unsub_device_state(self, key: str) -> bool:
|
||||||
self._internal_loop.call_soon_threadsafe(
|
self._internal_loop.call_soon_threadsafe(
|
||||||
self.__unsub_device_state, MIoTLanUnsubDeviceState(key=key))
|
self.__unsub_device_state, MIoTLanUnsubDeviceData(key=key))
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@final
|
@final
|
||||||
@ -1047,10 +1032,10 @@ class MIoTLan:
|
|||||||
'error': str(err)},
|
'error': str(err)},
|
||||||
handler_ctx)
|
handler_ctx)
|
||||||
|
|
||||||
def __sub_device_state(self, data: MIoTLanSubDeviceState) -> None:
|
def __sub_device_state(self, data: MIoTLanSubDeviceData) -> None:
|
||||||
self._device_state_sub_map[data.key] = data
|
self._device_state_sub_map[data.key] = data
|
||||||
|
|
||||||
def __unsub_device_state(self, data: MIoTLanUnsubDeviceState) -> None:
|
def __unsub_device_state(self, data: MIoTLanUnsubDeviceData) -> None:
|
||||||
self._device_state_sub_map.pop(data.key, None)
|
self._device_state_sub_map.pop(data.key, None)
|
||||||
|
|
||||||
def __sub_broadcast(self, data: MIoTLanRegisterBroadcastData) -> None:
|
def __sub_broadcast(self, data: MIoTLanRegisterBroadcastData) -> None:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user