Skip to content

Commit 5789ad2

Browse files
fix: fix lint error
1 parent 30f8a30 commit 5789ad2

1 file changed

Lines changed: 9 additions & 14 deletions

File tree

webui/utils/cache.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
import time
2-
import uuid
3-
import shutil
41
import os
5-
import sys
2+
import shutil
63
import stat
4+
import time
5+
import uuid
76

87

98
def setup_workspace(folder):
@@ -20,18 +19,14 @@ def setup_workspace(folder):
2019
return log_file, working_dir
2120

2221

23-
def on_rm_error(func, path, exc_info):
24-
st = os.stat(path)
25-
os.chmod(path, st.st_mode | stat.S_IWRITE)
22+
def cleanup_workspace(working_dir):
23+
if not os.path.exists(working_dir):
24+
return
25+
st = os.stat(working_dir)
26+
os.chmod(working_dir, st.st_mode | stat.S_IWRITE)
2627

2728
time.sleep(0.5)
2829
try:
29-
func(path)
30+
shutil.rmtree(working_dir)
3031
except Exception:
3132
pass
32-
33-
def cleanup_workspace(working_dir):
34-
if sys.version_info >= (3, 12):
35-
shutil.rmtree(working_dir, onexc=on_rm_error)
36-
else:
37-
shutil.rmtree(working_dir, onerror=on_rm_error)

0 commit comments

Comments
 (0)