Skip to content

Commit bf0c284

Browse files
author
Auto-format Bot
committed
Automatically reformatting code
1 parent b0b53db commit bf0c284

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

src/groundlight/edge/config.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from typing import Any, Optional, Union
22

3+
import yaml
34
from model import Detector
45
from pydantic import BaseModel, ConfigDict, Field, field_validator, model_validator
56
from typing_extensions import Self
6-
import yaml
77

88

99
class GlobalConfig(BaseModel):
@@ -214,6 +214,7 @@ def from_payload(cls, payload: dict[str, Any]) -> "EdgeEndpointConfig":
214214
"""Construct an EdgeEndpointConfig from a payload dictionary."""
215215
return cls.model_validate(payload)
216216

217+
217218
# Preset inference configs matching the standard edge-endpoint defaults.
218219
DEFAULT = InferenceConfig(name="default")
219220
EDGE_ANSWERS_WITH_ESCALATION = InferenceConfig(

test/unit/test_edge_config.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime, timezone
2+
23
import pytest
34
from groundlight.edge import (
45
DEFAULT,
@@ -177,22 +178,19 @@ def test_detectors_config_to_payload_shape():
177178

178179
def test_edge_endpoint_config_accepts_top_level_payload_shape():
179180
"""Accepts the top-level edge endpoint payload shape used by APIs."""
180-
config = EdgeEndpointConfig.model_validate(
181-
{
182-
"global_config": {"refresh_rate": CUSTOM_REFRESH_RATE},
183-
"edge_inference_configs": {"default": {"enabled": True}},
184-
"detectors": [{"detector_id": "det_1", "edge_inference_config": "default"}],
185-
}
186-
)
181+
config = EdgeEndpointConfig.model_validate({
182+
"global_config": {"refresh_rate": CUSTOM_REFRESH_RATE},
183+
"edge_inference_configs": {"default": {"enabled": True}},
184+
"detectors": [{"detector_id": "det_1", "edge_inference_config": "default"}],
185+
})
187186

188187
assert config.global_config.refresh_rate == CUSTOM_REFRESH_RATE
189188
assert [detector.detector_id for detector in config.detectors] == ["det_1"]
190189

191190

192191
def test_edge_endpoint_config_from_yaml_accepts_yaml_text():
193192
"""Parses edge-endpoint YAML text using EdgeEndpointConfig.from_yaml."""
194-
config = EdgeEndpointConfig.from_yaml(
195-
yaml_str="""
193+
config = EdgeEndpointConfig.from_yaml(yaml_str="""
196194
global_config:
197195
refresh_rate: 15.0
198196
edge_inference_configs:
@@ -201,8 +199,7 @@ def test_edge_endpoint_config_from_yaml_accepts_yaml_text():
201199
detectors:
202200
- detector_id: det_1
203201
edge_inference_config: default
204-
"""
205-
)
202+
""")
206203

207204
assert config.global_config.refresh_rate == 15.0
208205
assert [detector.detector_id for detector in config.detectors] == ["det_1"]

0 commit comments

Comments
 (0)