fix app.py mypy issues

This commit is contained in:
Nicolas Mowen 2024-09-30 16:28:43 -06:00
parent 9fd704be2d
commit 430052106a

View File

@ -283,7 +283,7 @@ class FrigateApp:
except PermissionError: except PermissionError:
logger.error("Unable to write to /config to save export state") logger.error("Unable to write to /config to save export state")
migrate_exports(self.config.ffmpeg, self.config.cameras.keys()) migrate_exports(self.config.ffmpeg, list(self.config.cameras.keys()))
def init_external_event_processor(self) -> None: def init_external_event_processor(self) -> None:
self.external_event_processor = ExternalEventProcessor(self.config) self.external_event_processor = ExternalEventProcessor(self.config)
@ -327,7 +327,9 @@ class FrigateApp:
largest_frame = max( largest_frame = max(
[ [
det.model.height * det.model.width * 3 det.model.height * det.model.width * 3
for (name, det) in self.config.detectors.items() if det.model is not None
else 320
for det in self.config.detectors.values()
] ]
) )
shm_in = mp.shared_memory.SharedMemory( shm_in = mp.shared_memory.SharedMemory(
@ -394,6 +396,7 @@ class FrigateApp:
# create or update region grids for each camera # create or update region grids for each camera
for camera in self.config.cameras.values(): for camera in self.config.cameras.values():
if camera.name:
self.region_grids[camera.name] = get_camera_regions_grid( self.region_grids[camera.name] = get_camera_regions_grid(
camera.name, camera.name,
camera.detect, camera.detect,
@ -507,10 +510,10 @@ class FrigateApp:
min_req_shm += 8 min_req_shm += 8
available_shm = total_shm - min_req_shm available_shm = total_shm - min_req_shm
cam_total_frame_size = 0 cam_total_frame_size = 0.0
for camera in self.config.cameras.values(): for camera in self.config.cameras.values():
if camera.enabled: if camera.enabled and camera.detect.width and camera.detect.height:
cam_total_frame_size += round( cam_total_frame_size += round(
(camera.detect.width * camera.detect.height * 1.5 + 270480) (camera.detect.width * camera.detect.height * 1.5 + 270480)
/ 1048576, / 1048576,