lint
This commit is contained in:
parent
ee81f84fdb
commit
59ea8bbe9f
2 changed files with 13 additions and 8 deletions
|
|
@ -4,7 +4,7 @@ from typing import List
|
||||||
from typing import Match
|
from typing import Match
|
||||||
from typing import Optional
|
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.array import Array
|
||||||
from ytdl_sub.script.types.resolvable import Boolean
|
from ytdl_sub.script.types.resolvable import Boolean
|
||||||
from ytdl_sub.script.types.resolvable import Float
|
from ytdl_sub.script.types.resolvable import Float
|
||||||
|
|
@ -47,11 +47,13 @@ class RegexFunctions:
|
||||||
:description:
|
:description:
|
||||||
Returns True if any regex pattern in the regex array matches the string. False otherwise.
|
Returns True if any regex pattern in the regex array matches the string. False otherwise.
|
||||||
"""
|
"""
|
||||||
return Boolean(any(
|
return Boolean(
|
||||||
|
any(
|
||||||
len(RegexFunctions.regex_search(regex=String(str(regex)), string=string).value) > 0
|
len(RegexFunctions.regex_search(regex=String(str(regex)), string=string).value) > 0
|
||||||
for regex in regex_array.value
|
for regex in regex_array.value
|
||||||
if isinstance(regex, (String, Integer, Boolean, Float))
|
if isinstance(regex, (String, Integer, Boolean, Float))
|
||||||
))
|
)
|
||||||
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def regex_fullmatch(regex: String, string: String) -> Array:
|
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
|
RegexFunctions.regex_capture_groups(regex).value > len(default) for regex in regex_list
|
||||||
):
|
):
|
||||||
raise RuntimeException(
|
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([])
|
output = Array([])
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,8 @@ class ScriptingFunctionsDocGen(DocGen):
|
||||||
level=2,
|
level=2,
|
||||||
)
|
)
|
||||||
except Exception as exc:
|
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
|
return docs
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue