Skip to content

Commit

Permalink
more linter changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim Huff authored and Tim Huff committed Aug 2, 2023
1 parent c2b6a5f commit 358b8b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
15 changes: 5 additions & 10 deletions src/groundlight/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ def submit_image_query(
image_query_dict = raw_image_query.to_dict()
image_query = ImageQuery.parse_obj(image_query_dict)
else:
# pylint: disable=protected-access
iq_id = self.api_client._submit_image_query_with_inspection(
iq_id = self.api_client.submit_image_query_with_inspection(
detector_id=detector_id, image=image_bytesio, inspection_id=inspection_id
)
image_query = self.get_image_query(iq_id)
Expand Down Expand Up @@ -269,20 +268,16 @@ def add_label(self, image_query: Union[ImageQuery, str], label: Union[Label, str

def start_inspection(self) -> str:
"""Starts an inspection report and returns the id of the inspection."""
# pylint: disable=protected-access
return self.api_client._start_inspection()
return self.api_client.start_inspection()

def update_inspection_metadata(self, inspection_id: str, user_provided_key, user_provided_value) -> None:
"""Add/update inspection metadata with the user_provided_key and user_provided_value."""
# pylint: disable=protected-access
self.api_client._update_inspection_metadata(inspection_id, user_provided_key, user_provided_value)
self.api_client.update_inspection_metadata(inspection_id, user_provided_key, user_provided_value)

def stop_inspection(self, inspection_id: str) -> None:
"""Stops an inspection and raises an exception if the response from the server does not indicate success."""
# pylint: disable=protected-access
self.api_client._stop_inspection(inspection_id)
self.api_client.stop_inspection(inspection_id)

def update_detector_confidence_threshold(self, detector_id: str, confidence_threshold: float) -> None:
"""Updates the confidence threshold of a detector given a detector_id."""
# pylint: disable=protected-access
self.api_client._update_detector_confidence_threshold(detector_id, confidence_threshold)
self.api_client.update_detector_confidence_threshold(detector_id, confidence_threshold)
12 changes: 6 additions & 6 deletions src/groundlight/internalapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ def _get_detector_by_name(self, name: str) -> Detector:
return Detector.parse_obj(parsed["results"][0])

@RequestsRetryDecorator()
def _submit_image_query_with_inspection(self, detector_id: str, image, inspection_id: str) -> str:
def submit_image_query_with_inspection(self, detector_id: str, image, inspection_id: str) -> str:
"""Submits an image query to the API, and returns the ID of the image query.
The image query will be associated to the inspection_id provided.
"""
Expand All @@ -250,7 +250,7 @@ def _submit_image_query_with_inspection(self, detector_id: str, image, inspectio

elapsed = 1000 * (time.time() - start_time)
logger.debug(
f"Call to ImageQuery._submit_image_query_with_inspection took {elapsed:.1f}ms response={response.text}"
f"Call to ImageQuery.submit_image_query_with_inspection took {elapsed:.1f}ms response={response.text}"
)

if not is_ok(response.status_code):
Expand All @@ -264,7 +264,7 @@ def _submit_image_query_with_inspection(self, detector_id: str, image, inspectio
return response.json()["id"]

@RequestsRetryDecorator()
def _start_inspection(self) -> str:
def start_inspection(self) -> str:
"""Starts an inspection, returns the ID."""
url = f"{self.configuration.host}/inspections"

Expand All @@ -278,7 +278,7 @@ def _start_inspection(self) -> str:
return response.json()["id"]

@RequestsRetryDecorator()
def _update_inspection_metadata(self, inspection_id: str, user_provided_key, user_provided_value) -> None:
def update_inspection_metadata(self, inspection_id: str, user_provided_key, user_provided_value) -> None:
"""Add/update inspection metadata with the user_provided_key and user_provided_value.
Inspections store metadata in two ways:
Expand Down Expand Up @@ -326,7 +326,7 @@ def _update_inspection_metadata(self, inspection_id: str, user_provided_key, use
)

@RequestsRetryDecorator()
def _stop_inspection(self, inspection_id: str) -> None:
def stop_inspection(self, inspection_id: str) -> None:
"""Stops an inspection and raises an exception if the response from the server does not indicate success."""
url = f"{self.configuration.host}/inspections/{inspection_id}"

Expand All @@ -340,7 +340,7 @@ def _stop_inspection(self, inspection_id: str) -> None:
raise InspectionError(f"Error stopping inspection {inspection_id}. Status code: {response.status_code}")

@RequestsRetryDecorator()
def _update_detector_confidence_threshold(self, detector_id: str, confidence_threshold: float) -> None:
def update_detector_confidence_threshold(self, detector_id: str, confidence_threshold: float) -> None:
"""Updates the confidence threshold of a detector."""

# The API does not validate the confidence threshold,
Expand Down

0 comments on commit 358b8b2

Please sign in to comment.