Skip to content

Commit

Permalink
Improve mqtt_json_to_event annotations (#540)
Browse files Browse the repository at this point in the history
  • Loading branch information
cdce8p authored Dec 11, 2024
1 parent 5e2399f commit 9427beb
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ repos:
- id: mypy
additional_dependencies: [
"httpx==0.27.2",
"orjson==3.10.12",
"packaging==24.2",
"types-orjson==3.6.2",
"types-xmltodict==v0.14.0.20241009"
]
exclude: ^tests/
2 changes: 1 addition & 1 deletion axis/interfaces/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
DEFAULT_TOPICS = ["//."]


def mqtt_json_to_event(msg: bytes | str) -> dict[str, Any]:
def mqtt_json_to_event(msg: bytes | bytearray | memoryview | str) -> dict[str, Any]:
"""Convert JSON message from MQTT to event format."""
message = orjson.loads(msg)
topic = message["topic"].replace("onvif", "tns1").replace("axis", "tnsaxis")
Expand Down
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ requirements-test = [
"pytest-cov==6.0.0",
"respx==0.21.1",
"ruff==0.8.2",
"types-orjson==3.6.2",
"types-xmltodict==v0.14.0.20241009",
]
requirements-dev = [
Expand Down

0 comments on commit 9427beb

Please sign in to comment.