Improve typing

This commit is contained in:
Nicolas Mowen 2025-06-11 07:18:22 -06:00
parent 785e655ff5
commit 67cd746135
2 changed files with 4 additions and 4 deletions

View File

@ -391,7 +391,7 @@ def config_set(request: Request, body: AppConfigSetBody):
) )
if body.requires_restart == 0 or body.update_topic: 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 request.app.frigate_config = config
if body.update_topic and body.update_topic.startswith("config/cameras/"): 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": if field == "add":
settings = config.cameras[camera] settings = config.cameras[camera]
elif field == "remove": elif field == "remove":
settings = old_config.cameras[camera]
else: else:
settings = config.get_nested_object(body.update_topic) settings = config.get_nested_object(body.update_topic)

View File

@ -184,7 +184,7 @@ def create_mask(frame_shape, mask):
mask_img[:] = 255 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) parsed_url = urllib.parse.urlparse(url)
query_string = urllib.parse.parse_qs(parsed_url.query, keep_blank_values=True) 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) 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 = YAML()
yaml.indent(mapping=2, sequence=4, offset=2) yaml.indent(mapping=2, sequence=4, offset=2)