Fix bug introduced in new linter (#6754)

* Fix bug introduced in new linter

* Ignore this error

* Fix more

* Ignore boolean error too
This commit is contained in:
Nicolas Mowen 2023-06-11 06:18:47 -06:00 committed by GitHub
parent d3949eebfa
commit 435d152423
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 13 deletions

View File

@ -52,7 +52,7 @@ class EventCleanup(threading.Thread):
Event.camera.not_in(self.camera_keys), Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after, Event.start_time < expire_after,
Event.label == event.label, Event.label == event.label,
Event.retain_indefinitely is False, Event.retain_indefinitely == False,
) )
# delete the media from disk # delete the media from disk
for event in expired_events: for event in expired_events:
@ -72,7 +72,7 @@ class EventCleanup(threading.Thread):
Event.camera.not_in(self.camera_keys), Event.camera.not_in(self.camera_keys),
Event.start_time < expire_after, Event.start_time < expire_after,
Event.label == event.label, Event.label == event.label,
Event.retain_indefinitely is False, Event.retain_indefinitely == False,
) )
update_query.execute() update_query.execute()
@ -101,7 +101,7 @@ class EventCleanup(threading.Thread):
Event.camera == name, Event.camera == name,
Event.start_time < expire_after, Event.start_time < expire_after,
Event.label == event.label, Event.label == event.label,
Event.retain_indefinitely is False, Event.retain_indefinitely == False,
) )
# delete the grabbed clips from disk # delete the grabbed clips from disk
for event in expired_events: for event in expired_events:
@ -120,7 +120,7 @@ class EventCleanup(threading.Thread):
Event.camera == name, Event.camera == name,
Event.start_time < expire_after, Event.start_time < expire_after,
Event.label == event.label, Event.label == event.label,
Event.retain_indefinitely is False, Event.retain_indefinitely == False,
) )
update_query.execute() update_query.execute()
@ -167,7 +167,7 @@ class EventCleanup(threading.Thread):
# drop events from db where has_clip and has_snapshot are false # drop events from db where has_clip and has_snapshot are false
delete_query = Event.delete().where( delete_query = Event.delete().where(
Event.has_clip is False, Event.has_snapshot is False Event.has_clip == False, Event.has_snapshot == False
) )
delete_query.execute() delete_query.execute()

View File

@ -61,7 +61,7 @@ class EventProcessor(threading.Thread):
def run(self) -> None: def run(self) -> None:
# set an end_time on events without an end_time on startup # set an end_time on events without an end_time on startup
Event.update(end_time=Event.start_time + 30).where( Event.update(end_time=Event.start_time + 30).where(
Event.end_time is None Event.end_time == None
).execute() ).execute()
while not self.stop_event.is_set(): while not self.stop_event.is_set():
@ -95,7 +95,7 @@ class EventProcessor(threading.Thread):
# set an end_time on events without an end_time before exiting # set an end_time on events without an end_time before exiting
Event.update(end_time=datetime.datetime.now().timestamp()).where( Event.update(end_time=datetime.datetime.now().timestamp()).where(
Event.end_time is None Event.end_time == None
).execute() ).execute()
logger.info("Exiting event processor...") logger.info("Exiting event processor...")

View File

@ -591,7 +591,7 @@ def event_snapshot(id):
event_complete = False event_complete = False
jpg_bytes = None jpg_bytes = None
try: try:
event = Event.get(Event.id == id, Event.end_time is not None) event = Event.get(Event.id == id, Event.end_time != None)
event_complete = True event_complete = True
if not event.has_snapshot: if not event.has_snapshot:
return "Snapshot not available", 404 return "Snapshot not available", 404
@ -643,7 +643,7 @@ def label_snapshot(camera_name, label):
event_query = ( event_query = (
Event.select() Event.select()
.where(Event.camera == camera_name) .where(Event.camera == camera_name)
.where(Event.has_snapshot is True) .where(Event.has_snapshot == True)
.order_by(Event.start_time.desc()) .order_by(Event.start_time.desc())
) )
else: else:
@ -651,7 +651,7 @@ def label_snapshot(camera_name, label):
Event.select() Event.select()
.where(Event.camera == camera_name) .where(Event.camera == camera_name)
.where(Event.label == label) .where(Event.label == label)
.where(Event.has_snapshot is True) .where(Event.has_snapshot == True)
.order_by(Event.start_time.desc()) .order_by(Event.start_time.desc())
) )

View File

@ -115,7 +115,7 @@ class RecordingMaintainer(threading.Thread):
Event.select() Event.select()
.where( .where(
Event.camera == camera, Event.camera == camera,
(Event.end_time is None) (Event.end_time == None)
| (Event.end_time >= recordings[0]["start_time"].timestamp()), | (Event.end_time >= recordings[0]["start_time"].timestamp()),
Event.has_clip, Event.has_clip,
) )

View File

@ -107,7 +107,7 @@ class StorageMaintainer(threading.Thread):
retained_events: Event = ( retained_events: Event = (
Event.select() Event.select()
.where( .where(
Event.retain_indefinitely is True, Event.retain_indefinitely == True,
Event.has_clip, Event.has_clip,
) )
.order_by(Event.start_time.asc()) .order_by(Event.start_time.asc())

View File

@ -2,4 +2,4 @@
profile = "black" profile = "black"
[tool.ruff] [tool.ruff]
ignore = ["E501"] ignore = ["E501","E711","E712"]