Increase ruff coverage (#23644)
CI / AMD64 Build (push) Waiting to run
CI / ARM Build (push) Waiting to run
CI / AMD64 Extra Build (push) Blocked by required conditions
CI / ARM Extra Build (push) Blocked by required conditions
CI / Synaptics Build (push) Blocked by required conditions
CI / Assemble and push default build (push) Blocked by required conditions
CI / Jetson Jetpack 6 (push) Waiting to run

* Pin ruff

* Add python upgrade fixes

This enables python upgrade checks in ruff to look for deprecated types and patterns. This namely fixes:
- usage of deprecated `Typing` which is now built in
- some specific exceptions which are caught and have new aliases

Some specific UP checks were also ignored as they are stylistic / unimportant and likely to cause bugs

* Remove async blocking calls

Use asyncio.to_thread on two remaining blocking calls to fix hanging event thread loop. Enable this specific rule to block it in the future.

* Use proper logging mechanism

* Correctly format logs

* Raise with context

When raising an exception include the from context to improve debugging

* Cleanup
This commit is contained in:
Nicolas Mowen
2026-07-06 12:28:02 -05:00
committed by GitHub
parent 455b8687e8
commit 4ee12e6237
169 changed files with 1053 additions and 1150 deletions
+13 -17
View File
@@ -1,5 +1,3 @@
from typing import List, Optional, Union
from pydantic import BaseModel, Field
from frigate.config.classification import TriggerType
@@ -7,49 +5,47 @@ from frigate.config.classification import TriggerType
class EventsSubLabelBody(BaseModel):
subLabel: str = Field(title="Sub label", max_length=100)
subLabelScore: Optional[float] = Field(
subLabelScore: float | None = Field(
title="Score for sub label", default=None, gt=0.0, le=1.0
)
camera: Optional[str] = Field(
title="Camera this object is detected on.", default=None
)
camera: str | None = Field(title="Camera this object is detected on.", default=None)
class EventsLPRBody(BaseModel):
recognizedLicensePlate: str = Field(
title="Recognized License Plate", max_length=100
)
recognizedLicensePlateScore: Optional[float] = Field(
recognizedLicensePlateScore: float | None = Field(
title="Score for recognized license plate", default=None, gt=0.0, le=1.0
)
class EventsAttributesBody(BaseModel):
attributes: List[str] = Field(
attributes: list[str] = Field(
title="Selected classification attributes for the event",
default_factory=list,
)
class EventsDescriptionBody(BaseModel):
description: Union[str, None] = Field(title="The description of the event")
description: str | None = Field(title="The description of the event")
class EventsCreateBody(BaseModel):
sub_label: Optional[str] = None
score: Optional[float] = 0
duration: Optional[int] = 30
include_recording: Optional[bool] = True
draw: Optional[dict] = {}
pre_capture: Optional[int] = None
sub_label: str | None = None
score: float | None = 0
duration: int | None = 30
include_recording: bool | None = True
draw: dict | None = {}
pre_capture: int | None = None
class EventsEndBody(BaseModel):
end_time: Optional[float] = None
end_time: float | None = None
class EventsDeleteBody(BaseModel):
event_ids: List[str] = Field(title="The event IDs to delete")
event_ids: list[str] = Field(title="The event IDs to delete")
class SubmitPlusBody(BaseModel):