The most powerful and modular diffusion model GUI, api and backend with a graph/nodes interface. The fastest local inference engine in the world.
fix(api-nodes): bad indentation in Recraft API node function (#10175)
Alexander Piskunc2c5a7d5f805
diff --git a/comfy_api_nodes/nodes_recraft.py b/comfy_api_nodes/nodes_recraft.pyindex c8516b368..a006104b7 100644--- a/comfy_api_nodes/nodes_recraft.py+++ b/comfy_api_nodes/nodes_recraft.py@@ -38,48 +38,48 @@ from PIL import UnidentifiedImageErrorasync def handle_recraft_file_request(- image: torch.Tensor,- path: str,- mask: torch.Tensor=None,- total_pixels=4096*4096,- timeout=1024,- request=None,- auth_kwargs: dict[str,str] = None,- ) -> list[BytesIO]:- """- Handle sending common Recraft file-only request to get back file bytes.- """- if request is None:- request = EmptyRequest()-- files = {- 'image': tensor_to_bytesio(image, total_pixels=total_pixels).read()- }- if mask is not None:- files['mask'] = tensor_to_bytesio(mask, total_pixels=total_pixels).read()-- operation = SynchronousOperation(- endpoint=ApiEndpoint(- path=path,- method=HttpMethod.POST,- request_model=type(request),- response_model=RecraftImageGenerationResponse,- ),- request=request,- files=files,- content_type="multipart/form-data",- auth_kwargs=auth_kwargs,- multipart_parser=recraft_multipart_parser,- )- response: RecraftImageGenerationResponse = await operation.execute()- all_bytesio = []- if response.image is not None:- all_bytesio.append(await download_url_to_bytesio(response.image.url, timeout=timeout))- else:- for data in response.data:- all_bytesio.append(await download_url_to_bytesio(data.url, timeout=timeout))+ image: torch.Tensor,+ path: str,+ mask: torch.Tensor=None,+ total_pixels=4096*4096,+ timeout=1024,+ request=None,+ auth_kwargs: dict[str,str] = None,+) -> list[BytesIO]:+ """+ Handle sending common Recraft file-only request to get back file bytes.+ """+ if request is None:+ request = EmptyRequest()++ files = {+ 'image': tensor_to_bytesio(image, total_pixels=total_pixels).read()+ }+ if mask is not None:+ files['mask'] = tensor_to_bytesio(mask, total_pixels=total_pixels).read()++ operation = SynchronousOperation(+ endpoint=ApiEndpoint(+ path=path,+ method=HttpMethod.POST,+ request_model=type(request),+ response_model=RecraftImageGenerationResponse,+ ),+ request=request,+ files=files,+ content_type="multipart/form-data",+ auth_kwargs=auth_kwargs,+ multipart_parser=recraft_multipart_parser,+ )+ response: RecraftImageGenerationResponse = await operation.execute()+ all_bytesio = []+ if response.image is not None:+ all_bytesio.append(await download_url_to_bytesio(response.image.url, timeout=timeout))+ else:+ for data in response.data:+ all_bytesio.append(await download_url_to_bytesio(data.url, timeout=timeout))- return all_bytesio+ return all_bytesiodef recraft_multipart_parser(data, parent_key=None, formatter: callable=None, converted_to_check: list[list]=None, is_list=False) -> dict:diff --git a/pyproject.toml b/pyproject.tomlindex 7952f7f37..240919a43 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -65,7 +65,6 @@ messages_control.disable = ["unnecessary-pass","unidiomatic-typecheck","unnecessary-lambda-assignment",- "bad-indentation","no-else-return","no-else-raise","invalid-overridden-method",