diff --git a/src/leonardo_api/leonardo_sync.py b/src/leonardo_api/leonardo_sync.py index b50f6b6..0c47b8f 100644 --- a/src/leonardo_api/leonardo_sync.py +++ b/src/leonardo_api/leonardo_sync.py @@ -288,11 +288,11 @@ def upload_init_image(self, file_path: str) -> str: valid_extensions = ["png", "jpg", "jpeg", "webp"] extension = os.path.splitext(file_path)[1].strip(".") if extension not in valid_extensions: - raise ValueError("Invalid file extension. Must be one of %s", valid_extensions) + raise ValueError(f"Invalid file extension. Must be one of {valid_extensions}") url = "https://cloud.leonardo.ai/api/rest/v1/init-image" payload = {"extension": extension} - self.__logger.debug(f"Init image %s upload requested with payload = %s: POST %s", file_path, payload, url) + self.__logger.debug("Init image %s upload requested with payload = %s: POST %s", file_path, payload, url) session = self.___get_client_session("post") try: response = session.post(url, json=payload) @@ -327,7 +327,7 @@ def get_single_init_image(self, image_id: str) -> dict: :rtype: dict """ url = f"https://cloud.leonardo.ai/api/rest/v1/init-image/{image_id}" - self.__logger.debug(f"Requested single image with image_id=%s: GET %s", image_id, url) + self.__logger.debug("Requested single image with image_id=%s: GET %s", image_id, url) session = self.___get_client_session("get") try: response = session.get(url) @@ -583,7 +583,7 @@ def upload_generated_image_to_dataset(self, dataset_id: str, generated_image_id: self.__logger.error("Error occurred while upload generated image to dataset: %s", str(error)) raise error - def train_custom_model( + def train_custom_model( # pylint: disable=too-many-positional-arguments self, name: str, dataset_id: str, @@ -734,6 +734,6 @@ def wait_for_image_generation( time.sleep(poll_interval) if timeout_counter >= (timeout / poll_interval): - raise TimeoutError("Image has not been generated in %s seconds", timeout) + raise TimeoutError(f"Image has not been generated in {timeout} seconds") timeout_counter += 1