9
9
from time import sleep
10
10
from typing import Tuple , Optional
11
11
12
+ from colorama import Fore
13
+
12
14
from atcodertools .client .atcoder import AtCoderClient , Contest , LoginError
13
15
from atcodertools .client .models .problem import Problem
14
16
from atcodertools .client .models .problem_content import InputFormatDetectionError , SampleDetectionError
21
23
from atcodertools .fmtprediction .predict_format import NoPredictionResultError , \
22
24
MultiplePredictionResultsError , predict_format
23
25
from atcodertools .tools .models .metadata import Metadata
26
+ from atcodertools .tools .utils import with_color
24
27
25
28
script_dir_path = os .path .dirname (os .path .abspath (__file__ ))
26
29
@@ -76,7 +79,7 @@ def prepare_procedure(atcoder_client: AtCoderClient,
76
79
pid )
77
80
78
81
def emit_error (text ):
79
- logging .error ("Problem {}: {}" .format (pid , text ))
82
+ logging .error (with_color ( "Problem {}: {}" .format (pid , text ), Fore . RED ))
80
83
81
84
def emit_warning (text ):
82
85
logging .warning ("Problem {}: {}" .format (pid , text ))
@@ -143,7 +146,9 @@ def emit_info(text):
143
146
code_file_path
144
147
)
145
148
emit_info (
146
- "Prediction succeeded -- Saved auto-generated code to '{}'" .format (code_file_path ))
149
+ "{} -- Saved auto-generated code to '{}'" .format (
150
+ with_color ("Prediction succeeded" , Fore .LIGHTGREEN_EX ),
151
+ code_file_path ))
147
152
except (NoPredictionResultError , MultiplePredictionResultsError ) as e :
148
153
if isinstance (e , NoPredictionResultError ):
149
154
msg = "No prediction -- Failed to understand the input format"
@@ -154,7 +159,7 @@ def emit_info(text):
154
159
shutil .copy (replacement_code_path , code_file_path )
155
160
emit_warning (
156
161
"{} -- Copied {} to {}" .format (
157
- msg ,
162
+ with_color ( msg , Fore . LIGHTRED_EX ) ,
158
163
replacement_code_path ,
159
164
code_file_path ))
160
165
0 commit comments