mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-12-16 17:42:58 +08:00
fix(api-nodes): enable more pylint rules (#10213)
This commit is contained in:
parent
6bd3f8eb9f
commit
6ae3515801
@ -152,7 +152,7 @@ def validate_aspect_ratio(
|
|||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"Aspect ratio cannot reduce to any less than {minimum_ratio_str} ({minimum_ratio}), but was {aspect_ratio} ({calculated_ratio})."
|
f"Aspect ratio cannot reduce to any less than {minimum_ratio_str} ({minimum_ratio}), but was {aspect_ratio} ({calculated_ratio})."
|
||||||
)
|
)
|
||||||
elif calculated_ratio > maximum_ratio:
|
if calculated_ratio > maximum_ratio:
|
||||||
raise TypeError(
|
raise TypeError(
|
||||||
f"Aspect ratio cannot reduce to any greater than {maximum_ratio_str} ({maximum_ratio}), but was {aspect_ratio} ({calculated_ratio})."
|
f"Aspect ratio cannot reduce to any greater than {maximum_ratio_str} ({maximum_ratio}), but was {aspect_ratio} ({calculated_ratio})."
|
||||||
)
|
)
|
||||||
|
|||||||
@ -473,7 +473,7 @@ class MoonvalleyImg2VideoNode(comfy_io.ComfyNode):
|
|||||||
height=width_height["height"],
|
height=width_height["height"],
|
||||||
use_negative_prompts=True,
|
use_negative_prompts=True,
|
||||||
)
|
)
|
||||||
"""Upload image to comfy backend to have a URL available for further processing"""
|
|
||||||
# Get MIME type from tensor - assuming PNG format for image tensors
|
# Get MIME type from tensor - assuming PNG format for image tensors
|
||||||
mime_type = "image/png"
|
mime_type = "image/png"
|
||||||
|
|
||||||
@ -591,7 +591,6 @@ class MoonvalleyVideo2VideoNode(comfy_io.ComfyNode):
|
|||||||
validated_video = validate_video_to_video_input(video)
|
validated_video = validate_video_to_video_input(video)
|
||||||
video_url = await upload_video_to_comfyapi(validated_video, auth_kwargs=auth)
|
video_url = await upload_video_to_comfyapi(validated_video, auth_kwargs=auth)
|
||||||
|
|
||||||
"""Validate prompts and inference input"""
|
|
||||||
validate_prompts(prompt, negative_prompt)
|
validate_prompts(prompt, negative_prompt)
|
||||||
|
|
||||||
# Only include motion_intensity for Motion Transfer
|
# Only include motion_intensity for Motion Transfer
|
||||||
|
|||||||
@ -107,7 +107,7 @@ def recraft_multipart_parser(data, parent_key=None, formatter: callable=None, co
|
|||||||
# if list already exists exists, just extend list with data
|
# if list already exists exists, just extend list with data
|
||||||
for check_list in lists_to_check:
|
for check_list in lists_to_check:
|
||||||
for conv_tuple in check_list:
|
for conv_tuple in check_list:
|
||||||
if conv_tuple[0] == parent_key and type(conv_tuple[1]) is list:
|
if conv_tuple[0] == parent_key and isinstance(conv_tuple[1], list):
|
||||||
conv_tuple[1].append(formatter(data))
|
conv_tuple[1].append(formatter(data))
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
@ -119,7 +119,7 @@ def recraft_multipart_parser(data, parent_key=None, formatter: callable=None, co
|
|||||||
if formatter is None:
|
if formatter is None:
|
||||||
formatter = lambda v: v # Multipart representation of value
|
formatter = lambda v: v # Multipart representation of value
|
||||||
|
|
||||||
if type(data) is not dict:
|
if not isinstance(data, dict):
|
||||||
# if list already exists exists, just extend list with data
|
# if list already exists exists, just extend list with data
|
||||||
added = handle_converted_lists(data, parent_key, converted_to_check)
|
added = handle_converted_lists(data, parent_key, converted_to_check)
|
||||||
if added:
|
if added:
|
||||||
@ -136,9 +136,9 @@ def recraft_multipart_parser(data, parent_key=None, formatter: callable=None, co
|
|||||||
|
|
||||||
for key, value in data.items():
|
for key, value in data.items():
|
||||||
current_key = key if parent_key is None else f"{parent_key}[{key}]"
|
current_key = key if parent_key is None else f"{parent_key}[{key}]"
|
||||||
if type(value) is dict:
|
if isinstance(value, dict):
|
||||||
converted.extend(recraft_multipart_parser(value, current_key, formatter, next_check).items())
|
converted.extend(recraft_multipart_parser(value, current_key, formatter, next_check).items())
|
||||||
elif type(value) is list:
|
elif isinstance(value, list):
|
||||||
for ind, list_value in enumerate(value):
|
for ind, list_value in enumerate(value):
|
||||||
iter_key = f"{current_key}[]"
|
iter_key = f"{current_key}[]"
|
||||||
converted.extend(recraft_multipart_parser(list_value, iter_key, formatter, next_check, is_list=True).items())
|
converted.extend(recraft_multipart_parser(list_value, iter_key, formatter, next_check, is_list=True).items())
|
||||||
|
|||||||
@ -57,18 +57,14 @@ messages_control.disable = [
|
|||||||
"redefined-builtin",
|
"redefined-builtin",
|
||||||
"unnecessary-lambda",
|
"unnecessary-lambda",
|
||||||
"dangerous-default-value",
|
"dangerous-default-value",
|
||||||
|
"invalid-overridden-method",
|
||||||
# next warnings should be fixed in future
|
# next warnings should be fixed in future
|
||||||
"bad-classmethod-argument", # Class method should have 'cls' as first argument
|
"bad-classmethod-argument", # Class method should have 'cls' as first argument
|
||||||
"wrong-import-order", # Standard imports should be placed before third party imports
|
"wrong-import-order", # Standard imports should be placed before third party imports
|
||||||
"logging-fstring-interpolation", # Use lazy % formatting in logging functions
|
"logging-fstring-interpolation", # Use lazy % formatting in logging functions
|
||||||
"ungrouped-imports",
|
"ungrouped-imports",
|
||||||
"unnecessary-pass",
|
"unnecessary-pass",
|
||||||
"unidiomatic-typecheck",
|
|
||||||
"unnecessary-lambda-assignment",
|
"unnecessary-lambda-assignment",
|
||||||
"no-else-return",
|
"no-else-return",
|
||||||
"no-else-raise",
|
|
||||||
"invalid-overridden-method",
|
|
||||||
"unused-variable",
|
"unused-variable",
|
||||||
"pointless-string-statement",
|
|
||||||
"redefined-outer-name",
|
|
||||||
]
|
]
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user