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:
Paul Shawn
2024-12-22 10:46:58 +08:00
committed by GitHub
parent afef709839
commit c1867e2baf
18 changed files with 237 additions and 173 deletions

View File

@ -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: