From 4880f13debd9717b7d45aff5ee4cde226be6bf0f Mon Sep 17 00:00:00 2001 From: cluny85 Date: Fri, 16 May 2025 15:30:10 +0200 Subject: [PATCH] fix: Linter errors --- comfyui_scripting_tools/__init__.py | 5 ++-- .../enhanced_uuid_generator.py | 9 +++--- .../uuid_generator_node.py | 28 ++++++++++++++----- 3 files changed, 27 insertions(+), 15 deletions(-) diff --git a/comfyui_scripting_tools/__init__.py b/comfyui_scripting_tools/__init__.py index 4429e72..ee06c17 100644 --- a/comfyui_scripting_tools/__init__.py +++ b/comfyui_scripting_tools/__init__.py @@ -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"] \ No newline at end of file +__all__ = ["NODE_CLASS_MAPPINGS", "NODE_DISPLAY_NAME_MAPPINGS"] diff --git a/comfyui_scripting_tools/enhanced_uuid_generator.py b/comfyui_scripting_tools/enhanced_uuid_generator.py index 9394403..f36aa84 100644 --- a/comfyui_scripting_tools/enhanced_uuid_generator.py +++ b/comfyui_scripting_tools/enhanced_uuid_generator.py @@ -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 ---") \ No newline at end of file +NODE_DISPLAY_NAME_M \ No newline at end of file diff --git a/comfyui_scripting_tools/uuid_generator_node.py b/comfyui_scripting_tools/uuid_generator_node.py index a7ea458..e2f2be8 100644 --- a/comfyui_scripting_tools/uuid_generator_node.py +++ b/comfyui_scripting_tools/uuid_generator_node.py @@ -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.