@@ -69,15 +69,20 @@ def _perform_api_call(call, request_method, data=None, file_elements=None):
6969 __check_response (response , url , file_elements )
7070
7171 logging .info (
72- "%.7fs taken for [%s] request for the URL %s" , time .time () - start , request_method , url ,
72+ "%.7fs taken for [%s] request for the URL %s" ,
73+ time .time () - start ,
74+ request_method ,
75+ url ,
7376 )
7477 return response .text
7578
7679
7780def _download_minio_file (
78- source : str , destination : Union [str , pathlib .Path ], exists_ok : bool = True ,
81+ source : str ,
82+ destination : Union [str , pathlib .Path ],
83+ exists_ok : bool = True ,
7984) -> None :
80- """ Download file ``source`` from a MinIO Bucket and store it at ``destination``.
85+ """Download file ``source`` from a MinIO Bucket and store it at ``destination``.
8186
8287 Parameters
8388 ----------
@@ -103,7 +108,9 @@ def _download_minio_file(
103108
104109 try :
105110 client .fget_object (
106- bucket_name = bucket , object_name = object_name , file_path = str (destination ),
111+ bucket_name = bucket ,
112+ object_name = object_name ,
113+ file_path = str (destination ),
107114 )
108115 except minio .error .S3Error as e :
109116 if e .message .startswith ("Object does not exist" ):
@@ -120,7 +127,7 @@ def _download_text_file(
120127 exists_ok : bool = True ,
121128 encoding : str = "utf8" ,
122129) -> Optional [str ]:
123- """ Download the text file at `source` and store it in `output_path`.
130+ """Download the text file at `source` and store it in `output_path`.
124131
125132 By default, do nothing if a file already exists in `output_path`.
126133 The downloaded file can be checked against an expected md5 checksum.
@@ -156,7 +163,10 @@ def _download_text_file(
156163
157164 if output_path is None :
158165 logging .info (
159- "%.7fs taken for [%s] request for the URL %s" , time .time () - start , "get" , source ,
166+ "%.7fs taken for [%s] request for the URL %s" ,
167+ time .time () - start ,
168+ "get" ,
169+ source ,
160170 )
161171 return downloaded_file
162172
@@ -165,7 +175,10 @@ def _download_text_file(
165175 fh .write (downloaded_file )
166176
167177 logging .info (
168- "%.7fs taken for [%s] request for the URL %s" , time .time () - start , "get" , source ,
178+ "%.7fs taken for [%s] request for the URL %s" ,
179+ time .time () - start ,
180+ "get" ,
181+ source ,
169182 )
170183
171184 del downloaded_file
@@ -174,8 +187,8 @@ def _download_text_file(
174187
175188def _file_id_to_url (file_id , filename = None ):
176189 """
177- Presents the URL how to download a given file id
178- filename is optional
190+ Presents the URL how to download a given file id
191+ filename is optional
179192 """
180193 openml_url = config .server .split ("/api/" )
181194 url = openml_url [0 ] + "/data/download/%s" % file_id
@@ -194,7 +207,12 @@ def _read_url_files(url, data=None, file_elements=None):
194207 file_elements = {}
195208 # Using requests.post sets header 'Accept-encoding' automatically to
196209 # 'gzip,deflate'
197- response = _send_request (request_method = "post" , url = url , data = data , files = file_elements ,)
210+ response = _send_request (
211+ request_method = "post" ,
212+ url = url ,
213+ data = data ,
214+ files = file_elements ,
215+ )
198216 return response
199217
200218
@@ -258,7 +276,9 @@ def _send_request(request_method, url, data, files=None, md5_checksum=None):
258276 raise OpenMLServerError (
259277 "Unexpected server error when calling {}. Please contact the "
260278 "developers!\n Status code: {}\n {}" .format (
261- url , response .status_code , response .text ,
279+ url ,
280+ response .status_code ,
281+ response .text ,
262282 )
263283 )
264284 if retry_counter >= n_retries :
@@ -290,7 +310,9 @@ def __check_response(response, url, file_elements):
290310
291311
292312def __parse_server_exception (
293- response : requests .Response , url : str , file_elements : Dict ,
313+ response : requests .Response ,
314+ url : str ,
315+ file_elements : Dict ,
294316) -> OpenMLServerError :
295317
296318 if response .status_code == 414 :
@@ -319,12 +341,17 @@ def __parse_server_exception(
319341
320342 # 512 for runs, 372 for datasets, 500 for flows
321343 # 482 for tasks, 542 for evaluations, 674 for setups
322- return OpenMLServerNoResult (code = code , message = full_message ,)
344+ return OpenMLServerNoResult (
345+ code = code ,
346+ message = full_message ,
347+ )
323348 # 163: failure to validate flow XML (https://www.openml.org/api_docs#!/flow/post_flow)
324349 if code in [163 ] and file_elements is not None and "description" in file_elements :
325350 # file_elements['description'] is the XML file description of the flow
326351 full_message = "\n {}\n {} - {}" .format (
327- file_elements ["description" ], message , additional_information ,
352+ file_elements ["description" ],
353+ message ,
354+ additional_information ,
328355 )
329356 else :
330357 full_message = "{} - {}" .format (message , additional_information )
0 commit comments