Skip to content

Commit 22f99fb

Browse files
authored
fix(api-nodes): enable 2 more pylint rules, removed non needed code (#10192)
1 parent bbd6830 commit 22f99fb

File tree

3 files changed

+4
-50
lines changed

3 files changed

+4
-50
lines changed

comfy_api_nodes/nodes_gemini.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
tensor_to_base64_string,
4040
bytesio_to_image_tensor,
4141
)
42+
from comfy_api.util import VideoContainer, VideoCodec
4243

4344

4445
GEMINI_BASE_ENDPOINT = "/proxy/vertexai/gemini"
@@ -310,7 +311,7 @@ def create_video_parts(self, video_input: IO.VIDEO, **kwargs) -> list[GeminiPart
310311
Returns:
311312
List of GeminiPart objects containing the encoded video.
312313
"""
313-
from comfy_api.util import VideoContainer, VideoCodec
314+
314315
base_64_string = video_to_base64_string(
315316
video_input,
316317
container_format=VideoContainer.MP4,

comfy_api_nodes/nodes_moonvalley.py

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
from typing import Any, Callable, Optional, TypeVar
33
import torch
44
from typing_extensions import override
5-
from comfy_api_nodes.util.validation_utils import (
6-
get_image_dimensions,
7-
validate_image_dimensions,
8-
)
9-
5+
from comfy_api_nodes.util.validation_utils import validate_image_dimensions
106

117
from comfy_api_nodes.apis import (
128
MoonvalleyTextToVideoRequest,
@@ -132,47 +128,6 @@ def validate_prompts(
132128
return True
133129

134130

135-
def validate_input_media(width, height, with_frame_conditioning, num_frames_in=None):
136-
# inference validation
137-
# T = num_frames
138-
# in all cases, the following must be true: T divisible by 16 and H,W by 8. in addition...
139-
# with image conditioning: H*W must be divisible by 8192
140-
# without image conditioning: T divisible by 32
141-
if num_frames_in and not num_frames_in % 16 == 0:
142-
return False, ("The input video total frame count must be divisible by 16!")
143-
144-
if height % 8 != 0 or width % 8 != 0:
145-
return False, (
146-
f"Height ({height}) and width ({width}) must be " "divisible by 8"
147-
)
148-
149-
if with_frame_conditioning:
150-
if (height * width) % 8192 != 0:
151-
return False, (
152-
f"Height * width ({height * width}) must be "
153-
"divisible by 8192 for frame conditioning"
154-
)
155-
else:
156-
if num_frames_in and not num_frames_in % 32 == 0:
157-
return False, ("The input video total frame count must be divisible by 32!")
158-
159-
160-
def validate_input_image(
161-
image: torch.Tensor, with_frame_conditioning: bool = False
162-
) -> None:
163-
"""
164-
Validates the input image adheres to the expectations of the API:
165-
- The image resolution should not be less than 300*300px
166-
- The aspect ratio of the image should be between 1:2.5 ~ 2.5:1
167-
168-
"""
169-
height, width = get_image_dimensions(image)
170-
validate_input_media(width, height, with_frame_conditioning)
171-
validate_image_dimensions(
172-
image, min_width=300, min_height=300, max_height=MAX_HEIGHT, max_width=MAX_WIDTH
173-
)
174-
175-
176131
def validate_video_to_video_input(video: VideoInput) -> VideoInput:
177132
"""
178133
Validates and processes video input for Moonvalley Video-to-Video generation.
@@ -499,7 +454,7 @@ async def execute(
499454
seed: int,
500455
steps: int,
501456
) -> comfy_io.NodeOutput:
502-
validate_input_image(image, True)
457+
validate_image_dimensions(image, min_width=300, min_height=300, max_height=MAX_HEIGHT, max_width=MAX_WIDTH)
503458
validate_prompts(prompt, negative_prompt, MOONVALLEY_MAREY_MAX_PROMPT_LENGTH)
504459
width_height = parse_width_height_from_res(resolution)
505460

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,5 @@ messages_control.disable = [
7070
"invalid-overridden-method",
7171
"unused-variable",
7272
"pointless-string-statement",
73-
"inconsistent-return-statements",
74-
"import-outside-toplevel",
7573
"redefined-outer-name",
7674
]

0 commit comments

Comments
 (0)