mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-13 10:12:47 +03:00
Improve comms typing (#18599)
* Enable mypy for comms * Make zmq data types consistent * Cleanup inter process typing issues * Cleanup embeddings typing * Cleanup config updater * Cleanup recordings updator * Make publisher have a generic type * Cleanup event metadata updater * Cleanup event metadata updater * Cleanup detections updater * Cleanup websocket * Cleanup mqtt * Cleanup webpush * Cleanup dispatcher * Formatting * Remove unused * Add return type * Fix tests * Fix semantic triggers config typing * Cleanup
This commit is contained in:
committed by
Blake Blackshear
parent
1add72884a
commit
fcf3824124
@@ -7,7 +7,9 @@ from frigate.events.types import EventStateEnum, EventTypeEnum
|
||||
from .zmq_proxy import Publisher, Subscriber
|
||||
|
||||
|
||||
class EventUpdatePublisher(Publisher):
|
||||
class EventUpdatePublisher(
|
||||
Publisher[tuple[EventTypeEnum, EventStateEnum, str, str, dict[str, Any]]]
|
||||
):
|
||||
"""Publishes events (objects, audio, manual)."""
|
||||
|
||||
topic_base = "event/"
|
||||
@@ -16,9 +18,11 @@ class EventUpdatePublisher(Publisher):
|
||||
super().__init__("update")
|
||||
|
||||
def publish(
|
||||
self, payload: tuple[EventTypeEnum, EventStateEnum, str, str, dict[str, Any]]
|
||||
self,
|
||||
payload: tuple[EventTypeEnum, EventStateEnum, str, str, dict[str, Any]],
|
||||
sub_topic: str = "",
|
||||
) -> None:
|
||||
super().publish(payload)
|
||||
super().publish(payload, sub_topic)
|
||||
|
||||
|
||||
class EventUpdateSubscriber(Subscriber):
|
||||
@@ -30,7 +34,9 @@ class EventUpdateSubscriber(Subscriber):
|
||||
super().__init__("update")
|
||||
|
||||
|
||||
class EventEndPublisher(Publisher):
|
||||
class EventEndPublisher(
|
||||
Publisher[tuple[EventTypeEnum, EventStateEnum, str, dict[str, Any]]]
|
||||
):
|
||||
"""Publishes events that have ended."""
|
||||
|
||||
topic_base = "event/"
|
||||
@@ -39,9 +45,11 @@ class EventEndPublisher(Publisher):
|
||||
super().__init__("finalized")
|
||||
|
||||
def publish(
|
||||
self, payload: tuple[EventTypeEnum, EventStateEnum, str, dict[str, Any]]
|
||||
self,
|
||||
payload: tuple[EventTypeEnum, EventStateEnum, str, dict[str, Any]],
|
||||
sub_topic: str = "",
|
||||
) -> None:
|
||||
super().publish(payload)
|
||||
super().publish(payload, sub_topic)
|
||||
|
||||
|
||||
class EventEndSubscriber(Subscriber):
|
||||
|
||||
Reference in New Issue
Block a user