11#!/usr/bin/env python3
22
33import time
4- import random
54import sys
65import psutil
76import re
1110import argparse
1211import math
1312import logging
14- import time
1513
1614EXITCODE_OK = 0
1715EXITCODE_MISSING_DEPENDENCIES = 2
@@ -184,11 +182,11 @@ def validate_pytorch():
184182 from torch import cuda
185183
186184 if cuda .is_available () and cuda .device_count () > 0 :
187- LOGGER .info (f "Found torch with CUDA. OK." )
185+ LOGGER .info ("Found torch with CUDA. OK." )
188186 return True
189187 else :
190188 LOGGER .error (
191- f "Found torch without CUDA but CUDA support required. Exiting"
189+ "Found torch without CUDA but CUDA support required. Exiting"
192190 )
193191 return False
194192 else :
@@ -269,10 +267,8 @@ def validate_environment_requirements():
269267# Only now import the rest of the required packages
270268from asciimatics .widgets import (
271269 Frame ,
272- ListBox ,
273270 Layout ,
274271 Divider ,
275- Text ,
276272 Button ,
277273 TextBox ,
278274 Widget ,
@@ -283,10 +279,8 @@ def validate_environment_requirements():
283279)
284280from asciimatics .scene import Scene
285281from asciimatics .screen import Screen
286- from asciimatics .exceptions import ResizeScreenError , NextScene , StopApplication
287- from asciimatics .utilities import BoxTool
288- from asciimatics .constants import SINGLE_LINE , DOUBLE_LINE
289- from asciimatics .event import KeyboardEvent , MouseEvent
282+ from asciimatics .exceptions import ResizeScreenError , StopApplication
283+ from asciimatics .event import KeyboardEvent
290284from threading import Thread , Lock , Event
291285import GPUtil
292286import io
@@ -296,8 +290,6 @@ def validate_environment_requirements():
296290import shutil
297291import urllib .request
298292import urllib .parse
299- import signal
300- from datetime import datetime , timedelta
301293from tqdm .auto import tqdm
302294from pathlib import Path
303295
@@ -356,7 +348,7 @@ def terminate_process_on_exit(process):
356348def schedule_exit (timeout_seconds , errcode ):
357349 def f ():
358350 time .sleep (timeout_seconds )
359- LOGGER .info (f "Performing a scheduled exit." )
351+ LOGGER .info ("Performing a scheduled exit." )
360352 if TUI_SCREEN :
361353 if sys .platform == "win32" :
362354 TUI_SCREEN .close (restore = True )
@@ -1046,7 +1038,7 @@ def requests_get_content(url, *args, **kwargs):
10461038 result = requests .get (url , * args , ** kwargs )
10471039 result .raise_for_status ()
10481040 return result .content
1049- except Exception as e :
1041+ except Exception :
10501042 raise Exception (f"GET request to { url } failed" )
10511043
10521044
@@ -1250,7 +1242,7 @@ def setup_nnue_pytorch(directory, repo, branch_or_commit):
12501242 )
12511243
12521244 if not is_nnue_pytorch_setup (directory ):
1253- raise Exception (f "Incorrect nnue-pytorch setup or timeout." )
1245+ raise Exception ("Incorrect nnue-pytorch setup or timeout." )
12541246
12551247
12561248class CChessCliRunningTestEntry :
@@ -1429,7 +1421,7 @@ def get_status_string(self):
14291421 return "\n " .join (lines )
14301422 elif self ._current_convert is not None :
14311423 lines = [
1432- f "Converting network..." ,
1424+ "Converting network..." ,
14331425 f"Run : { self ._current_convert [0 ]} " ,
14341426 f"Epoch: { self ._current_convert [1 ]} " ,
14351427 ]
@@ -2667,7 +2659,7 @@ def main():
26672659
26682660 # Global (workspace) setup
26692661
2670- with SystemWideMutex (os .path .join (absolute_workspace_path , f ".lock" )) as mutex :
2662+ with SystemWideMutex (os .path .join (absolute_workspace_path , ".lock" )) as mutex :
26712663 ordo_directory = os .path .join (absolute_workspace_path , "ordo" )
26722664 c_chess_cli_directory = os .path .join (absolute_workspace_path , "c-chess-cli" )
26732665 books_directory = os .path .join (absolute_workspace_path , "books" )
@@ -2687,13 +2679,13 @@ def main():
26872679 )
26882680 try :
26892681 os .makedirs (experiment_directory , exist_ok = False )
2690- except FileExistsError as e :
2682+ except FileExistsError :
26912683 if args .fail_on_experiment_exists and os .listdir (experiment_directory ):
26922684 LOGGER .error (
26932685 f"Directory { experiment_directory } already exists. An experiment must use a new directory."
26942686 )
26952687 LOGGER .error (
2696- f "Alternatively, override this with the option --resume-training=True or --fail-on-experiment-exists=False."
2688+ "Alternatively, override this with the option --resume-training=True or --fail-on-experiment-exists=False."
26972689 )
26982690 return
26992691
0 commit comments