mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-05-01 11:07:41 +03:00
Improve typing
This commit is contained in:
parent
785e655ff5
commit
67cd746135
@ -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)
|
||||||
|
|
||||||
|
|||||||
@ -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)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user