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,13 +6,14 @@ 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
if TYPE_CHECKING:
from spandrel import ImageModelDescriptor
from comfy.clip_vision import ClipVisionModel from comfy.clip_vision import ClipVisionModel
from comfy.clip_vision import Output as ClipVisionOutput_ from comfy.clip_vision import Output as ClipVisionOutput_
from comfy.controlnet import ControlNet from comfy.controlnet import ControlNet
@ -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")