From 14f7d272742d7efde638a35e01591ec634a9ca69 Mon Sep 17 00:00:00 2001 From: Abinila Siva Date: Mon, 24 Nov 2025 11:51:17 -0500 Subject: [PATCH] ruff format --- frigate/detectors/plugins/memryx.py | 21 +++++++-------------- frigate/object_detection/base.py | 2 +- 2 files changed, 8 insertions(+), 15 deletions(-) diff --git a/frigate/detectors/plugins/memryx.py b/frigate/detectors/plugins/memryx.py index 2fb87d018..a1a376438 100644 --- a/frigate/detectors/plugins/memryx.py +++ b/frigate/detectors/plugins/memryx.py @@ -54,7 +54,7 @@ class MemryXDetector(DetectionApi): "MemryX SDK is not installed. Install it and set up MIX environment." ) return - + # Get stop_event from detector_config self.stop_event = getattr(detector_config, "_stop_event", stop_event) @@ -372,10 +372,7 @@ class MemryXDetector(DetectionApi): return None try: # Wait for a frame from the queue with timeout to check stop_event periodically - frame = self.capture_queue.get( - block=True, - timeout=0.5 - ) + frame = self.capture_queue.get(block=True, timeout=0.5) return frame @@ -388,18 +385,15 @@ class MemryXDetector(DetectionApi): def receive_output(self): """Retrieve processed results from MemryX output queue + a copy of the original frame""" - try: + try: # Get connection ID with timeout - connection_id = ( - self.capture_id_queue.get( - block=True, - timeout=1.0 - ) + connection_id = self.capture_id_queue.get( + block=True, timeout=1.0 ) # Get the corresponding connection ID detections = self.output_queue.get() # Get detections from MemryX return connection_id, detections - + except Exception as e: # On timeout or stop event, return None if self.stop_event.is_set(): @@ -409,7 +403,6 @@ class MemryXDetector(DetectionApi): logger.warning(f"[receive_output] Error receiving output: {e}") return None, None - def post_process_yolonas(self, output): predictions = output[0] @@ -857,7 +850,7 @@ class MemryXDetector(DetectionApi): raise Exception( f"{self.memx_model_type} is currently not supported for memryx. See the docs for more info on supported models." ) - + def shutdown(self): """Gracefully shutdown the MemryX accelerator""" try: diff --git a/frigate/object_detection/base.py b/frigate/object_detection/base.py index 41ce93589..a92a98147 100644 --- a/frigate/object_detection/base.py +++ b/frigate/object_detection/base.py @@ -336,7 +336,7 @@ class ObjectDetectProcess: # if the process has already exited on its own, just return if self.detect_process and self.detect_process.exitcode: return - + logging.info("Waiting for detection process to exit gracefully...") self.detect_process.join(timeout=30) if self.detect_process.exitcode is None: