diff --git a/src/groundlight/client.py b/src/groundlight/client.py index b5a1ebd3..639a22df 100644 --- a/src/groundlight/client.py +++ b/src/groundlight/client.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines import logging import os import time @@ -298,7 +299,8 @@ def list_detectors(self, page: int = 1, page_size: int = 10) -> PaginatedDetecto for detector in detectors.items: print(detector) - :param page: The page number to retrieve (1-based indexing). Use this parameter to navigate through multiple pages of detectors. + :param page: The page number to retrieve (1-based indexing). Use this parameter to navigate + through multiple pages of detectors. :param page_size: The number of detectors to return per page. :return: PaginatedDetectorList containing the requested page of detectors and pagination metadata @@ -502,7 +504,8 @@ def get_or_create_detector( # noqa: PLR0913 def get_image_query(self, id: str) -> ImageQuery: # pylint: disable=redefined-builtin """ - Get an ImageQuery by its ID. This is useful for retrieving the status and results of a previously submitted query. + Get an ImageQuery by its ID. This is useful for retrieving the status and results of a + previously submitted query. **Example Usage:** @@ -541,7 +544,8 @@ def list_image_queries(self, page: int = 1, page_size: int = 10) -> PaginatedIma print(f"Query ID: {query.id}") print(f"Result: {query.result.label if query.result else 'No result yet'}") - :param page: Which page of results to return, starting from 1. Default is 1. + :param page: The page number to retrieve (1-based indexing). Use this parameter to navigate + through multiple pages of image queries. :param page_size: Number of image queries to return per page. Default is 10. :return: PaginatedImageQueryList containing the requested page of image queries and pagination metadata like total count and links to next/previous pages. @@ -624,8 +628,8 @@ def submit_image_query( # noqa: PLR0913 # pylint: disable=too-many-arguments, t (Note OpenCV uses BGR not RGB. `img[:, :, ::-1]` will reverse the channels) - PIL Image: Any binary format must be JPEG-encoded already. Any pixel format will get converted to JPEG at high quality before sending to service. - :param wait: How long to poll (in seconds) for a confident answer. This is a client-side timeout. Default is 30.0. - Set to 0 for async operation. + :param wait: How long to poll (in seconds) for a confident answer. This is a client-side timeout. + Default is 30.0. Set to 0 for async operation. :param patience_time: How long to wait (in seconds) for a confident answer for this image query. The longer the patience_time, the more likely Groundlight will arrive at a confident answer. Within patience_time, Groundlight will update ML predictions based on stronger findings, diff --git a/src/groundlight/experimental_api.py b/src/groundlight/experimental_api.py index 5519e9a5..aac00fa5 100644 --- a/src/groundlight/experimental_api.py +++ b/src/groundlight/experimental_api.py @@ -399,12 +399,13 @@ def create_note( params = {"detector_id": det_id} headers = {"x-api-token": self.configuration.api_key["ApiToken"]} - response = requests.post(url, headers=headers, data=data, files=files, params=params) + response = requests.post(url, headers=headers, data=data, files=files, params=params) # type: ignore response.raise_for_status() # Raise an exception for error status codes def create_detector_group(self, name: str) -> DetectorGroup: """ - Creates a detector group with the given name. A detector group allows you to organize related detectors together. + Creates a detector group with the given name. A detector group allows you to organize + related detectors together. .. note:: You can specify a detector group when creating a detector without the need to create it ahead of time. diff --git a/src/groundlight/internalapi.py b/src/groundlight/internalapi.py index 91fea60c..f5a2e45b 100644 --- a/src/groundlight/internalapi.py +++ b/src/groundlight/internalapi.py @@ -65,7 +65,7 @@ def iq_is_confident(iq: ImageQuery, confidence_threshold: float) -> bool: The only subtlety here is that currently confidence of None means human label, which is treated as confident. """ - return iq.result.confidence >= confidence_threshold + return iq.result.confidence >= confidence_threshold # type: ignore def iq_is_answered(iq: ImageQuery) -> bool: