1818import re
1919from collections import Counter
2020from copy import deepcopy
21- from typing import Any , Dict , List , Tuple
21+ from typing import Any , Dict , List , Tuple , Union
2222
2323import numpy as np
2424from PIL import Image
@@ -829,7 +829,7 @@ def convert_otsl_to_html(otsl_content: str):
829829 return export_to_html (table_data )
830830
831831
832- def find_shortest_repeating_substring (s : str ) -> str | None :
832+ def find_shortest_repeating_substring (s : str ) -> Union [ str , None ] :
833833 """
834834 Find the shortest substring that repeats to form the entire string.
835835
@@ -850,7 +850,7 @@ def find_shortest_repeating_substring(s: str) -> str | None:
850850
851851def find_repeating_suffix (
852852 s : str , min_len : int = 8 , min_repeats : int = 5
853- ) -> Tuple [str , str , int ] | None :
853+ ) -> Union [ Tuple [str , str , int ], None ] :
854854 """
855855 Detect if string ends with a repeating phrase.
856856
@@ -888,7 +888,7 @@ def truncate_repetitive_content(
888888 min_len (int): Min length for char-level check.
889889
890890 Returns:
891- Tuple [str, str]: (truncated_content, info_string)
891+ Union [str, str]: (truncated_content, info_string)
892892 """
893893 stripped_content = content .strip ()
894894 if not stripped_content :
0 commit comments