proper type of INPUT_TYPES return

This commit is contained in:
Alexander G. Morano
2025-03-17 18:37:30 -04:00
parent 81bf0a201a
commit 00a4b79fd3
10 changed files with 169 additions and 117 deletions
+3 -1
View File
@@ -47,7 +47,7 @@ import importlib
from pathlib import Path
from string import Template
from types import ModuleType
from typing import Any, Dict, List, Literal, Tuple
from typing import Any, Dict, List, Literal, Tuple, TypeAlias
try:
from markdownify import markdownify
@@ -121,6 +121,8 @@ class AnyType(str):
JOV_TYPE_ANY = AnyType("*")
InputType: TypeAlias = Dict[str, Tuple[str|List[str], Dict[str, Any]]]
# want to make explicit entries; comfy only looks for single type
JOV_TYPE_NUMBER = "BOOLEAN,FLOAT,INT"
JOV_TYPE_VECTOR = "VEC2,VEC3,VEC4,VEC2INT,VEC3INT,VEC4INT,COORD2D,COORD3D"
+23 -19
View File
@@ -7,7 +7,7 @@ import sys
import math
import random
from enum import Enum
from typing import Any, Dict, List, Tuple
from typing import Any, List, Tuple
from collections import Counter
import torch
@@ -17,14 +17,18 @@ from loguru import logger
from comfy.utils import ProgressBar
from .. import JOV_TYPE_ANY, JOV_TYPE_FULL, JOV_TYPE_NUMBER, JOV_TYPE_NUMERICAL, \
Lexicon, JOVBaseNode, \
from .. import \
JOV_TYPE_ANY, JOV_TYPE_FULL, JOV_TYPE_NUMBER, JOV_TYPE_NUMERICAL, \
InputType, Lexicon, JOVBaseNode, \
comfy_api_post, deep_merge, parse_reset
from ..sup.util import EnumConvertType, EnumSwizzle, \
from ..sup.util import \
EnumConvertType, EnumSwizzle, \
parse_dynamic, parse_param, parse_value, vector_swap, zip_longest_fill
from ..sup.anim import EnumWave, EnumEase, ease_op, wave_op
from ..sup.anim import \
EnumWave, EnumEase, \
ease_op, wave_op
# ==============================================================================
@@ -217,7 +221,7 @@ STRING is treated as a list of CHARACTER.
IMAGE and MASK will return a TRUE bit for any non-black pixel, as a stream of bits for all pixels in the image.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -270,7 +274,7 @@ Perform single function operations like absolute value, mean, median, mode, magn
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -372,7 +376,7 @@ Execute binary operations like addition, subtraction, multiplication, division,
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
names_convert = EnumConvertType._member_names_[:10]
d = super().INPUT_TYPES()
d = deep_merge(d, {
@@ -514,7 +518,7 @@ Evaluates two inputs (A and B) with a specified comparison operators and optiona
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -636,7 +640,7 @@ Additionally, you can specify the easing function (EASE) and the desired output
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
names_convert = EnumConvertType._member_names_[:10]
d = deep_merge(d, {
@@ -721,7 +725,7 @@ Manipulate strings through filtering
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -786,7 +790,7 @@ Swap components between two vectors based on specified swizzle patterns and valu
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
names_convert = EnumConvertType._member_names_[3:10]
d = deep_merge(d, {
@@ -841,7 +845,7 @@ A timer and frame counter, emitting pulses or signals based on time intervals. I
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -931,7 +935,7 @@ Supplies raw or default values for various data types, supporting vector input w
UPDATE = False
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
typ = EnumConvertType._member_names_
@@ -1049,7 +1053,7 @@ Produce waveforms like sine, square, or sawtooth with adjustable frequency, ampl
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -1103,7 +1107,7 @@ Outputs a VEC2 or VEC2INT.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -1141,7 +1145,7 @@ Outputs a VEC3 or VEC3INT.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -1182,7 +1186,7 @@ Outputs a VEC4 or VEC4INT.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -1223,7 +1227,7 @@ class ParameterNode(JOVBaseNode):
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
+35 -27
View File
@@ -3,7 +3,7 @@ Jovimetrix - Composition
"""
from enum import Enum
from typing import Any, Dict, List, Tuple
from typing import Any, List, Tuple
import cv2
import torch
@@ -13,38 +13,46 @@ from loguru import logger
from comfy.utils import ProgressBar
from .. import JOV_TYPE_IMAGE, \
JOVBaseNode, JOVImageNode, Lexicon, \
from .. import \
JOV_TYPE_IMAGE, \
JOVBaseNode, JOVImageNode, Lexicon, InputType, \
deep_merge
from ..sup.util import EnumConvertType, \
from ..sup.util import \
EnumConvertType, \
parse_dynamic, parse_param, zip_longest_fill
from ..sup.image import MIN_IMAGE_SIZE, \
from ..sup.image import \
MIN_IMAGE_SIZE, \
EnumImageType, \
image_mask, image_mask_add, image_matte, image_minmax, image_convert, \
cv2tensor, cv2tensor_full, tensor2cv
from ..sup.image.color import EnumCBDeficiency, EnumCBSimulator, EnumColorMap, EnumColorTheory, \
from ..sup.image.color import \
EnumCBDeficiency, EnumCBSimulator, EnumColorMap, EnumColorTheory, \
color_lut_full, color_lut_match, color_lut_palette, \
color_lut_tonal, color_lut_visualize, color_match_reinhard, color_theory, color_blind, \
color_top_used, image_gradient_expand, image_gradient_map, pixel_eval
from ..sup.image.adjust import EnumEdge, EnumMirrorMode, EnumScaleMode, \
from ..sup.image.adjust import \
EnumEdge, EnumMirrorMode, EnumScaleMode, \
EnumInterpolation, EnumThreshold, EnumThresholdAdapt, \
image_contrast, image_edge_wrap, image_equalize, image_filter, image_gamma, \
image_hsv, image_invert, image_mirror, image_pixelate, image_posterize, \
image_quantize, image_scalefit, image_sharpen, image_swap_channels, \
image_transform, image_flatten, image_threshold, morph_edge_detect, morph_emboss
from ..sup.image.channel import EnumPixelSwizzle, \
from ..sup.image.channel import \
EnumPixelSwizzle, \
channel_merge, channel_solid
from ..sup.image.compose import EnumAdjustOP, EnumBlendType, EnumOrientation, \
from ..sup.image.compose import \
EnumAdjustOP, EnumBlendType, EnumOrientation, \
image_levels, image_split, image_stack, image_blend, \
image_crop, image_crop_center, image_crop_polygonal
from ..sup.image.mapping import EnumProjection, \
from ..sup.image.mapping import \
EnumProjection, \
remap_fisheye, remap_perspective, remap_polar, remap_sphere
# ==============================================================================
@@ -77,7 +85,7 @@ Enhance and modify images with various effects such as blurring, sharpening, col
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -225,7 +233,7 @@ Combine two input images using various blending modes, such as normal, screen, m
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -314,7 +322,7 @@ Simulate color blindness effects on images. You can select various types of colo
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -351,7 +359,7 @@ Adjust the color scheme of one image to match another with the Color Match Node.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -439,7 +447,7 @@ The top-k colors ordered from most->least used as a strip, tonal palette and 3D
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -497,7 +505,7 @@ Generate a color harmony based on the selected scheme. Supported schemes include
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -536,7 +544,7 @@ Extract a portion of an input image or resize it. It supports various cropping m
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -600,7 +608,7 @@ Create masks based on specific color ranges within an image. Specify the color r
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -645,7 +653,7 @@ Combine multiple input images into a single image by summing their pixel values.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -688,7 +696,7 @@ Remaps an input image using a gradient lookup table (LUT). The gradient image wi
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -740,7 +748,7 @@ Combines individual color channels (red, green, blue) along with an optional mas
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -825,7 +833,7 @@ Takes an input image and splits it into its individual color channels (red, gree
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -853,7 +861,7 @@ Swap pixel values between two input images based on specified channel swizzle op
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -918,7 +926,7 @@ Merge multiple input images into a single composite image by stacking them along
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -962,7 +970,7 @@ Define a range and apply it to an image for segmentation and feature extraction.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -1005,7 +1013,7 @@ Apply various geometric transformations to images, including translation, rotati
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -1109,7 +1117,7 @@ The Histogram Node generates a histogram representation of the input image, show
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
+21 -14
View File
@@ -2,7 +2,7 @@
Jovimetrix - Creation
"""
from typing import Dict, Tuple
from typing import Tuple
import torch
import numpy as np
@@ -11,27 +11,34 @@ from skimage.filters import gaussian
from comfy.utils import ProgressBar
from .. import JOV_TYPE_IMAGE, \
JOVBaseNode, JOVImageNode, Lexicon, \
from .. import \
JOV_TYPE_IMAGE, \
InputType, JOVBaseNode, JOVImageNode, Lexicon, \
deep_merge
from ..sup.util import EnumConvertType, \
from ..sup.util import \
EnumConvertType, \
parse_param, zip_longest_fill
from ..sup.image import MIN_IMAGE_SIZE, EnumImageType, image_convert, image_mask, \
image_mask_add, image_matte, cv2tensor, cv2tensor_full, tensor2cv, pil2cv
from ..sup.image import \
MIN_IMAGE_SIZE, \
EnumImageType, \
image_convert, image_mask_add, image_matte, cv2tensor, cv2tensor_full, tensor2cv, pil2cv
from ..sup.image.channel import channel_solid
from ..sup.image.compose import EnumShapes, \
from ..sup.image.compose import \
EnumShapes, \
shape_ellipse, shape_polygon, shape_quad, image_mask_binary
from ..sup.image.adjust import EnumEdge, EnumScaleMode, EnumInterpolation, \
from ..sup.image.adjust import \
EnumEdge, EnumScaleMode, EnumInterpolation, \
image_invert, image_rotate, image_scalefit, image_transform, image_translate
from ..sup.image.mapping import image_stereogram
from ..sup.text import EnumAlignment, EnumJustify, \
from ..sup.text import \
EnumAlignment, EnumJustify, \
font_names, text_autosize, text_draw
# ==============================================================================
@@ -48,7 +55,7 @@ Generate a constant image or mask of a specified size and color. It can be used
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -103,7 +110,7 @@ Create n-sided polygons. These shapes can be customized by adjusting parameters
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -174,7 +181,7 @@ Generates false perception 3D images from 2D input. Set tile divisions, noise, g
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -220,7 +227,7 @@ class StereoscopicNode(JOVBaseNode):
Simulates depth perception in images by generating stereoscopic views. It accepts an optional input image for color matte. Adjust baseline and focal length for customized depth effects.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -258,7 +265,7 @@ Generates images containing text based on parameters such as font, size, alignme
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
+15 -11
View File
@@ -4,7 +4,7 @@ Jovimetrix GLSL Creation
import sys
from pathlib import Path
from typing import Any, Dict, Tuple
from typing import Any, Tuple
import torch
from loguru import logger
@@ -16,21 +16,25 @@ except:
pass
from comfy.utils import ProgressBar
from .. import JOV_TYPE_IMAGE, \
Lexicon, JOVImageNode, \
from .. import \
JOV_TYPE_IMAGE, \
InputType, Lexicon, JOVImageNode, \
comfy_api_post, deep_merge
from ..sup.util import EnumConvertType, \
from ..sup.util import \
EnumConvertType, \
parse_param, parse_value
from ..sup.image.adjust import EnumInterpolation, EnumScaleMode, \
from ..sup.image.adjust import \
EnumInterpolation, EnumScaleMode, \
image_scalefit
from ..sup.image import MIN_IMAGE_SIZE, \
from ..sup.image import \
MIN_IMAGE_SIZE, \
image_convert, tensor2cv, cv2tensor_full
from ..sup.shader import JOV_ROOT_GLSL, GLSL_PROGRAMS, PROG_FRAGMENT, \
PROG_VERTEX, PTYPE, \
from ..sup.shader import \
JOV_ROOT_GLSL, GLSL_PROGRAMS, PROG_FRAGMENT, PROG_VERTEX, PTYPE, \
CompileException, EnumGLSLEdge, GLSLShader, \
shader_meta, load_file_glsl
@@ -85,7 +89,7 @@ class GLSLNodeBase(JOVImageNode):
CATEGORY = f"JOVIMETRIX 🔺🟩🔵/GLSL"
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -180,7 +184,7 @@ Execute custom GLSL (OpenGL Shading Language) fragment shaders to generate image
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
opts = d.get('optional', {})
opts.update({
@@ -202,7 +206,7 @@ class GLSLNodeDynamic(GLSLNodeBase):
PARAM = None
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
original_params = super().INPUT_TYPES()
opts = original_params.get('optional', {})
opts.update({
+14 -9
View File
@@ -6,18 +6,23 @@ Jovimetrix - Device -- MIDI
type 2 (asynchronous): each track is independent of the others
"""
from typing import Dict, Tuple
from typing import Tuple
from math import isclose
from queue import Queue
from comfy.utils import ProgressBar
from .. import JOVBaseNode, Lexicon, deep_merge
from .. import \
InputType, JOVBaseNode, Lexicon, \
deep_merge
from ..sup.util import EnumConvertType, parse_param
from ..sup.util import \
EnumConvertType, \
parse_param
from ..sup.midi import MIDIMessage, MIDINoteOnFilter, MIDIServerThread,\
midi_device_names
from ..sup.midi import \
MIDIMessage, MIDINoteOnFilter, MIDIServerThread, \
midi_device_names
# ==============================================================================
@@ -47,7 +52,7 @@ Processes MIDI messages received from an external MIDI controller or device. It
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -80,7 +85,7 @@ Captures MIDI messages from an external MIDI device or controller. It monitors M
CHANGED = False
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -151,7 +156,7 @@ Provides advanced filtering capabilities for MIDI messages based on various crit
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -256,7 +261,7 @@ Filter MIDI messages based on various criteria, including MIDI mode (such as not
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
+17 -12
View File
@@ -5,7 +5,7 @@ Jovimetrix - Device -- WEBCAM, REMOTE URLS, SPOUT
import sys
import time
import uuid
from typing import Dict, Tuple
from typing import Tuple
from enum import Enum
import cv2
@@ -14,21 +14,25 @@ from loguru import logger
from comfy.utils import ProgressBar
from .. import JOV_DOCKERENV, JOV_TYPE_IMAGE, \
JOVBaseNode, JOVImageNode, Lexicon, \
from .. import \
JOV_DOCKERENV, JOV_TYPE_IMAGE, \
InputType, JOVBaseNode, JOVImageNode, Lexicon, \
deep_merge
from ..sup.util import EnumConvertType, \
from ..sup.util import \
EnumConvertType, \
parse_param, zip_longest_fill
from ..sup.stream import camera_list, monitor_list, window_list, \
monitor_capture, StreamingServer, StreamManager, \
MediaStreamDevice, JOV_SPOUT
from ..sup.stream import \
JOV_SPOUT, \
StreamingServer, StreamManager, MediaStreamDevice, \
camera_list, monitor_list, window_list, monitor_capture
if not JOV_DOCKERENV:
from ..sup.stream import window_capture
from ..sup.image.adjust import EnumScaleMode, EnumInterpolation, \
from ..sup.image.adjust import \
EnumScaleMode, EnumInterpolation, \
image_scalefit
from ..sup.image.channel import channel_solid
@@ -36,7 +40,8 @@ from ..sup.image.channel import channel_solid
if JOV_SPOUT:
from ..sup.stream import SpoutSender, MediaStreamSpout
from ..sup.image import MIN_IMAGE_SIZE, \
from ..sup.image import \
MIN_IMAGE_SIZE, \
EnumImageType, \
image_convert, cv2tensor_full, tensor2cv
@@ -75,7 +80,7 @@ Capture frames from various sources such as URLs, cameras, monitors, windows, or
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
if cls.CAMERAS is None:
@@ -296,7 +301,7 @@ Sends frames to a specified route, typically for live streaming or recording pur
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -367,7 +372,7 @@ Sends frames to a specified Spout receiver application for real-time video shari
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
+15 -9
View File
@@ -10,7 +10,7 @@ import random
from enum import Enum
from pathlib import Path
from itertools import zip_longest
from typing import Any, Dict, List, Literal, Tuple
from typing import Any, List, Literal, Tuple
import torch
import numpy as np
@@ -20,15 +20,21 @@ from loguru import logger
from comfy.utils import ProgressBar
from nodes import interrupt_processing
from ... import JOV_TYPE_ANY, ROOT, Lexicon, JOVBaseNode, deep_merge, \
comfy_api_post, parse_reset
from ... import \
JOV_TYPE_ANY, ROOT, \
InputType, Lexicon, JOVBaseNode, \
deep_merge, comfy_api_post, parse_reset
from ...sup.util import EnumConvertType, parse_dynamic, parse_param
from ...sup.util import \
EnumConvertType, \
parse_dynamic, parse_param
from ...sup.image import MIN_IMAGE_SIZE, IMAGE_FORMATS, \
from ...sup.image import \
MIN_IMAGE_SIZE, IMAGE_FORMATS, \
image_convert, image_matte, image_load, cv2tensor, cv2tensor_full, tensor2cv
from ...sup.image.adjust import EnumScaleMode, EnumInterpolation, \
from ...sup.image.adjust import \
EnumScaleMode, EnumInterpolation, \
image_scalefit
# ==============================================================================
@@ -69,7 +75,7 @@ Processes a batch of data based on the selected mode, such as merging, picking,
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -238,7 +244,7 @@ class QueueBaseNode(JOVBaseNode):
return float('nan')
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -478,7 +484,7 @@ Manage a queue of specific items: media files. Supports various image and video
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
+15 -6
View File
@@ -4,16 +4,25 @@ Jovimetrix - Utility
import io
import json
from typing import Any, Dict, Tuple
from typing import Any, Tuple
import torch
import numpy as np
from PIL import Image
import matplotlib.pyplot as plt
from ... import JOV_TYPE_IMAGE, Lexicon, JOVBaseNode, deep_merge, parse_reset
from ...sup.util import EnumConvertType, parse_dynamic, parse_param
from ...sup.image import MIN_IMAGE_SIZE, pil2tensor
from ... import \
JOV_TYPE_IMAGE, \
InputType, Lexicon, JOVBaseNode, \
deep_merge, parse_reset
from ...sup.util import \
EnumConvertType, \
parse_dynamic, parse_param
from ...sup.image import \
MIN_IMAGE_SIZE, \
pil2tensor
# ==============================================================================
@@ -139,7 +148,7 @@ Visualize a series of data points over time. It accepts a dynamic number of valu
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -220,7 +229,7 @@ Exports and Displays immediate information about images.
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
+11 -9
View File
@@ -6,7 +6,7 @@ import os
import json
from uuid import uuid4
from pathlib import Path
from typing import Any, Dict, Tuple
from typing import Any, Tuple
import torch
import numpy as np
@@ -19,12 +19,14 @@ from comfy.utils import ProgressBar
from folder_paths import get_output_directory
from nodes import interrupt_processing
from ... import JOV_TYPE_ANY, JOV_TYPE_IMAGE, \
Lexicon, JOVBaseNode, ComfyAPIMessage, TimedOutException, \
from ... import \
JOV_TYPE_ANY, JOV_TYPE_IMAGE, \
InputType, Lexicon, JOVBaseNode, ComfyAPIMessage, TimedOutException, \
comfy_api_post, deep_merge
from ...sup.util import EnumConvertType, path_next, parse_param, \
zip_longest_fill
from ...sup.util import \
EnumConvertType, \
path_next, parse_param, zip_longest_fill
from ...sup.image import tensor2cv, tensor2pil
@@ -70,7 +72,7 @@ Introduce pauses in the workflow that accept an optional input to pass through a
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -124,7 +126,7 @@ Responsible for saving images or animations to disk. It supports various output
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
d = deep_merge(d, {
"optional": {
@@ -234,7 +236,7 @@ Routes the input data from the optional input ports to the output port, preservi
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES()
e = {
"optional": {
@@ -262,7 +264,7 @@ Save the output image along with its metadata to the specified path. Supports sa
"""
@classmethod
def INPUT_TYPES(cls) -> Dict[str, str]:
def INPUT_TYPES(cls) -> InputType:
d = super().INPUT_TYPES(True, True)
d = deep_merge(d, {
"optional": {