From d4218f3f19f8a684ed404d857db680b92ce11119 Mon Sep 17 00:00:00 2001 From: doctorpangloss <@hiddenswitch.com> Date: Fri, 14 Feb 2025 16:54:55 -0800 Subject: [PATCH] Fix NOFLAG not present on python 3.10 (?) --- comfy_extras/nodes/nodes_regexp.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/comfy_extras/nodes/nodes_regexp.py b/comfy_extras/nodes/nodes_regexp.py index 23d95ff75..c21cd426f 100644 --- a/comfy_extras/nodes/nodes_regexp.py +++ b/comfy_extras/nodes/nodes_regexp.py @@ -9,8 +9,7 @@ MATCH_TYPE_NAME = "MATCH" class RegexFlags(CustomNode): @classmethod def INPUT_TYPES(cls) -> InputTypes: - flags_ = {flag_name: ("BOOLEAN", {}) for flag_name in ["ASCII", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE", - "UNICODE", "NOFLAG"]} + flags_ = {flag_name: ("BOOLEAN", {}) for flag_name in ["ASCII", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE", "UNICODE"]} return { "required": flags_, } @@ -20,11 +19,11 @@ class RegexFlags(CustomNode): RETURN_TYPES = ("INT",) def execute(self, **kwargs) -> tuple[int]: - flags = re.RegexFlag.NOFLAG - + has_noflag = hasattr(re.RegexFlag, "NOFLAG") + flags = re.RegexFlag.NOFLAG if has_noflag else 0 for name, on in kwargs.items(): - if on: - flags |= re.RegexFlag[name] + if on and hasattr(re.RegexFlag, name): + flags |= int(re.RegexFlag[name]) return int(flags),