1
mirror of https://github.com/comfyanonymous/ComfyUI.git synced 2025-08-03 07:26:31 +08:00

Adding TYPE_CHECKING ifs into _io.py to try to clean up failing CI

This commit is contained in:
Jedrzej Kosinski
2025-07-30 14:59:15 -07:00
parent fafe53ece8
commit babd7bbf00

View File

@@ -6,22 +6,23 @@ from abc import ABC, abstractmethod
from collections import Counter from collections import Counter
from dataclasses import asdict, dataclass from dataclasses import asdict, dataclass
from enum import Enum from enum import Enum
from typing import Any, Callable, Literal, TypedDict, TypeVar from typing import Any, Callable, Literal, TypedDict, TypeVar, TYPE_CHECKING
from typing_extensions import NotRequired, final
# used for type hinting # used for type hinting
import torch import torch
from spandrel import ImageModelDescriptor
from typing_extensions import NotRequired, final
from comfy.clip_vision import ClipVisionModel if TYPE_CHECKING:
from comfy.clip_vision import Output as ClipVisionOutput_ from spandrel import ImageModelDescriptor
from comfy.controlnet import ControlNet from comfy.clip_vision import ClipVisionModel
from comfy.hooks import HookGroup, HookKeyframeGroup from comfy.clip_vision import Output as ClipVisionOutput_
from comfy.model_patcher import ModelPatcher from comfy.controlnet import ControlNet
from comfy.samplers import CFGGuider, Sampler from comfy.hooks import HookGroup, HookKeyframeGroup
from comfy.sd import CLIP, VAE from comfy.model_patcher import ModelPatcher
from comfy.sd import StyleModel as StyleModel_ from comfy.samplers import CFGGuider, Sampler
from comfy_api.input import VideoInput from comfy.sd import CLIP, VAE
from comfy.sd import StyleModel as StyleModel_
from comfy_api.input import VideoInput
from comfy_api.internal import (_ComfyNodeInternal, _NodeOutputInternal, classproperty, copy_class, first_real_override, is_class, from comfy_api.internal import (_ComfyNodeInternal, _NodeOutputInternal, classproperty, copy_class, first_real_override, is_class,
prune_dict, shallow_clone_class) prune_dict, shallow_clone_class)
from comfy_api.latest._resources import Resources, ResourcesLocal from comfy_api.latest._resources import Resources, ResourcesLocal
@@ -543,6 +544,7 @@ class Conditioning(ComfyTypeIO):
@comfytype(io_type="SAMPLER") @comfytype(io_type="SAMPLER")
class Sampler(ComfyTypeIO): class Sampler(ComfyTypeIO):
if TYPE_CHECKING:
Type = Sampler Type = Sampler
@comfytype(io_type="SIGMAS") @comfytype(io_type="SIGMAS")
@@ -555,43 +557,53 @@ class Noise(ComfyTypeIO):
@comfytype(io_type="GUIDER") @comfytype(io_type="GUIDER")
class Guider(ComfyTypeIO): class Guider(ComfyTypeIO):
if TYPE_CHECKING:
Type = CFGGuider Type = CFGGuider
@comfytype(io_type="CLIP") @comfytype(io_type="CLIP")
class Clip(ComfyTypeIO): class Clip(ComfyTypeIO):
if TYPE_CHECKING:
Type = CLIP Type = CLIP
@comfytype(io_type="CONTROL_NET") @comfytype(io_type="CONTROL_NET")
class ControlNet(ComfyTypeIO): class ControlNet(ComfyTypeIO):
if TYPE_CHECKING:
Type = ControlNet Type = ControlNet
@comfytype(io_type="VAE") @comfytype(io_type="VAE")
class Vae(ComfyTypeIO): class Vae(ComfyTypeIO):
if TYPE_CHECKING:
Type = VAE Type = VAE
@comfytype(io_type="MODEL") @comfytype(io_type="MODEL")
class Model(ComfyTypeIO): class Model(ComfyTypeIO):
if TYPE_CHECKING:
Type = ModelPatcher Type = ModelPatcher
@comfytype(io_type="CLIP_VISION") @comfytype(io_type="CLIP_VISION")
class ClipVision(ComfyTypeIO): class ClipVision(ComfyTypeIO):
if TYPE_CHECKING:
Type = ClipVisionModel Type = ClipVisionModel
@comfytype(io_type="CLIP_VISION_OUTPUT") @comfytype(io_type="CLIP_VISION_OUTPUT")
class ClipVisionOutput(ComfyTypeIO): class ClipVisionOutput(ComfyTypeIO):
if TYPE_CHECKING:
Type = ClipVisionOutput_ Type = ClipVisionOutput_
@comfytype(io_type="STYLE_MODEL") @comfytype(io_type="STYLE_MODEL")
class StyleModel(ComfyTypeIO): class StyleModel(ComfyTypeIO):
if TYPE_CHECKING:
Type = StyleModel_ Type = StyleModel_
@comfytype(io_type="GLIGEN") @comfytype(io_type="GLIGEN")
class Gligen(ComfyTypeIO): class Gligen(ComfyTypeIO):
'''ModelPatcher that wraps around a 'Gligen' model.''' '''ModelPatcher that wraps around a 'Gligen' model.'''
if TYPE_CHECKING:
Type = ModelPatcher Type = ModelPatcher
@comfytype(io_type="UPSCALE_MODEL") @comfytype(io_type="UPSCALE_MODEL")
class UpscaleModel(ComfyTypeIO): class UpscaleModel(ComfyTypeIO):
if TYPE_CHECKING:
Type = ImageModelDescriptor Type = ImageModelDescriptor
@comfytype(io_type="AUDIO") @comfytype(io_type="AUDIO")
@@ -603,6 +615,7 @@ class Audio(ComfyTypeIO):
@comfytype(io_type="VIDEO") @comfytype(io_type="VIDEO")
class Video(ComfyTypeIO): class Video(ComfyTypeIO):
if TYPE_CHECKING:
Type = VideoInput Type = VideoInput
@comfytype(io_type="SVG") @comfytype(io_type="SVG")
@@ -629,10 +642,12 @@ class Mesh(ComfyTypeIO):
@comfytype(io_type="HOOKS") @comfytype(io_type="HOOKS")
class Hooks(ComfyTypeIO): class Hooks(ComfyTypeIO):
if TYPE_CHECKING:
Type = HookGroup Type = HookGroup
@comfytype(io_type="HOOK_KEYFRAMES") @comfytype(io_type="HOOK_KEYFRAMES")
class HookKeyframes(ComfyTypeIO): class HookKeyframes(ComfyTypeIO):
if TYPE_CHECKING:
Type = HookKeyframeGroup Type = HookKeyframeGroup
@comfytype(io_type="TIMESTEPS_RANGE") @comfytype(io_type="TIMESTEPS_RANGE")