NagisaNao commited on
Commit
f1244c8
·
verified ·
1 Parent(s): 82c4ce2

kaggle kurva

Browse files
files_cells/notebooks/en/downloading_en.ipynb CHANGED
@@ -118,6 +118,28 @@
118
  " start_colab = int(time.time()) - 5\n",
119
  " os.environ[\"START_COLAB\"] = str(start_colab)\n",
120
  "\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  "# Save files temporarily\n",
122
  "temporarily_dir = f'{root_path}/temp_dir'\n",
123
  "\n",
@@ -137,7 +159,7 @@
137
  "\n",
138
  " if os.path.exists(src):\n",
139
  " if os.path.exists(dst):\n",
140
- " shutil.rmtree(dst)\n",
141
  " os.makedirs(os.path.dirname(dst), exist_ok=True)\n",
142
  " shutil.move(src, dst)\n",
143
  " print(\"\\r🔥 Files moved!\" + \" \"*15)\n",
@@ -188,14 +210,14 @@
188
  "\n",
189
  " if os.path.exists(temporarily_dir):\n",
190
  " copy_items_with_replace(temporarily_dir, webui_path)\n",
191
- " shutil.rmtree(temporarily_dir)\n",
192
  "\n",
193
  "# ================= MAIN CODE ==================\n",
194
  "if os.path.exists(webui_path):\n",
195
  " if UI != OLD_UI:\n",
196
  " print(f'Switching the WebUI from \\033[33m{OLD_UI}\\033[0m to \\033[33m{UI}\\033[0m:\\n', end='')\n",
197
  " copy_items_with_replace(webui_path, temporarily_dir)\n",
198
- " shutil.rmtree(webui_path)\n",
199
  " os.environ['SDW_OLD_UI'] = UI\n",
200
  " time.sleep(2)\n",
201
  " clear_output()\n",
@@ -211,8 +233,8 @@
211
  "\n",
212
  "## Changes extensions and WebUi\n",
213
  "if latest_webui or latest_exstensions:\n",
214
- " action = \"Updating WebUI and Extensions\" if latest_webui and latest_exstensions else (\"WebUI Update\" if latest_webui else \"Update Extensions\")\n",
215
- " print(f\"⌚️ {action}...\", end='', flush=True)\n",
216
  " with capture.capture_output() as cap:\n",
217
  " !git config --global user.email \"you@example.com\"\n",
218
  " !git config --global user.name \"Your Name\"\n",
@@ -227,7 +249,7 @@
227
  " if latest_exstensions:\n",
228
  " !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
229
  " del cap\n",
230
- " print(f\"\\r✨ {action} Completed!\")\n",
231
  "\n",
232
  "\n",
233
  "# === FIXING EXTENSIONS ===\n",
@@ -247,7 +269,7 @@
247
  "\n",
248
  "## Version switching\n",
249
  "if commit_hash:\n",
250
- " print('⏳ Time machine activation...', end=\"\", flush=True)\n",
251
  " with capture.capture_output() as cap:\n",
252
  " %cd {webui_path}\n",
253
  " !git config --global user.email \"you@example.com\"\n",
@@ -575,7 +597,7 @@
575
  "\n",
576
  "## Install of Custom extensions\n",
577
  "if len(extension_repo) > 0:\n",
578
- " print(\"✨ Installing custom extensions...\", end='', flush=True)\n",
579
  " with capture.capture_output() as cap:\n",
580
  " for repo, repo_name in extension_repo:\n",
581
  " if not repo_name:\n",
 
118
  " start_colab = int(time.time()) - 5\n",
119
  " os.environ[\"START_COLAB\"] = str(start_colab)\n",
120
  "\n",
121
+ "# remove directory func\n",
122
+ "def _remove_dir(directory_path, log=False):\n",
123
+ " if not directory_path:\n",
124
+ " raise ValueError(\"The directory path is empty\")\n",
125
+ "\n",
126
+ " try:\n",
127
+ " subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)\n",
128
+ " if log:\n",
129
+ " print(f\"Successfully executed: rm -rf {directory_path}\")\n",
130
+ " except subprocess.CalledProcessError as e:\n",
131
+ " if log:\n",
132
+ " print(f\"Failed to remove {directory_path} using rm -rf. Error: {e}\")\n",
133
+ "\n",
134
+ " if os.path.exists(directory_path):\n",
135
+ " try:\n",
136
+ " shutil.rmtree(directory_path)\n",
137
+ " if log:\n",
138
+ " print(f\"Successfully removed {directory_path} using shutil\")\n",
139
+ " except Exception as e:\n",
140
+ " if log:\n",
141
+ " print(f\"Failed to remove {directory_path} using shutil. Error: {e}\")\n",
142
+ "\n",
143
  "# Save files temporarily\n",
144
  "temporarily_dir = f'{root_path}/temp_dir'\n",
145
  "\n",
 
159
  "\n",
160
  " if os.path.exists(src):\n",
161
  " if os.path.exists(dst):\n",
162
+ " _remove_dir(dst)\n",
163
  " os.makedirs(os.path.dirname(dst), exist_ok=True)\n",
164
  " shutil.move(src, dst)\n",
165
  " print(\"\\r🔥 Files moved!\" + \" \"*15)\n",
 
210
  "\n",
211
  " if os.path.exists(temporarily_dir):\n",
212
  " copy_items_with_replace(temporarily_dir, webui_path)\n",
213
+ " _remove_dir(temporarily_dir)\n",
214
  "\n",
215
  "# ================= MAIN CODE ==================\n",
216
  "if os.path.exists(webui_path):\n",
217
  " if UI != OLD_UI:\n",
218
  " print(f'Switching the WebUI from \\033[33m{OLD_UI}\\033[0m to \\033[33m{UI}\\033[0m:\\n', end='')\n",
219
  " copy_items_with_replace(webui_path, temporarily_dir)\n",
220
+ " _remove_dir(webui_path)\n",
221
  " os.environ['SDW_OLD_UI'] = UI\n",
222
  " time.sleep(2)\n",
223
  " clear_output()\n",
 
233
  "\n",
234
  "## Changes extensions and WebUi\n",
235
  "if latest_webui or latest_exstensions:\n",
236
+ " action = \"WebUI and Extensions\" if latest_webui and latest_exstensions else (\"WebUI\" if latest_webui else \"Extensions\")\n",
237
+ " print(f\"⌚️ Updating {action}...\", end='')\n",
238
  " with capture.capture_output() as cap:\n",
239
  " !git config --global user.email \"you@example.com\"\n",
240
  " !git config --global user.name \"Your Name\"\n",
 
249
  " if latest_exstensions:\n",
250
  " !{'for dir in ' + webui_path + '/extensions/*/; do cd \\\"$dir\\\" && git reset --hard && git pull; done'}\n",
251
  " del cap\n",
252
+ " print(f\"\\r✨ Updating {action} Completed!\")\n",
253
  "\n",
254
  "\n",
255
  "# === FIXING EXTENSIONS ===\n",
 
269
  "\n",
270
  "## Version switching\n",
271
  "if commit_hash:\n",
272
+ " print('⏳ Time machine activation...', end=\"\")\n",
273
  " with capture.capture_output() as cap:\n",
274
  " %cd {webui_path}\n",
275
  " !git config --global user.email \"you@example.com\"\n",
 
597
  "\n",
598
  "## Install of Custom extensions\n",
599
  "if len(extension_repo) > 0:\n",
600
+ " print(\"✨ Installing custom extensions...\", end='')\n",
601
  " with capture.capture_output() as cap:\n",
602
  " for repo, repo_name in extension_repo:\n",
603
  " if not repo_name:\n",
files_cells/notebooks/ru/downloading_ru.ipynb CHANGED
@@ -118,6 +118,28 @@
118
  " start_colab = int(time.time()) - 5\n",
119
  " os.environ[\"START_COLAB\"] = str(start_colab)\n",
120
  "\n",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  "# Save files temporarily\n",
122
  "temporarily_dir = f'{root_path}/temp_dir'\n",
123
  "\n",
@@ -137,7 +159,7 @@
137
  "\n",
138
  " if os.path.exists(src):\n",
139
  " if os.path.exists(dst):\n",
140
- " shutil.rmtree(dst)\n",
141
  " os.makedirs(os.path.dirname(dst), exist_ok=True)\n",
142
  " shutil.move(src, dst)\n",
143
  " print(\"\\r🔥 Файлы перемещены!\" + \" \"*15)\n",
@@ -188,14 +210,14 @@
188
  "\n",
189
  " if os.path.exists(temporarily_dir):\n",
190
  " copy_items_with_replace(temporarily_dir, webui_path)\n",
191
- " shutil.rmtree(temporarily_dir)\n",
192
  "\n",
193
  "# ================= MAIN CODE ==================\n",
194
  "if os.path.exists(webui_path):\n",
195
  " if UI != OLD_UI:\n",
196
  " print(f'Переключение веб-интерфейса с \\033[33m{OLD_UI}\\033[0m на \\033[33m{UI}\\033[0m:\\n', end='')\n",
197
  " copy_items_with_replace(webui_path, temporarily_dir)\n",
198
- " shutil.rmtree(webui_path)\n",
199
  " os.environ['SDW_OLD_UI'] = UI\n",
200
  " time.sleep(2)\n",
201
  " clear_output()\n",
@@ -212,7 +234,7 @@
212
  "## Changes extensions and WebUi\n",
213
  "if latest_webui or latest_exstensions:\n",
214
  " action = \"WebUI и Расширений\" if latest_webui and latest_exstensions else (\"WebUI\" if latest_webui else \"Расширений\")\n",
215
- " print(f\"⌚️ Обновление {action}...\", end='', flush=True)\n",
216
  " with capture.capture_output() as cap:\n",
217
  " !git config --global user.email \"you@example.com\"\n",
218
  " !git config --global user.name \"Your Name\"\n",
@@ -247,7 +269,7 @@
247
  "\n",
248
  "## Version switching\n",
249
  "if commit_hash:\n",
250
- " print('⏳ Активация машины времени...', end=\"\", flush=True)\n",
251
  " with capture.capture_output() as cap:\n",
252
  " %cd {webui_path}\n",
253
  " !git config --global user.email \"you@example.com\"\n",
@@ -575,7 +597,7 @@
575
  "\n",
576
  "## Install of Custom extensions\n",
577
  "if len(extension_repo) > 0:\n",
578
- " print(\"✨ Установка кастомных расширений...\", end='', flush=True)\n",
579
  " with capture.capture_output() as cap:\n",
580
  " for repo, repo_name in extension_repo:\n",
581
  " if not repo_name:\n",
 
118
  " start_colab = int(time.time()) - 5\n",
119
  " os.environ[\"START_COLAB\"] = str(start_colab)\n",
120
  "\n",
121
+ "# remove directory func\n",
122
+ "def _remove_dir(directory_path, log=False):\n",
123
+ " if not directory_path:\n",
124
+ " raise ValueError(\"The directory path is empty\")\n",
125
+ "\n",
126
+ " try:\n",
127
+ " subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)\n",
128
+ " if log:\n",
129
+ " print(f\"Successfully executed: rm -rf {directory_path}\")\n",
130
+ " except subprocess.CalledProcessError as e:\n",
131
+ " if log:\n",
132
+ " print(f\"Failed to remove {directory_path} using rm -rf. Error: {e}\")\n",
133
+ "\n",
134
+ " if os.path.exists(directory_path):\n",
135
+ " try:\n",
136
+ " shutil.rmtree(directory_path)\n",
137
+ " if log:\n",
138
+ " print(f\"Successfully removed {directory_path} using shutil\")\n",
139
+ " except Exception as e:\n",
140
+ " if log:\n",
141
+ " print(f\"Failed to remove {directory_path} using shutil. Error: {e}\")\n",
142
+ "\n",
143
  "# Save files temporarily\n",
