From bc4071dde8380bb98b82bc54851215a9be6050e6 Mon Sep 17 00:00:00 2001 From: Martin Weinelt Date: Tue, 23 May 2023 03:49:39 +0200 Subject: [PATCH] treewide: apply black --- frigate/events/cleanup.py | 4 +++- frigate/object_processing.py | 6 +----- migrations/013_create_timeline_table.py | 12 +++++++++--- process_clip.py | 1 - 4 files changed, 13 insertions(+), 10 deletions(-) diff --git a/frigate/events/cleanup.py b/frigate/events/cleanup.py index 5afd285c49..ada45e6fa6 100644 --- a/frigate/events/cleanup.py +++ b/frigate/events/cleanup.py @@ -90,7 +90,9 @@ def expire(self, media_type: str) -> None: # loop over object types in db for event in distinct_labels: # get expiration time for this label - expire_days = retain_config.objects.get(event.label, retain_config.default) + expire_days = retain_config.objects.get( + event.label, retain_config.default + ) expire_after = ( datetime.datetime.now() - datetime.timedelta(days=expire_days) ).timestamp() diff --git a/frigate/object_processing.py b/frigate/object_processing.py index 8c16ef64ed..f9046d0ab2 100644 --- a/frigate/object_processing.py +++ b/frigate/object_processing.py @@ -177,11 +177,7 @@ def update(self, current_frame_time, obj_data): return (thumb_update, significant_change) def to_dict(self, include_thumbnail: bool = False): - ( - self.thumbnail_data["frame_time"] - if self.thumbnail_data is not None - else 0.0 - ) + (self.thumbnail_data["frame_time"] if self.thumbnail_data is not None else 0.0) event = { "id": self.obj_data["id"], "camera": self.camera, diff --git a/migrations/013_create_timeline_table.py b/migrations/013_create_timeline_table.py index b96822df16..7a83d96c72 100644 --- a/migrations/013_create_timeline_table.py +++ b/migrations/013_create_timeline_table.py @@ -30,9 +30,15 @@ def migrate(migrator, database, fake=False, **kwargs): migrator.sql( 'CREATE TABLE IF NOT EXISTS "timeline" ("timestamp" DATETIME NOT NULL, "camera" VARCHAR(20) NOT NULL, "source" VARCHAR(20) NOT NULL, "source_id" VARCHAR(30), "class_type" VARCHAR(50) NOT NULL, "data" JSON)' ) - migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_camera" ON "timeline" ("camera")') - migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_source" ON "timeline" ("source")') - migrator.sql('CREATE INDEX IF NOT EXISTS "timeline_source_id" ON "timeline" ("source_id")') + migrator.sql( + 'CREATE INDEX IF NOT EXISTS "timeline_camera" ON "timeline" ("camera")' + ) + migrator.sql( + 'CREATE INDEX IF NOT EXISTS "timeline_source" ON "timeline" ("source")' + ) + migrator.sql( + 'CREATE INDEX IF NOT EXISTS "timeline_source_id" ON "timeline" ("source_id")' + ) def rollback(migrator, database, fake=False, **kwargs): diff --git a/process_clip.py b/process_clip.py index e122ebf369..9eb6f324b6 100644 --- a/process_clip.py +++ b/process_clip.py @@ -311,7 +311,6 @@ def process(path, label, output, debug_path): for result in results: if count == 0: - # Writing headers of CSV file header = ["file"] + list(result[1].keys()) csv_writer.writerow(header)