Skip to content

Commit

Permalink
Fix return Any from return statement
Browse files Browse the repository at this point in the history
Not all elements from the event dict are sure to be something that can be evaluated

See e.g.: python/mypy#5697
  • Loading branch information
Sebastian Englbrecht committed Jun 16, 2022
1 parent b870c33 commit 7d7a489
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions frigate/events.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,16 @@ def should_insert_db(prev_event: Event, current_event: Event) -> bool:

def should_update_db(prev_event: Event, current_event: Event) -> bool:
"""If current_event has updated fields and (clip or snapshot)."""
return (current_event["has_clip"] or current_event["has_snapshot"]) and (
prev_event["top_score"] != current_event["top_score"]
or prev_event["entered_zones"] != current_event["entered_zones"]
or prev_event["thumbnail"] != current_event["thumbnail"]
or prev_event["has_clip"] != current_event["has_clip"]
or prev_event["has_snapshot"] != current_event["has_snapshot"]
)
if current_event["has_clip"] or current_event["has_snapshot"]:
if (
prev_event["top_score"] != current_event["top_score"]
or prev_event["entered_zones"] != current_event["entered_zones"]
or prev_event["thumbnail"] != current_event["thumbnail"]
or prev_event["has_clip"] != current_event["has_clip"]
or prev_event["has_snapshot"] != current_event["has_snapshot"]
):
return True
return False


class EventProcessor(threading.Thread):
Expand Down

0 comments on commit 7d7a489

Please sign in to comment.