144
  "temporarily_dir = f'{root_path}/temp_dir'\n",
145
  "\n",
 
159
  "\n",
160
  " if os.path.exists(src):\n",
161
  " if os.path.exists(dst):\n",
162
+ " _remove_dir(dst)\n",
163
  " os.makedirs(os.path.dirname(dst), exist_ok=True)\n",
164
  " shutil.move(src, dst)\n",
165
  " print(\"\\r🔥 Файлы перемещены!\" + \" \"*15)\n",
 
210
  "\n",
211
  " if os.path.exists(temporarily_dir):\n",
212
  " copy_items_with_replace(temporarily_dir, webui_path)\n",
213
+ " _remove_dir(temporarily_dir)\n",
214
  "\n",
215
  "# ================= MAIN CODE ==================\n",
216
  "if os.path.exists(webui_path):\n",
217
  " if UI != OLD_UI:\n",
218
  " print(f'Переключение веб-интерфейса с \\033[33m{OLD_UI}\\033[0m на \\033[33m{UI}\\033[0m:\\n', end='')\n",
219
  " copy_items_with_replace(webui_path, temporarily_dir)\n",
220
+ " _remove_dir(webui_path)\n",
221
  " os.environ['SDW_OLD_UI'] = UI\n",
222
  " time.sleep(2)\n",
223
  " clear_output()\n",
 
234
  "## Changes extensions and WebUi\n",
235
  "if latest_webui or latest_exstensions:\n",
236
  " action = \"WebUI и Расширений\" if latest_webui and latest_exstensions else (\"WebUI\" if latest_webui else \"Расширений\")\n",
237
+ " print(f\"⌚️ Обновление {action}...\", end='')\n",
238
  " with capture.capture_output() as cap:\n",
239
  " !git config --global user.email \"you@example.com\"\n",
240
  " !git config --global user.name \"Your Name\"\n",
 
269
  "\n",
270
  "## Version switching\n",
271
  "if commit_hash:\n",
272
+ " print('⏳ Активация машины времени...', end=\"\")\n",
273
  " with capture.capture_output() as cap:\n",
274
  " %cd {webui_path}\n",
275
  " !git config --global user.email \"you@example.com\"\n",
 
597
  "\n",
598
  "## Install of Custom extensions\n",
599
  "if len(extension_repo) > 0:\n",
600
+ " print(\"✨ Установка кастомных расширений...\", end='')\n",
601
  " with capture.capture_output() as cap:\n",
602
  " for repo, repo_name in extension_repo:\n",
603
  " if not repo_name:\n",
files_cells/python/en/downloading_en.py CHANGED
@@ -108,6 +108,28 @@ else:
108
  start_colab = int(time.time()) - 5
109
  os.environ["START_COLAB"] = str(start_colab)
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  # Save files temporarily
112
  temporarily_dir = f'{root_path}/temp_dir'
113
 
@@ -127,7 +149,7 @@ def copy_items_with_replace(src_base, dst_base):
127
 
128
  if os.path.exists(src):
129
  if os.path.exists(dst):
130
- shutil.rmtree(dst)
131
  os.makedirs(os.path.dirname(dst), exist_ok=True)
132
  shutil.move(src, dst)
133
  print("\r🔥 Files moved!" + " "*15)
@@ -178,14 +200,14 @@ def unpack_webui():
178
 
179
  if os.path.exists(temporarily_dir):
