mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 12:51:35 +00:00
🔥 删除无用代码
This commit is contained in:
parent
5c263ad83d
commit
6f16002faf
@ -11,11 +11,11 @@ from metadata.honey import HONEY_RESERVED_ID_MAP
|
||||
from metadata.shortname import roleToId, roles
|
||||
from modules.wiki.base import SCRAPE_HOST
|
||||
from utils.const import PROJECT_ROOT
|
||||
from utils.helpers import mkdir
|
||||
from utils.log import logger
|
||||
from utils.typedefs import StrOrURL
|
||||
|
||||
ASSETS_PATH = PROJECT_ROOT.joinpath('resources/assets')
|
||||
ASSETS_PATH.mkdir(exist_ok=True)
|
||||
ASSETS_PATH.mkdir(exist_ok=True, parents=True)
|
||||
|
||||
|
||||
class _AssetsService(ABC):
|
||||
@ -26,7 +26,9 @@ class _AssetsService(ABC):
|
||||
|
||||
@property
|
||||
def path(self) -> Path:
|
||||
return mkdir(self._dir.joinpath(self.id))
|
||||
path = self._dir.joinpath(self.id)
|
||||
path.mkdir(exist_ok=True, parents=True)
|
||||
return path
|
||||
|
||||
def __init__(self, client: AsyncClient):
|
||||
self._client = client
|
||||
|
@ -1,7 +1,7 @@
|
||||
import hashlib
|
||||
import os
|
||||
from pathlib import Path
|
||||
from typing import Iterator, Optional, Tuple, Union, cast
|
||||
from typing import Optional, Tuple, Union, cast
|
||||
|
||||
import aiofiles
|
||||
import genshin
|
||||
@ -130,21 +130,3 @@ def region_server(uid: Union[int, str]) -> RegionEnum:
|
||||
return region
|
||||
else:
|
||||
raise TypeError(f"UID {uid} isn't associated with any region")
|
||||
|
||||
|
||||
def mkdir(path: Path) -> Path:
|
||||
"""根据路径依次创建文件夹"""
|
||||
path_list = []
|
||||
|
||||
parent = path.parent if path.suffix else path
|
||||
while not parent.exists():
|
||||
path_list.append(parent)
|
||||
try:
|
||||
parent.mkdir(exist_ok=True)
|
||||
except FileNotFoundError:
|
||||
parent = parent.parent
|
||||
|
||||
while path_list:
|
||||
path_list.pop().mkdir(exist_ok=True)
|
||||
|
||||
return path
|
||||
|
Loading…
Reference in New Issue
Block a user