mirror of
https://github.com/XiaoMi/ha_xiaomi_home.git
synced 2025-06-21 15:20:00 +08:00
fix: fix type error, wrong use of any and Any (#338)
* fix: fix type error, wrong use of any and Any * fix: wrong use of session close * fix: fix test_lan type error * fix: remove __del__ * feat: oauth, http add deinit_async
This commit is contained in:
@ -48,9 +48,9 @@ Common utilities.
|
||||
import json
|
||||
from os import path
|
||||
import random
|
||||
from typing import Optional
|
||||
from typing import Any, Optional
|
||||
import hashlib
|
||||
from paho.mqtt.client import MQTTMatcher
|
||||
from paho.mqtt.matcher import MQTTMatcher
|
||||
import yaml
|
||||
|
||||
MIOT_ROOT_PATH: str = path.dirname(path.abspath(__file__))
|
||||
@ -87,7 +87,7 @@ def randomize_int(value: int, ratio: float) -> int:
|
||||
class MIoTMatcher(MQTTMatcher):
|
||||
"""MIoT Pub/Sub topic matcher."""
|
||||
|
||||
def iter_all_nodes(self) -> any:
|
||||
def iter_all_nodes(self) -> Any:
|
||||
"""Return an iterator on all nodes with their paths and contents."""
|
||||
def rec(node, path_):
|
||||
# pylint: disable=protected-access
|
||||
@ -97,7 +97,7 @@ class MIoTMatcher(MQTTMatcher):
|
||||
yield from rec(child, path_ + [part])
|
||||
return rec(self._root, [])
|
||||
|
||||
def get(self, topic: str) -> Optional[any]:
|
||||
def get(self, topic: str) -> Optional[Any]:
|
||||
try:
|
||||
return self[topic]
|
||||
except KeyError:
|
||||
|
Reference in New Issue
Block a user