Skip to content

Commit 91e5839

Browse files
committed
addressing linter errors and cleaning up code
1 parent ac06a60 commit 91e5839

File tree

3 files changed

+6
-23
lines changed

3 files changed

+6
-23
lines changed

src/groundlight/edge/api.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ def __init__(self, client) -> None:
1818
self._client = client
1919

2020
def _base_url(self) -> str:
21-
return self._client._edge_base_url()
21+
return self._client.edge_base_url()
2222

2323
def _request(self, method: str, path: str, **kwargs) -> requests.Response:
2424
url = f"{self._base_url()}{path}"
2525
headers = self._client.get_raw_headers()
2626
try:
2727
response = requests.request(
28-
method, url, headers=headers, verify=self._client.configuration.verify_ssl, **kwargs
28+
method, url, headers=headers, verify=self._client.configuration.verify_ssl, timeout=10, **kwargs
2929
)
3030
response.raise_for_status()
3131
except requests.exceptions.HTTPError as e:

src/groundlight/experimental_api.py

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from urllib3.response import HTTPResponse
4343

4444
from groundlight.edge.api import EdgeAPI
45-
from groundlight.edge.config import EdgeEndpointConfig
4645
from groundlight.images import parse_supported_image_types
4746
from groundlight.internalapi import _generate_request_id
4847
from groundlight.optional_imports import Image, np
@@ -822,23 +821,7 @@ def make_generic_api_request( # noqa: PLR0913 # pylint: disable=too-many-argume
822821
_preload_content=False, # This returns the urllib3 response rather than trying any type of processing
823822
)
824823

825-
def _edge_base_url(self) -> str:
824+
def edge_base_url(self) -> str:
826825
"""Return the scheme+host+port of the configured endpoint, without the /device-api path."""
827826
parsed = urlparse(self.configuration.host)
828827
return urlunparse((parsed.scheme, parsed.netloc, "", "", "", ""))
829-
830-
def get_edge_config(self) -> EdgeEndpointConfig:
831-
"""Deprecated: use ``gl.edge.get_config()`` instead."""
832-
return self.edge.get_config()
833-
834-
def get_edge_detector_readiness(self) -> dict[str, bool]:
835-
"""Deprecated: use ``gl.edge.get_detector_readiness()`` instead."""
836-
return self.edge.get_detector_readiness()
837-
838-
def set_edge_config(
839-
self,
840-
config: EdgeEndpointConfig,
841-
timeout_sec: float = 600,
842-
) -> EdgeEndpointConfig:
843-
"""Deprecated: use ``gl.edge.set_config()`` instead."""
844-
return self.edge.set_config(config, timeout_sec=timeout_sec)

test/unit/test_edge_config.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ def test_inference_config_validation_errors():
309309
)
310310

311311

312-
def test_get_edge_config_parses_response():
313-
"""ExperimentalApi.get_edge_config() parses the HTTP response into an EdgeEndpointConfig."""
312+
def test_edge_get_config_parses_response():
313+
"""gl.edge.get_config() parses the HTTP response into an EdgeEndpointConfig."""
314314
from unittest.mock import Mock, patch
315315

316316
from groundlight import ExperimentalApi
@@ -327,7 +327,7 @@ def test_get_edge_config_parses_response():
327327

328328
gl = ExperimentalApi()
329329
with patch("requests.request", return_value=mock_response) as mock_request:
330-
config = gl.get_edge_config()
330+
config = gl.edge.get_config()
331331

332332
mock_request.assert_called_once()
333333
assert isinstance(config, EdgeEndpointConfig)

0 commit comments

Comments
 (0)