44from maa .controller import Controller
55
66import time
7+ from typing import Any , Literal , overload
78
89
9- def cprint (content : str = "" , interval : int = 0.1 ):
10+ def cprint (content : str = "" , interval : float = 0.1 ):
1011 interval /= 2
1112 time .sleep (interval )
1213 print ("info:" + content )
@@ -31,12 +32,39 @@ def log(
3132 cprint ("——" * 5 )
3233
3334 @staticmethod
35+ @overload
3436 def error (
3537 content : str ,
36- e : Exception = None ,
37- reco_detail = None ,
38- use_defult_postfix = True ,
39- ):
38+ e : Exception | str | None = None ,
39+ reco_detail : None = None ,
40+ use_defult_postfix : bool = True ,
41+ ) -> Literal [False ]: ...
42+
43+ @staticmethod
44+ @overload
45+ def error (
46+ content : str ,
47+ e : Exception | str | None ,
48+ reco_detail : Literal [True ] | dict [str , Any ],
49+ use_defult_postfix : bool = True ,
50+ ) -> CustomRecognition .AnalyzeResult : ...
51+
52+ @staticmethod
53+ @overload
54+ def error (
55+ content : str ,
56+ * ,
57+ reco_detail : Literal [True ] | dict [str , Any ],
58+ use_defult_postfix : bool = True ,
59+ ) -> CustomRecognition .AnalyzeResult : ...
60+
61+ @staticmethod
62+ def error (
63+ content : str ,
64+ e : Exception | str | None = None ,
65+ reco_detail : Literal [True ] | dict [str , Any ] | None = None ,
66+ use_defult_postfix : bool = True ,
67+ ) -> Literal [False ] | CustomRecognition .AnalyzeResult :
4068 if use_defult_postfix :
4169 content += "失败,请立即停止运行程序!"
4270 cprint ("——" * 5 )
0 commit comments