Files
frigate/frigate/api/defs/request/events_body.py
T
Nicolas MowenandGitHub 4ee12e6237
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
Increase ruff coverage (#23644)
* 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
2026-07-06 12:28:02 -05:00

59 lines
1.6 KiB
Python

from pydantic import BaseModel, Field
from frigate.config.classification import TriggerType
class EventsSubLabelBody(BaseModel):
subLabel: str = Field(title="Sub label", max_length=100)
subLabelScore: float | None = Field(
title="Score for sub label", default=None, gt=0.0, le=1.0
)
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: float | None = Field(
title="Score for recognized license plate", default=None, gt=0.0, le=1.0
)
class EventsAttributesBody(BaseModel):
attributes: list[str] = Field(
title="Selected classification attributes for the event",
default_factory=list,
)
class EventsDescriptionBody(BaseModel):
description: str | None = Field(title="The description of the event")
class EventsCreateBody(BaseModel):
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: float | None = None
class EventsDeleteBody(BaseModel):
event_ids: list[str] = Field(title="The event IDs to delete")
class SubmitPlusBody(BaseModel):
include_annotation: int = Field(default=1)
class TriggerEmbeddingBody(BaseModel):
type: TriggerType
data: str
threshold: float = Field(default=0.5, ge=0.0, le=1.0)