From 6daeb044d1cdd1af69b01451d5e7d91d6f034e28 Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Sat, 1 Jul 2023 07:34:44 -0500 Subject: [PATCH] update python deps --- frigate/app.py | 67 ++++++++++++++++++++++++++++++----------- frigate/stats.py | 8 +++-- frigate/watchdog.py | 4 ++- requirements-wheels.txt | 4 +-- 4 files changed, 60 insertions(+), 23 deletions(-) diff --git a/frigate/app.py b/frigate/app.py index 8d3972343..0b476cd43 100644 --- a/frigate/app.py +++ b/frigate/app.py @@ -107,33 +107,64 @@ class FrigateApp: for camera_name in self.config.cameras.keys(): # create camera_metrics self.camera_metrics[camera_name] = { - "camera_fps": mp.Value("d", 0.0), - "skipped_fps": mp.Value("d", 0.0), - "process_fps": mp.Value("d", 0.0), - "detection_enabled": mp.Value( - "i", self.config.cameras[camera_name].detect.enabled + "camera_fps": mp.Value("d", 0.0), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "skipped_fps": mp.Value("d", 0.0), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "process_fps": mp.Value("d", 0.0), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "detection_enabled": mp.Value( # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "i", + self.config.cameras[camera_name].detect.enabled, ), - "motion_enabled": mp.Value("i", True), - "improve_contrast_enabled": mp.Value( - "i", self.config.cameras[camera_name].motion.improve_contrast + "motion_enabled": mp.Value("i", True), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "improve_contrast_enabled": mp.Value( # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "i", + self.config.cameras[camera_name].motion.improve_contrast, ), - "motion_threshold": mp.Value( - "i", self.config.cameras[camera_name].motion.threshold + "motion_threshold": mp.Value( # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "i", + self.config.cameras[camera_name].motion.threshold, ), - "motion_contour_area": mp.Value( - "i", self.config.cameras[camera_name].motion.contour_area + "motion_contour_area": mp.Value( # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "i", + self.config.cameras[camera_name].motion.contour_area, ), - "detection_fps": mp.Value("d", 0.0), - "detection_frame": mp.Value("d", 0.0), - "read_start": mp.Value("d", 0.0), - "ffmpeg_pid": mp.Value("i", 0), + "detection_fps": mp.Value("d", 0.0), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "detection_frame": mp.Value("d", 0.0), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "read_start": mp.Value("d", 0.0), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "ffmpeg_pid": mp.Value("i", 0), # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards "frame_queue": mp.Queue(maxsize=2), "capture_process": None, "process": None, } self.record_metrics[camera_name] = { - "record_enabled": mp.Value( - "i", self.config.cameras[camera_name].record.enabled + "record_enabled": mp.Value( # type: ignore[typeddict-item] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "i", + self.config.cameras[camera_name].record.enabled, ) } diff --git a/frigate/stats.py b/frigate/stats.py index d18642dfe..096ad7913 100644 --- a/frigate/stats.py +++ b/frigate/stats.py @@ -262,8 +262,12 @@ def stats_snapshot( for name, detector in stats_tracking["detectors"].items(): pid = detector.detect_process.pid if detector.detect_process else None stats["detectors"][name] = { - "inference_speed": round(detector.avg_inference_speed.value * 1000, 2), - "detection_start": detector.detection_start.value, + "inference_speed": round(detector.avg_inference_speed.value * 1000, 2), # type: ignore[attr-defined] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards + "detection_start": detector.detection_start.value, # type: ignore[attr-defined] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards "pid": pid, } stats["detection_fps"] = round(total_detection_fps, 2) diff --git a/frigate/watchdog.py b/frigate/watchdog.py index d1573f0b0..245e6f2cb 100644 --- a/frigate/watchdog.py +++ b/frigate/watchdog.py @@ -24,7 +24,9 @@ class FrigateWatchdog(threading.Thread): # check the detection processes for detector in self.detectors.values(): - detection_start = detector.detection_start.value + detection_start = detector.detection_start.value # type: ignore[attr-defined] + # issue https://github.com/python/typeshed/issues/8799 + # from mypy 0.981 onwards if detection_start > 0.0 and now - detection_start > 10: logger.info( "Detection appears to be stuck. Restarting detection process..." diff --git a/requirements-wheels.txt b/requirements-wheels.txt index 00cedf9cd..778737a92 100644 --- a/requirements-wheels.txt +++ b/requirements-wheels.txt @@ -3,13 +3,13 @@ Flask == 2.3.* faster-fifo == 1.4.* imutils == 0.5.* matplotlib == 3.7.* -mypy == 0.942 +mypy == 1.4.1 numpy == 1.23.* onvif_zeep == 0.2.12 opencv-python-headless == 4.7.0.* paho-mqtt == 1.6.* peewee == 3.16.* -peewee_migrate == 1.10.* +peewee_migrate == 1.11.* psutil == 5.9.* pydantic == 1.10.* git+https://github.com/fbcotter/py3nvml#egg=py3nvml