Skip to content

Commit 41b77c0

Browse files
committed
🔥 chore: clean python side regex compiling
1 parent d61d25f commit 41b77c0

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed

packages/biliass/src/biliass/biliass.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def process_comments(
3838
alpha: float,
3939
duration_marquee: float,
4040
duration_still: float,
41-
filters_regex: list[re.Pattern[str]],
41+
filters_regex: list[str],
4242
reduced: bool,
4343
):
4444
styleid = f"biliass_{random.randint(0, 0xFFFF):04x}"
@@ -73,13 +73,6 @@ def Danmaku2ASS(
7373
is_reduce_comments: bool = False,
7474
) -> str:
7575
comment_filters: list[str] = [comment_filter] if comment_filter is not None else []
76-
filters_regex = []
77-
for comment_filter in comment_filters:
78-
try:
79-
if comment_filter:
80-
filters_regex.append(re.compile(comment_filter))
81-
except: # noqa: E722
82-
raise ValueError(f"Invalid regular expression: {comment_filter}") from None
8376

8477
comments: list[Comment] = []
8578
if not isinstance(inputs, list):
@@ -114,6 +107,6 @@ def Danmaku2ASS(
114107
text_opacity,
115108
duration_marquee,
116109
duration_still,
117-
filters_regex,
110+
comment_filters,
118111
is_reduce_comments,
119112
)

0 commit comments

Comments
 (0)