180
  copy_items_with_replace(temporarily_dir, webui_path)
181
- shutil.rmtree(temporarily_dir)
182
 
183
  # ================= MAIN CODE ==================
184
  if os.path.exists(webui_path):
185
  if UI != OLD_UI:
186
  print(f'Switching the WebUI from \033[33m{OLD_UI}\033[0m to \033[33m{UI}\033[0m:\n', end='')
187
  copy_items_with_replace(webui_path, temporarily_dir)
188
- shutil.rmtree(webui_path)
189
  os.environ['SDW_OLD_UI'] = UI
190
  time.sleep(2)
191
  clear_output()
@@ -201,8 +223,8 @@ else:
201
 
202
  ## Changes extensions and WebUi
203
  if latest_webui or latest_exstensions:
204
- action = "Updating WebUI and Extensions" if latest_webui and latest_exstensions else ("WebUI Update" if latest_webui else "Update Extensions")
205
- print(f"⌚️ {action}...", end='', flush=True)
206
  with capture.capture_output() as cap:
207
  get_ipython().system('git config --global user.email "you@example.com"')
208
  get_ipython().system('git config --global user.name "Your Name"')
@@ -217,7 +239,7 @@ if latest_webui or latest_exstensions:
217
  if latest_exstensions:
218
  get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
219
  del cap
220
- print(f"\r✨ {action} Completed!")
221
 
222
 
223
  # === FIXING EXTENSIONS ===
@@ -237,7 +259,7 @@ del cap
237
 
238
  ## Version switching
239
  if commit_hash:
240
- print('⏳ Time machine activation...', end="", flush=True)
241
  with capture.capture_output() as cap:
242
  get_ipython().run_line_magic('cd', '{webui_path}')
243
  get_ipython().system('git config --global user.email "you@example.com"')
@@ -565,7 +587,7 @@ get_ipython().system('find {webui_path} \\( -type d \\( -name ".ipynb_checkpoint
565
 
566
  ## Install of Custom extensions
567
  if len(extension_repo) > 0:
568
- print("✨ Installing custom extensions...", end='', flush=True)
569
  with capture.capture_output() as cap:
570
  for repo, repo_name in extension_repo:
571
  if not repo_name:
 
108
  start_colab = int(time.time()) - 5
109
  os.environ["START_COLAB"] = str(start_colab)
110
 
111
+ # remove directory func
112
+ def _remove_dir(directory_path, log=False):
113
+ if not directory_path:
114
+ raise ValueError("The directory path is empty")
115
+
116
+ try:
117
+ subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)
118
+ if log:
119
+ print(f"Successfully executed: rm -rf {directory_path}")
120
+ except subprocess.CalledProcessError as e:
121
+ if log:
122
+ print(f"Failed to remove {directory_path} using rm -rf. Error: {e}")
123
+
124
+ if os.path.exists(directory_path):
125
+ try:
126
+ shutil.rmtree(directory_path)
127
+ if log:
128
+ print(f"Successfully removed {directory_path} using shutil")
129
+ except Exception as e:
130
+ if log:
131
+ print(f"Failed to remove {directory_path} using shutil. Error: {e}")
132
+
133
  # Save files temporarily
134
  temporarily_dir = f'{root_path}/temp_dir'
135
 
 
149
 
150
  if os.path.exists(src):
151
  if os.path.exists(dst):
152
+ _remove_dir(dst)
153
  os.makedirs(os.path.dirname(dst), exist_ok=True)
154
  shutil.move(src, dst)
155
  print("\r🔥 Files moved!" + " "*15)
 
200
 
201
  if os.path.exists(temporarily_dir):
202
  copy_items_with_replace(temporarily_dir, webui_path)
203
+ _remove_dir(temporarily_dir)
204
 
205
  # ================= MAIN CODE ==================
206
  if os.path.exists(webui_path):
207
  if UI != OLD_UI:
