Skip to content

Commit

Permalink
Fix linters (sync)
Browse files Browse the repository at this point in the history
  • Loading branch information
wwakabobik committed Oct 1, 2024
1 parent fe5b19d commit eddde38
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/leonardo_api/leonardo_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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

0 comments on commit eddde38

Please sign in to comment.