Skip to content

Commit

Permalink
简化uuid生成
Browse files Browse the repository at this point in the history
  • Loading branch information
Suisuroru committed Sep 21, 2024
1 parent 377032d commit 846cff1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Suya_Downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
import sys
import threading
import tkinter as tk
import uuid
from errno import EEXIST
from getpass import getuser
from queue import Queue
from socket import AF_INET
from tempfile import mkdtemp, NamedTemporaryFile
from time import time, sleep
from tkinter import scrolledtext, ttk, filedialog, messagebox as msgbox
from uuid import uuid4 as uuid
from webbrowser import open as webopen
from winreg import OpenKey, HKEY_CURRENT_USER, QueryValueEx
from zipfile import ZipFile, BadZipFile
Expand Down Expand Up @@ -1398,7 +1398,7 @@ def download_and_install(update_url, version):
temp_dir = mkdtemp()

# 生成一个随机的 UUID 字符串,并转换为纯数字的子串作为文件名
random_filename = str(uuid.uuid4()) + ".zip"
random_filename = str(uuid()) + ".zip"
temp_zip_file = os.path.join(temp_dir, random_filename)

# 将响应内容写入临时文件
Expand Down
4 changes: 2 additions & 2 deletions Updater.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
import shutil
import sys
import threading
import uuid
from tempfile import mkdtemp
from tkinter import messagebox as msgbox
from uuid import uuid4 as uuid
from zipfile import ZipFile

import requests
Expand Down Expand Up @@ -200,7 +200,7 @@ def download_and_install(downloader_update_url, updater_method_inner):
# 定义临时目录和临时文件
temp_dir = mkdtemp()
# 生成一个随机的 UUID 字符串,并转换为纯数字的子串作为文件名
random_filename = str(uuid.uuid4()) + ".zip"
random_filename = str(uuid()) + ".zip"
temp_zip_file = os.path.join(temp_dir, random_filename)
# 将响应内容写入临时文件
with open(temp_zip_file, "wb", encoding="utf-8") as f:
Expand Down

0 comments on commit 846cff1

Please sign in to comment.