mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-08 00:46:57 +08:00
fix typing
This commit is contained in:
@@ -128,7 +128,7 @@ class StorageBase(metaclass=ABCMeta):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: str = None) -> Optional[schemas.FileItem]:
|
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: Optional[str] = None) -> Optional[schemas.FileItem]:
|
||||||
"""
|
"""
|
||||||
上传文件
|
上传文件
|
||||||
:param fileitem: 上传目录项
|
:param fileitem: 上传目录项
|
||||||
|
|||||||
@@ -209,7 +209,7 @@ class AliPan(StorageBase, metaclass=Singleton):
|
|||||||
elif driver.category == "backup":
|
elif driver.category == "backup":
|
||||||
self.__update_params({"backDriveId": driver.drive_id})
|
self.__update_params({"backDriveId": driver.drive_id})
|
||||||
|
|
||||||
def __get_fileitem(self, fileinfo: BaseFile, parent: str = "/") -> schemas.FileItem:
|
def __get_fileitem(self, fileinfo: BaseFile, parent: Optional[str] = "/") -> schemas.FileItem:
|
||||||
"""
|
"""
|
||||||
获取文件信息
|
获取文件信息
|
||||||
"""
|
"""
|
||||||
@@ -374,7 +374,8 @@ class AliPan(StorageBase, metaclass=Singleton):
|
|||||||
return Path(local_path)
|
return Path(local_path)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: str = None) -> Optional[schemas.FileItem]:
|
def upload(self, fileitem: schemas.FileItem, path: Path,
|
||||||
|
new_name: Optional[str] = None) -> Optional[schemas.FileItem]:
|
||||||
"""
|
"""
|
||||||
上传文件,并标记完成
|
上传文件,并标记完成
|
||||||
:param fileitem: 上传目录项
|
:param fileitem: 上传目录项
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ class Alist(StorageBase, metaclass=Singleton):
|
|||||||
def list(
|
def list(
|
||||||
self,
|
self,
|
||||||
fileitem: schemas.FileItem,
|
fileitem: schemas.FileItem,
|
||||||
password: str = "",
|
password: Optional[str] = "",
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
per_page: int = 0,
|
per_page: int = 0,
|
||||||
refresh: bool = False,
|
refresh: bool = False,
|
||||||
@@ -291,7 +291,7 @@ class Alist(StorageBase, metaclass=Singleton):
|
|||||||
def get_item(
|
def get_item(
|
||||||
self,
|
self,
|
||||||
path: Path,
|
path: Path,
|
||||||
password: str = "",
|
password: Optional[str] = "",
|
||||||
page: int = 1,
|
page: int = 1,
|
||||||
per_page: int = 0,
|
per_page: int = 0,
|
||||||
refresh: bool = False,
|
refresh: bool = False,
|
||||||
@@ -468,7 +468,7 @@ class Alist(StorageBase, metaclass=Singleton):
|
|||||||
self,
|
self,
|
||||||
fileitem: schemas.FileItem,
|
fileitem: schemas.FileItem,
|
||||||
path: Path = None,
|
path: Path = None,
|
||||||
password: str = "",
|
password: Optional[str] = "",
|
||||||
) -> Optional[Path]:
|
) -> Optional[Path]:
|
||||||
"""
|
"""
|
||||||
下载文件,保存到本地,返回本地临时文件地址
|
下载文件,保存到本地,返回本地临时文件地址
|
||||||
@@ -547,7 +547,7 @@ class Alist(StorageBase, metaclass=Singleton):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def upload(
|
def upload(
|
||||||
self, fileitem: schemas.FileItem, path: Path, new_name: str = None, task: bool = False
|
self, fileitem: schemas.FileItem, path: Path, new_name: Optional[str] = None, task: bool = False
|
||||||
) -> Optional[schemas.FileItem]:
|
) -> Optional[schemas.FileItem]:
|
||||||
"""
|
"""
|
||||||
上传文件
|
上传文件
|
||||||
|
|||||||
@@ -191,7 +191,7 @@ class LocalStorage(StorageBase):
|
|||||||
"""
|
"""
|
||||||
return Path(fileitem.path)
|
return Path(fileitem.path)
|
||||||
|
|
||||||
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: str = None) -> Optional[schemas.FileItem]:
|
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: Optional[str] = None) -> Optional[schemas.FileItem]:
|
||||||
"""
|
"""
|
||||||
上传文件
|
上传文件
|
||||||
:param fileitem: 上传目录项
|
:param fileitem: 上传目录项
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class Rclone(StorageBase):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def __get_rcloneitem(self, item: dict, parent: str = "/") -> schemas.FileItem:
|
def __get_rcloneitem(self, item: dict, parent: Optional[str] = "/") -> schemas.FileItem:
|
||||||
"""
|
"""
|
||||||
获取rclone文件项
|
获取rclone文件项
|
||||||
"""
|
"""
|
||||||
@@ -254,7 +254,8 @@ class Rclone(StorageBase):
|
|||||||
logger.error(f"rclone复制文件失败:{err}")
|
logger.error(f"rclone复制文件失败:{err}")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def upload(self, fileitem: schemas.FileItem, path: Path, new_name: str = None) -> Optional[schemas.FileItem]:
|
def upload(self, fileitem: schemas.FileItem, path: Path,
|
||||||
|
new_name: Optional[str] = None) -> Optional[schemas.FileItem]:
|
||||||
"""
|
"""
|
||||||
上传文件
|
上传文件
|
||||||
:param fileitem: 上传目录项
|
:param fileitem: 上传目录项
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class U115Pan(StorageBase, metaclass=Singleton):
|
|||||||
return result.get("data")
|
return result.get("data")
|
||||||
|
|
||||||
def _request_api(self, method: str, endpoint: str,
|
def _request_api(self, method: str, endpoint: str,
|
||||||
result_key: str = None, **kwargs) -> Optional[Union[dict, list]]:
|
result_key: Optional[str] = None, **kwargs) -> Optional[Union[dict, list]]:
|
||||||
"""
|
"""
|
||||||
带错误处理和速率限制的API请求
|
带错误处理和速率限制的API请求
|
||||||
"""
|
"""
|
||||||
@@ -395,7 +395,7 @@ class U115Pan(StorageBase, metaclass=Singleton):
|
|||||||
modify_time=int(time.time())
|
modify_time=int(time.time())
|
||||||
)
|
)
|
||||||
|
|
||||||
def upload(self, target_dir: schemas.FileItem, local_path: Path, new_name: str = None) -> schemas.FileItem:
|
def upload(self, target_dir: schemas.FileItem, local_path: Path, new_name: Optional[str] = None) -> schemas.FileItem:
|
||||||
"""
|
"""
|
||||||
实现带秒传、断点续传和二次认证的文件上传
|
实现带秒传、断点续传和二次认证的文件上传
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user