mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-01-11 23:00:51 +08:00
Fix NOFLAG not present on python 3.10 (?)
This commit is contained in:
parent
87a4af84ae
commit
d4218f3f19
@ -9,8 +9,7 @@ MATCH_TYPE_NAME = "MATCH"
|
|||||||
class RegexFlags(CustomNode):
|
class RegexFlags(CustomNode):
|
||||||
@classmethod
|
@classmethod
|
||||||
def INPUT_TYPES(cls) -> InputTypes:
|
def INPUT_TYPES(cls) -> InputTypes:
|
||||||
flags_ = {flag_name: ("BOOLEAN", {}) for flag_name in ["ASCII", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE",
|
flags_ = {flag_name: ("BOOLEAN", {}) for flag_name in ["ASCII", "IGNORECASE", "LOCALE", "MULTILINE", "DOTALL", "VERBOSE", "UNICODE"]}
|
||||||
"UNICODE", "NOFLAG"]}
|
|
||||||
return {
|
return {
|
||||||
"required": flags_,
|
"required": flags_,
|
||||||
}
|
}
|
||||||
@ -20,11 +19,11 @@ class RegexFlags(CustomNode):
|
|||||||
RETURN_TYPES = ("INT",)
|
RETURN_TYPES = ("INT",)
|
||||||
|
|
||||||
def execute(self, **kwargs) -> tuple[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():
|
for name, on in kwargs.items():
|
||||||
if on:
|
if on and hasattr(re.RegexFlag, name):
|
||||||
flags |= re.RegexFlag[name]
|
flags |= int(re.RegexFlag[name])
|
||||||
|
|
||||||
return int(flags),
|
return int(flags),
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user