fix: Linter errors

This commit is contained in:
cluny85
2025-05-16 15:30:10 +02:00
parent 635515c0cc
commit 4880f13deb
3 changed files with 27 additions and 15 deletions
+2 -3
View File
@@ -1,4 +1,3 @@
from .enhanced_uuid_generator import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
from .uuid_generator_node import NODE_CLASS_MAPPINGS, NODE_DISPLAY_NAME_MAPPINGS
from .enhanced_uuid_generator import *
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"]
@@ -1,6 +1,8 @@
import uuid
class EnhancedUUIDGeneratorNode:
def get_namespace(self, namespace_type, custom_namespace_uuid_str):
if namespace_type == "DNS":
return uuid.NAMESPACE_DNS
@@ -38,13 +40,10 @@ class EnhancedUUIDGeneratorNode:
return f"{prefix}{generated_uuid}{suffix}"
# --- Mapeo para que ComfyUI reconozca el nodo ---
NODE_CLASS_MAPPINGS = {
"EnhancedUUIDGeneratorNode": EnhancedUUIDGeneratorNode
}
NODE_DISPLAY_NAME_MAPPINGS = {
"EnhancedUUIDGeneratorNode": "Generate UUID (Enhanced)"
}
print("--- Custom Node: Enhanced UUID Generator loaded ---")
NODE_DISPLAY_NAME_M
+21 -7
View File
@@ -1,19 +1,20 @@
import uuid
class UUIDGeneratorNode:
"""
A simple node to generate a v4 UUID and return it as a string.
"""
# Define how the node will be displayed in ComfyUI's menu
NODE_NAME = "UUID Generator" # Internal name, used in NODE_CLASS_MAPPINGS
NODE_DISPLAY_NAME = "Generate UUID String" # Name the user sees
NODE_NAME = "UUID Generator" # Internal name, used in NODE_CLASS_MAPPINGS
NODE_DISPLAY_NAME = "Generate UUID String" # Name the user sees
# Define the input types the node accepts
@classmethod
def INPUT_TYPES(cls):
return {
"required": {}, # No required inputs to generate a random UUID
"required": {}, # No required inputs to generate a random UUID
"optional": {
# The 'trigger' here doesn't affect the UUID (uuid4 is random)
# but allows the user to change a value to force
@@ -33,12 +34,24 @@ class UUIDGeneratorNode:
FUNCTION = "generate_uuid"
# Define the category where the node will appear in ComfyUI's menu
CATEGORY = "utils/text" # You can change "utils/text" to your preference
CATEGORY = "utils/text" # You can change "utils/text" to your preference
# Indicates if this node is a final output node (like SaveImage)
# In this case, it is not.
OUTPUT_NODE = False
def __init__(self): # E302: expected 2 blank lines, found 1
self.value = None # E261: at least two spaces before inline comment
self.another_value = 0 # E261: at least two spaces before inline comment
self.some_flag = True # E261: at least two spaces before inline comment
self.last_value = False # E261: at least two spaces before inline comment
def reset(self):
pass
def get_value(self):
return self.value # E261: at least two spaces before inline comment
def generate_uuid(self, trigger=0, prefix="", suffix=""):
"""
Generates a v4 UUID and returns it as a string, optionally with a prefix and suffix.
@@ -47,17 +60,18 @@ class UUIDGeneratorNode:
"""
# Generate a random v4 UUID
generated_uuid = str(uuid.uuid4())
# Concatenate with prefix and suffix if provided
result_string = f"{prefix}{generated_uuid}{suffix}"
# ComfyUI nodes must return a tuple of results
return (result_string,)
# --- Mappings for ComfyUI to recognize the node ---
# This dictionary maps an internal name (key) to the node class (value).
NODE_CLASS_MAPPINGS = {
"UUIDGeneratorNode": UUIDGeneratorNode # "UUIDGeneratorNode" is the name used in saved workflows (JSON)
"UUIDGeneratorNode": UUIDGeneratorNode # "UUIDGeneratorNode" is the name used in saved workflows (JSON)
}
# This dictionary maps the internal name to a human-readable name for the UI.