diff --git a/frigate/api/app.py b/frigate/api/app.py index de2f87a68..bf7a18c15 100644 --- a/frigate/api/app.py +++ b/frigate/api/app.py @@ -391,7 +391,7 @@ def config_set(request: Request, body: AppConfigSetBody): ) if body.requires_restart == 0 or body.update_topic: - old_config = request.app.frigate_config + old_config: FrigateConfig = request.app.frigate_config request.app.frigate_config = config if body.update_topic and body.update_topic.startswith("config/cameras/"): @@ -400,7 +400,7 @@ def config_set(request: Request, body: AppConfigSetBody): if field == "add": settings = config.cameras[camera] elif field == "remove": - + settings = old_config.cameras[camera] else: settings = config.get_nested_object(body.update_topic) diff --git a/frigate/util/builtin.py b/frigate/util/builtin.py index 52280ecd8..c3fcd3683 100644 --- a/frigate/util/builtin.py +++ b/frigate/util/builtin.py @@ -184,7 +184,7 @@ def create_mask(frame_shape, mask): mask_img[:] = 255 -def update_yaml_from_url(file_path, url): +def update_yaml_from_url(file_path: str, url: str): parsed_url = urllib.parse.urlparse(url) query_string = urllib.parse.parse_qs(parsed_url.query, keep_blank_values=True) @@ -213,7 +213,7 @@ def update_yaml_from_url(file_path, url): update_yaml_file(file_path, key_path, value) -def update_yaml_file(file_path, key_path, new_value): +def update_yaml_file(file_path: str, key_path: str, new_value: Any): yaml = YAML() yaml.indent(mapping=2, sequence=4, offset=2)