Skip to content

Commit c2c5a7d

Browse files
authored
fix(api-nodes): bad indentation in Recraft API node function (#10175)
1 parent 8a29337 commit c2c5a7d

File tree

2 files changed

+41
-42
lines changed

2 files changed

+41
-42
lines changed

comfy_api_nodes/nodes_recraft.py

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -38,48 +38,48 @@
3838

3939

4040
async def handle_recraft_file_request(
41-
image: torch.Tensor,
42-
path: str,
43-
mask: torch.Tensor=None,
44-
total_pixels=4096*4096,
45-
timeout=1024,
46-
request=None,
47-
auth_kwargs: dict[str,str] = None,
48-
) -> list[BytesIO]:
49-
"""
50-
Handle sending common Recraft file-only request to get back file bytes.
51-
"""
52-
if request is None:
53-
request = EmptyRequest()
54-
55-
files = {
56-
'image': tensor_to_bytesio(image, total_pixels=total_pixels).read()
57-
}
58-
if mask is not None:
59-
files['mask'] = tensor_to_bytesio(mask, total_pixels=total_pixels).read()
60-
61-
operation = SynchronousOperation(
62-
endpoint=ApiEndpoint(
63-
path=path,
64-
method=HttpMethod.POST,
65-
request_model=type(request),
66-
response_model=RecraftImageGenerationResponse,
67-
),
68-
request=request,
69-
files=files,
70-
content_type="multipart/form-data",
71-
auth_kwargs=auth_kwargs,
72-
multipart_parser=recraft_multipart_parser,
73-
)
74-
response: RecraftImageGenerationResponse = await operation.execute()
75-
all_bytesio = []
76-
if response.image is not None:
77-
all_bytesio.append(await download_url_to_bytesio(response.image.url, timeout=timeout))
78-
else:
79-
for data in response.data:
80-
all_bytesio.append(await download_url_to_bytesio(data.url, timeout=timeout))
41+
image: torch.Tensor,
42+
path: str,
43+
mask: torch.Tensor=None,
44+
total_pixels=4096*4096,
45+
timeout=1024,
46+
request=None,
47+
auth_kwargs: dict[str,str] = None,
48+
) -> list[BytesIO]:
49+
"""
50+
Handle sending common Recraft file-only request to get back file bytes.
51+
"""
52+
if request is None:
53+
request = EmptyRequest()
54+
55+
files = {
56+
'image': tensor_to_bytesio(image, total_pixels=total_pixels).read()
57+
}
58+
if mask is not None:
59+
files['mask'] = tensor_to_bytesio(mask, total_pixels=total_pixels).read()
60+
61+
operation = SynchronousOperation(
62+
endpoint=ApiEndpoint(
63+
path=path,
64+
method=HttpMethod.POST,
65+
request_model=type(request),
66+
response_model=RecraftImageGenerationResponse,
67+
),
68+
request=request,
69+
files=files,
70+
content_type="multipart/form-data",
71+
auth_kwargs=auth_kwargs,
72+
multipart_parser=recraft_multipart_parser,
73+
)
74+
response: RecraftImageGenerationResponse = await operation.execute()
75+
all_bytesio = []
76+
if response.image is not None:
77+
all_bytesio.append(await download_url_to_bytesio(response.image.url, timeout=timeout))
78+
else:
79+
for data in response.data:
80+
all_bytesio.append(await download_url_to_bytesio(data.url, timeout=timeout))
8181

82-
return all_bytesio
82+
return all_bytesio
8383

8484

8585
def recraft_multipart_parser(data, parent_key=None, formatter: callable=None, converted_to_check: list[list]=None, is_list=False) -> dict:

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ messages_control.disable = [
6565
"unnecessary-pass",
6666
"unidiomatic-typecheck",
6767
"unnecessary-lambda-assignment",
68-
"bad-indentation",
6968
"no-else-return",
7069
"no-else-raise",
7170
"invalid-overridden-method",

0 commit comments

Comments
 (0)