chore(format): run black on dev (#1990)

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
github-actions[bot] 2024-04-21 02:01:51 +09:00 committed by GitHub
parent 229fe68818
commit 55f9b3262c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 6 deletions

View File

@ -55,6 +55,7 @@ vc = VC(config)
if not config.nocheck: if not config.nocheck:
from infer.lib.rvcmd import check_all_assets, download_all_assets from infer.lib.rvcmd import check_all_assets, download_all_assets
if not check_all_assets(): if not check_all_assets():
download_all_assets(tmpdir=tmp) download_all_assets(tmpdir=tmp)
if not check_all_assets(): if not check_all_assets():

View File

@ -114,7 +114,7 @@ def download_and_extract_tar_gz(url: str, folder: str):
import tarfile import tarfile
logger.info(f"downloading {url}") logger.info(f"downloading {url}")
response = requests.get(url, stream=True, timeout=(5,10)) response = requests.get(url, stream=True, timeout=(5, 10))
with BytesIO() as out_file: with BytesIO() as out_file:
out_file.write(response.content) out_file.write(response.content)
out_file.seek(0) out_file.seek(0)
@ -128,7 +128,7 @@ def download_and_extract_zip(url: str, folder: str):
import zipfile import zipfile
logger.info(f"downloading {url}") logger.info(f"downloading {url}")
response = requests.get(url, stream=True, timeout=(5,10)) response = requests.get(url, stream=True, timeout=(5, 10))
with BytesIO() as out_file: with BytesIO() as out_file:
out_file.write(response.content) out_file.write(response.content)
out_file.seek(0) out_file.seek(0)
@ -137,13 +137,15 @@ def download_and_extract_zip(url: str, folder: str):
zip_ref.extractall(folder) zip_ref.extractall(folder)
logger.info(f"extracted into {folder}") logger.info(f"extracted into {folder}")
def download_dns_yaml(url: str, folder: str): def download_dns_yaml(url: str, folder: str):
logger.info(f"downloading {url}") logger.info(f"downloading {url}")
response = requests.get(url, stream=True, timeout=(5,10)) response = requests.get(url, stream=True, timeout=(5, 10))
with open(f"{folder}/dns.yaml", "wb") as out_file: with open(f"{folder}/dns.yaml", "wb") as out_file:
out_file.write(response.content) out_file.write(response.content)
logger.info(f"downloaded into {folder}") logger.info(f"downloaded into {folder}")
def download_all_assets(tmpdir: str, version="0.2.2"): def download_all_assets(tmpdir: str, version="0.2.2"):
import subprocess import subprocess
import platform import platform
@ -169,7 +171,9 @@ def download_all_assets(tmpdir: str, version="0.2.2"):
logger.error(f"architecture {architecture} is not supported") logger.error(f"architecture {architecture} is not supported")
exit(1) exit(1)
try: try:
BASE_URL = "https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/" BASE_URL = (
"https://github.com/RVC-Project/RVC-Models-Downloader/releases/download/"
)
suffix = "zip" if is_win else "tar.gz" suffix = "zip" if is_win else "tar.gz"
RVCMD_URL = BASE_URL + f"v{version}/rvcmd_{system_type}_{architecture}.{suffix}" RVCMD_URL = BASE_URL + f"v{version}/rvcmd_{system_type}_{architecture}.{suffix}"
cmdfile = tmpdir + "/rvcmd" cmdfile = tmpdir + "/rvcmd"
@ -192,11 +196,16 @@ def download_all_assets(tmpdir: str, version="0.2.2"):
"windows_amd64": "427", "windows_amd64": "427",
}[f"{system_type}_{architecture}"] }[f"{system_type}_{architecture}"]
RVCMD_URL = BASE_URL + suffix RVCMD_URL = BASE_URL + suffix
download_dns_yaml("https://raw.gitcode.com/u011570312/RVC-Models-Downloader/raw/main/dns.yaml", tmpdir) download_dns_yaml(
"https://raw.gitcode.com/u011570312/RVC-Models-Downloader/raw/main/dns.yaml",
tmpdir,
)
if is_win: if is_win:
download_and_extract_zip(RVCMD_URL, tmpdir) download_and_extract_zip(RVCMD_URL, tmpdir)
cmdfile += ".exe" cmdfile += ".exe"
else: else:
download_and_extract_tar_gz(RVCMD_URL, tmpdir) download_and_extract_tar_gz(RVCMD_URL, tmpdir)
os.chmod(cmdfile, 0o755) os.chmod(cmdfile, 0o755)
subprocess.run([cmdfile, "-notui", "-w", "0", "-dns", f"{tmpdir}/dns.yaml", "assets/all"]) subprocess.run(
[cmdfile, "-notui", "-w", "0", "-dns", f"{tmpdir}/dns.yaml", "assets/all"]
)