77import math
88import random
99import re
10- from typing import TYPE_CHECKING , TypeVar
10+ from typing import TYPE_CHECKING , TypeVar , Union
1111
1212from biliass ._core import (
1313 Comment ,
2626
2727
2828T = TypeVar ("T" )
29+ Rows = list [list [Union [Comment , None ]]]
2930
3031
3132def read_comments_bilibili_xml (text : str | bytes , fontsize : float ) -> list [Comment ]:
@@ -314,7 +315,7 @@ def process_comments(
314315
315316
316317def 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