try optional dependency

This commit is contained in:
aria1th
2025-05-23 01:16:35 +09:00
parent 60f8f1187c
commit 5992e91930
3 changed files with 20 additions and 9 deletions
+8 -3
View File
@@ -4,9 +4,14 @@ from .imgio.converter import PILHandlingHodes
from .autonode import node_wrapper, get_node_names_mappings, validate
from PIL import Image
from Crypto.PublicKey import RSA
from Crypto.Cipher import AES, PKCS1_OAEP
from Crypto.Random import get_random_bytes
try:
from Crypto.PublicKey import RSA
from Crypto.Cipher import AES, PKCS1_OAEP
from Crypto.Random import get_random_bytes
except ImportError:
print("Crypto library not found. Please install pycryptodome.")
raise
import torch
from base64 import b64encode, b64decode
+3 -3
View File
@@ -385,9 +385,9 @@ class ReplaceString:
def INPUT_TYPES(s):
return {
"required": {
"String": ("STRING", {"default": ""}),
"Regex": ("STRING", {"default": ""}),
"ReplaceWith": ("STRING", {"default": ""}),
"String": ("STRING", {"default": ""}), # input string
"Regex": ("STRING", {"default": ""}), # regex to search for
"ReplaceWith": ("STRING", {"default": ""}), # string to replace with
}
}
FUNCTION = "replace"
+9 -3
View File
@@ -10,7 +10,7 @@ from .math_nodes import CLASS_MAPPINGS as MathMapping, CLASS_NAMES as MathNames
from .io_node import CLASS_MAPPINGS as IOMapping, CLASS_NAMES as IONames
from .auxilary import CLASS_MAPPINGS as AuxilaryMapping, CLASS_NAMES as AuxilaryNames
from .external import CLASS_MAPPINGS as ExternalMapping, CLASS_NAMES as ExternalNames
from .crypto import CLASS_MAPPINGS as SecureMapping, CLASS_NAMES as SecureNames
NODE_CLASS_MAPPINGS = {
@@ -22,7 +22,7 @@ NODE_CLASS_MAPPINGS.update(ConversionMapping)
NODE_CLASS_MAPPINGS.update(MathMapping)
NODE_CLASS_MAPPINGS.update(ExternalMapping)
NODE_CLASS_MAPPINGS.update(AuxilaryMapping)
NODE_CLASS_MAPPINGS.update(SecureMapping)
NODE_DISPLAY_NAME_MAPPINGS = {
@@ -35,7 +35,7 @@ NODE_DISPLAY_NAME_MAPPINGS.update(ConversionNames)
NODE_DISPLAY_NAME_MAPPINGS.update(MathNames)
NODE_DISPLAY_NAME_MAPPINGS.update(ExternalNames)
NODE_DISPLAY_NAME_MAPPINGS.update(AuxilaryNames)
NODE_DISPLAY_NAME_MAPPINGS.update(SecureNames)
try:
from .pystructure import CLASS_MAPPINGS as PyStructureMapping, CLASS_NAMES as PyStructureNames
@@ -43,3 +43,9 @@ try:
NODE_DISPLAY_NAME_MAPPINGS.update(PyStructureNames)
except ImportError:
pass
try:
from .crypto import CLASS_MAPPINGS as SecureMapping, CLASS_NAMES as SecureNames
NODE_CLASS_MAPPINGS.update(SecureMapping)
NODE_DISPLAY_NAME_MAPPINGS.update(SecureNames)
except ImportError:
pass