Skip to content

Commit 4fcc115

Browse files
committed
🏷️ chore: fix rows typing
1 parent ec6e749 commit 4fcc115

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

packages/biliass/src/biliass/biliass.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import math
88
import random
99
import re
10-
from typing import TYPE_CHECKING, TypeVar
10+
from typing import TYPE_CHECKING, TypeVar, Union
1111

1212
from biliass._core import (
1313
Comment,
@@ -26,6 +26,7 @@
2626

2727

2828
T = TypeVar("T")
29+
Rows = list[list[Union[Comment, None]]]
2930

3031

3132
def read_comments_bilibili_xml(text: str | bytes, fontsize: float) -> list[Comment]:
@@ -314,7 +315,7 @@ def process_comments(
314315

315316

316317
def test_free_rows(
317-
rows: list[Comment | None],
318+
rows: Rows,
318319
comment: Comment,
319320
row: int,
320321
width,
@@ -357,7 +358,7 @@ def test_free_rows(
357358
return res
358359

359360

360-
def find_alternative_row(rows, comment: Comment, height, bottom_reserved):
361+
def find_alternative_row(rows: Rows, comment: Comment, height, bottom_reserved):
361362
res = 0
362363
comment_pos_id = comment.pos.id
363364
for row in range(height - bottom_reserved - math.ceil(comment.height)):
@@ -368,7 +369,7 @@ def find_alternative_row(rows, comment: Comment, height, bottom_reserved):
368369
return res
369370

370371

371-
def mark_comment_row(rows: list[Comment | None], comment: Comment, row: int):
372+
def mark_comment_row(rows: Rows, comment: Comment, row: int):
372373
comment_pos_id = comment.pos.id
373374
try:
374375
for i in range(row, row + math.ceil(comment.height)):

0 commit comments

Comments
 (0)