208
  print(f'Switching the WebUI from \033[33m{OLD_UI}\033[0m to \033[33m{UI}\033[0m:\n', end='')
209
  copy_items_with_replace(webui_path, temporarily_dir)
210
+ _remove_dir(webui_path)
211
  os.environ['SDW_OLD_UI'] = UI
212
  time.sleep(2)
213
  clear_output()
 
223
 
224
  ## Changes extensions and WebUi
225
  if latest_webui or latest_exstensions:
226
+ action = "WebUI and Extensions" if latest_webui and latest_exstensions else ("WebUI" if latest_webui else "Extensions")
227
+ print(f"⌚️ Updating {action}...", end='')
228
  with capture.capture_output() as cap:
229
  get_ipython().system('git config --global user.email "you@example.com"')
230
  get_ipython().system('git config --global user.name "Your Name"')
 
239
  if latest_exstensions:
240
  get_ipython().system('{\'for dir in \' + webui_path + \'/extensions/*/; do cd \\"$dir\\" && git reset --hard && git pull; done\'}')
241
  del cap
242
+ print(f"\r✨ Updating {action} Completed!")
243
 
244
 
245
  # === FIXING EXTENSIONS ===
 
259
 
260
  ## Version switching
261
  if commit_hash:
262
+ print('⏳ Time machine activation...', end="")
263
  with capture.capture_output() as cap:
264
  get_ipython().run_line_magic('cd', '{webui_path}')
265
  get_ipython().system('git config --global user.email "you@example.com"')
 
587
 
588
  ## Install of Custom extensions
589
  if len(extension_repo) > 0:
590
+ print("✨ Installing custom extensions...", end='')
591
  with capture.capture_output() as cap:
592
  for repo, repo_name in extension_repo:
593
  if not repo_name:
files_cells/python/ru/downloading_ru.py CHANGED
@@ -108,6 +108,28 @@ else:
108
  start_colab = int(time.time()) - 5
109
  os.environ["START_COLAB"] = str(start_colab)
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  # Save files temporarily
112
  temporarily_dir = f'{root_path}/temp_dir'
113
 
@@ -127,7 +149,7 @@ def copy_items_with_replace(src_base, dst_base):
127
 
128
  if os.path.exists(src):
129
  if os.path.exists(dst):
130
- shutil.rmtree(dst)
131
  os.makedirs(os.path.dirname(dst), exist_ok=True)
132
  shutil.move(src, dst)
133
  print("\r🔥 Файлы перемещены!" + " "*15)
@@ -178,14 +200,14 @@ def unpack_webui():
178
 
179
  if os.path.exists(temporarily_dir):
180
  copy_items_with_replace(temporarily_dir, webui_path)
181
- shutil.rmtree(temporarily_dir)
182
 
183
  # ================= MAIN CODE ==================
184
  if os.path.exists(webui_path):
185
  if UI != OLD_UI:
186
  print(f'Переключение веб-интерфейса с \033[33m{OLD_UI}\033[0m на \033[33m{UI}\033[0m:\n', end='')
187
  copy_items_with_replace(webui_path, temporarily_dir)
188
- shutil.rmtree(webui_path)
189
  os.environ['SDW_OLD_UI'] = UI
190
  time.sleep(2)
191
  clear_output()
@@ -202,7 +224,7 @@ else:
202
  ## Changes extensions and WebUi
203
  if latest_webui or latest_exstensions:
204
  action = "WebUI и Расширений" if latest_webui and latest_exstensions else ("WebUI" if latest_webui else "Расширений")
205
- print(f"⌚️ Обновление {action}...", end='', flush=True)
206
  with capture.capture_output() as cap:
207
  get_ipython().system('git config --global user.email "you@example.com"')
208
  get_ipython().system('git config --global user.name "Your Name"')
@@ -237,7 +259,7 @@ del cap
237
 
238
  ## Version switching
