|
4 | 4 | # ruff: noqa: C901 |
5 | 5 | from __future__ import annotations |
6 | 6 |
|
7 | | -from typing import List, Union |
| 7 | +from typing import Union |
8 | 8 |
|
9 | 9 | from pythainlp import thai_consonants |
10 | 10 | from pythainlp.tokenize import subword_tokenize |
@@ -383,7 +383,7 @@ def check_karu_lahu(self, text): |
383 | 383 | else: |
384 | 384 | return "lahu" |
385 | 385 |
|
386 | | - def check_klon(self, text: str, k_type: int = 8) -> Union[List[str], str]: |
| 386 | + def check_klon(self, text: str, k_type: int = 8) -> Union[list[str], str]: |
387 | 387 | """ |
388 | 388 | Check the suitability of the poem according to Thai principles. |
389 | 389 |
|
@@ -627,8 +627,8 @@ def check_klon(self, text: str, k_type: int = 8) -> Union[List[str], str]: |
627 | 627 | return "Something went wrong. Make sure you enter it in the correct form." |
628 | 628 |
|
629 | 629 | def check_aek_too( |
630 | | - self, text: Union[List[str], str], dead_syllable_as_aek: bool = False |
631 | | - ) -> Union[List[bool], List[str], bool, str]: |
| 630 | + self, text: Union[list[str], str], dead_syllable_as_aek: bool = False |
| 631 | + ) -> Union[list[Union[bool, str]], bool, str]: |
632 | 632 | """ |
633 | 633 | Checker of Thai tonal words |
634 | 634 |
|
@@ -657,7 +657,7 @@ def check_aek_too( |
657 | 657 | # -> [False, 'aek', 'too'] |
658 | 658 | """ |
659 | 659 | if isinstance(text, list): |
660 | | - return [self.check_aek_too(t, dead_syllable_as_aek) for t in text] |
| 660 | + return [self.check_aek_too(t, dead_syllable_as_aek) for t in text] # type: ignore[misc] |
661 | 661 |
|
662 | 662 | if not isinstance(text, str): |
663 | 663 | raise TypeError("text must be str or iterable list[str]") |
|
0 commit comments