This commit is contained in:
Jesse Bannon 2024-09-25 22:31:44 -07:00
parent ee81f84fdb
commit 59ea8bbe9f
2 changed files with 13 additions and 8 deletions

View file

@ -4,7 +4,7 @@ from typing import List
from typing import Match
from typing import Optional
from ytdl_sub.script.functions import ArrayFunctions
from ytdl_sub.script.functions.array_functions import ArrayFunctions
from ytdl_sub.script.types.array import Array
from ytdl_sub.script.types.resolvable import Boolean
from ytdl_sub.script.types.resolvable import Float
@ -47,11 +47,13 @@ class RegexFunctions:
:description:
Returns True if any regex pattern in the regex array matches the string. False otherwise.
"""
return Boolean(any(
len(RegexFunctions.regex_search(regex=String(str(regex)), string=string).value) > 0
for regex in regex_array.value
if isinstance(regex, (String, Integer, Boolean, Float))
))
return Boolean(
any(
len(RegexFunctions.regex_search(regex=String(str(regex)), string=string).value) > 0
for regex in regex_array.value
if isinstance(regex, (String, Integer, Boolean, Float))
)
)
@staticmethod
def regex_fullmatch(regex: String, string: String) -> Array:
@ -134,7 +136,8 @@ class RegexFunctions:
RegexFunctions.regex_capture_groups(regex).value > len(default) for regex in regex_list
):
raise RuntimeException(
"When using %regex_capture_array, number of regex capture groups must be less than or equal to the number of defaults"
"When using %regex_capture_array, number of regex capture groups must be less than "
"or equal to the number of defaults"
)
output = Array([])

View file

@ -80,6 +80,8 @@ class ScriptingFunctionsDocGen(DocGen):
level=2,
)
except Exception as exc:
raise ValueError(f"Invalid docs for function {display_function_name}") from exc
raise ValueError(
f"Invalid docs for function {display_function_name}"
) from exc
return docs