239
  if commit_hash:
240
- print('⏳ Активация машины времени...', end="", flush=True)
241
  with capture.capture_output() as cap:
242
  get_ipython().run_line_magic('cd', '{webui_path}')
243
  get_ipython().system('git config --global user.email "you@example.com"')
@@ -565,7 +587,7 @@ get_ipython().system('find {webui_path} \\( -type d \\( -name ".ipynb_checkpoint
565
 
566
  ## Install of Custom extensions
567
  if len(extension_repo) > 0:
568
- print("✨ Установка кастомных расширений...", end='', flush=True)
569
  with capture.capture_output() as cap:
570
  for repo, repo_name in extension_repo:
571
  if not repo_name:
 
108
  start_colab = int(time.time()) - 5
109
  os.environ["START_COLAB"] = str(start_colab)
110
 
111
+ # remove directory func
112
+ def _remove_dir(directory_path, log=False):
113
+ if not directory_path:
114
+ raise ValueError("The directory path is empty")
115
+
116
+ try:
117
+ subprocess.run(['rm', '-rf', directory_path], check=True, capture_output=True)
118
+ if log:
119
+ print(f"Successfully executed: rm -rf {directory_path}")
120
+ except subprocess.CalledProcessError as e:
121
+ if log:
122
+ print(f"Failed to remove {directory_path} using rm -rf. Error: {e}")
123
+
124
+ if os.path.exists(directory_path):
125
+ try:
126
+ shutil.rmtree(directory_path)
127
+ if log:
128
+ print(f"Successfully removed {directory_path} using shutil")
129
+ except Exception as e:
130
+ if log:
131
+ print(f"Failed to remove {directory_path} using shutil. Error: {e}")
132
+
133
  # Save files temporarily
134
  temporarily_dir = f'{root_path}/temp_dir'
135
 
 
149
 
150
  if os.path.exists(src):
151
  if os.path.exists(dst):
152
+ _remove_dir(dst)
153
  os.makedirs(os.path.dirname(dst), exist_ok=True)
154
  shutil.move(src, dst)
155
  print("\r🔥 Файлы перемещены!" + " "*15)
 
200
 
201
  if os.path.exists(temporarily_dir):
202
  copy_items_with_replace(temporarily_dir, webui_path)
203
+ _remove_dir(temporarily_dir)
204
 
205
  # ================= MAIN CODE ==================
206
  if os.path.exists(webui_path):
207
  if UI != OLD_UI:
208
  print(f'Переключение веб-интерфейса с \033[33m{OLD_UI}\033[0m на \033[33m{UI}\033[0m:\n', end='')
209
  copy_items_with_replace(webui_path, temporarily_dir)
210
+ _remove_dir(webui_path)
211
  os.environ['SDW_OLD_UI'] = UI
212
  time.sleep(2)
213
  clear_output()
 
224
  ## Changes extensions and WebUi
225
  if latest_webui or latest_exstensions:
226
  action = "WebUI и Расширений" if latest_webui and latest_exstensions else ("WebUI" if latest_webui else "Расширений")
227
+ print(f"⌚️ Обновление {action}...", end='')
228
  with capture.capture_output() as cap:
229
  get_ipython().system('git config --global user.email "you@example.com"')
230
  get_ipython().system('git config --global user.name "Your Name"')
 
259
 
260
  ## Version switching
261
  if commit_hash:
262
+ print('⏳ Активация машины времени...', end="")
263
  with capture.capture_output() as cap:
264
  get_ipython().run_line_magic('cd', '{webui_path}')
265
  get_ipython().system('git config --global user.email "you@example.com"')
 
587
 
588
  ## Install of Custom extensions
589
  if len(extension_repo) > 0:
590
+ print("✨ Установка кастомных расширений...", end='')
591
  with capture.capture_output() as cap:
592
  for repo, repo_name in extension_repo:
593
  if not repo_name: