@@ -50,7 +50,7 @@ def confirm(message: str) -> bool:
50
50
return answer == 'y'
51
51
52
52
53
- def warn_user (msg : str ):
53
+ def warn_user (msg : str ) -> None :
54
54
global num_warnings
55
55
num_warnings += 1
56
56
if args .quiet :
@@ -67,11 +67,11 @@ def usage(msg: str) -> NoReturn:
67
67
68
68
def error (msg : str ) -> NoReturn :
69
69
logging .error (msg )
70
- exit (- 1 )
70
+ exit (1 )
71
71
72
72
73
- def print_if_json (text : str ):
74
- ''' Print the text if it is valid JSON, and ignore otherwise'''
73
+ def print_if_json (text : str ) -> None :
74
+ """ Print the text if it is valid JSON, and ignore otherwise"""
75
75
try :
76
76
data = json .loads (text )
77
77
print (json .dumps (data , indent = 2 ))
@@ -80,11 +80,11 @@ def print_if_json(text: str):
80
80
81
81
82
82
def read_contests () -> list :
83
- ''' Read all contests from the API.
83
+ """ Read all contests from the API.
84
84
85
85
Returns:
86
86
The contests or None if an error occurred.
87
- '''
87
+ """
88
88
89
89
try :
90
90
data = do_api_request ('contests' )
@@ -111,11 +111,11 @@ def read_contests() -> list:
111
111
112
112
113
113
def read_languages () -> list :
114
- ''' Read all languages for the current contest from the API.
114
+ """ Read all languages for the current contest from the API.
115
115
116
116
Returns:
117
117
The languages or None if an error occurred.
118
- '''
118
+ """
119
119
120
120
try :
121
121
endpoint = 'contests/' + my_contest ['id' ] + '/languages'
@@ -153,11 +153,11 @@ def read_languages() -> list:
153
153
154
154
155
155
def read_problems () -> list :
156
- ''' Read all problems for the current contest from the API.
156
+ """ Read all problems for the current contest from the API.
157
157
158
158
Returns:
159
159
The problems or None if an error occurred.
160
- '''
160
+ """
161
161
162
162
try :
163
163
endpoint = 'contests/' + my_contest ['id' ] + '/problems'
@@ -187,7 +187,7 @@ def read_problems() -> list:
187
187
188
188
189
189
def do_api_request (endpoint : str , data = None , files = None ):
190
- ''' Perform an API call to the given endpoint and return its data.
190
+ """ Perform an API call to the given endpoint and return its data.
191
191
192
192
Parameters:
193
193
endpoint (str): the endpoint to call
@@ -199,7 +199,7 @@ def do_api_request(endpoint: str, data=None, files=None):
199
199
200
200
Raises:
201
201
RuntimeError when the response is not JSON or the HTTP status code is non 2xx.
202
- '''
202
+ """
203
203
204
204
if not baseurl :
205
205
raise RuntimeError ('No baseurl set' )
@@ -249,8 +249,8 @@ def kotlin_base_entry_point(filebase: str) -> str:
249
249
return filebase
250
250
251
251
252
- def get_epilog ():
253
- ''' Get the epilog for the help text.'''
252
+ def get_epilog () -> str :
253
+ """ Get the epilog for the help text."""
254
254
255
255
contests_part_one = None
256
256
contests_part_two = None
@@ -323,8 +323,8 @@ Submit multiple files (the problem and language are taken from the first):
323
323
return "\n \n " .join (part for part in epilog_parts if part )
324
324
325
325
326
- def do_api_print ():
327
- ''' Submit to the API for printing with the given data.'''
326
+ def do_api_print () -> None :
327
+ """ Submit to the API for printing with the given data."""
328
328
329
329
if len (filenames ) != 1 :
330
330
error ('You can only print a single file' )
@@ -353,8 +353,8 @@ def do_api_print():
353
353
print (f"DOMjudge reported a printing error: { result ['output' ]} " )
354
354
355
355
356
- def do_api_submit ():
357
- ''' Submit to the API with the given data.'''
356
+ def do_api_submit () -> None :
357
+ """ Submit to the API with the given data."""
358
358
359
359
data = {
360
360
'problem' : my_problem ['id' ],
0 commit comments