fix cython type error

This commit is contained in:
jxxghp
2025-03-23 21:39:37 +08:00
parent 740cf12c11
commit f9b0db623d
113 changed files with 812 additions and 779 deletions
+10 -10
View File
@@ -78,8 +78,8 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
server.reconnect()
def download(self, content: Union[Path, str], download_dir: Path, cookie: str,
episodes: Set[int] = None, category: str = None, label: str = None,
downloader: str = None) -> Optional[Tuple[Optional[str], Optional[str], Optional[str], str]]:
episodes: Set[int] = None, category: Optional[str] = None, label: Optional[str] = None,
downloader: Optional[str] = None) -> Optional[Tuple[Optional[str], Optional[str], Optional[str], str]]:
"""
根据种子文件,选择并添加下载任务
:param content: 种子文件地址或者磁力链接
@@ -208,7 +208,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
def list_torrents(self, status: TorrentStatus = None,
hashs: Union[list, str] = None,
downloader: str = None
downloader: Optional[str] = None
) -> Optional[List[Union[TransferTorrent, DownloadingTorrent]]]:
"""
获取下载器种子列表
@@ -293,7 +293,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
return None
return ret_torrents
def transfer_completed(self, hashs: str, downloader: str = None) -> None:
def transfer_completed(self, hashs: str, downloader: Optional[str] = None) -> None:
"""
转移完成后的处理
:param hashs: 种子Hash
@@ -304,8 +304,8 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
return None
server.set_torrents_tag(ids=hashs, tags=['已整理'])
def remove_torrents(self, hashs: Union[str, list], delete_file: bool = True,
downloader: str = None) -> Optional[bool]:
def remove_torrents(self, hashs: Union[str, list], delete_file: Optional[bool] = True,
downloader: Optional[str] = None) -> Optional[bool]:
"""
删除下载器种子
:param hashs: 种子Hash
@@ -319,7 +319,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
return server.delete_torrents(delete_file=delete_file, ids=hashs)
def start_torrents(self, hashs: Union[list, str],
downloader: str = None) -> Optional[bool]:
downloader: Optional[str] = None) -> Optional[bool]:
"""
开始下载
:param hashs: 种子Hash
@@ -331,7 +331,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
return None
return server.start_torrents(ids=hashs)
def stop_torrents(self, hashs: Union[list, str], downloader: str = None) -> Optional[bool]:
def stop_torrents(self, hashs: Union[list, str], downloader: Optional[str] = None) -> Optional[bool]:
"""
停止下载
:param hashs: 种子Hash
@@ -343,7 +343,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
return None
return server.stop_torrents(ids=hashs)
def torrent_files(self, tid: str, downloader: str = None) -> Optional[TorrentFilesList]:
def torrent_files(self, tid: str, downloader: Optional[str] = None) -> Optional[TorrentFilesList]:
"""
获取种子文件列表
"""
@@ -352,7 +352,7 @@ class QbittorrentModule(_ModuleBase, _DownloaderBase[Qbittorrent]):
return None
return server.get_files(tid=tid)
def downloader_info(self, downloader: str = None) -> Optional[List[schemas.DownloaderInfo]]:
def downloader_info(self, downloader: Optional[str] = None) -> Optional[List[schemas.DownloaderInfo]]:
"""
下载器信息
"""
+14 -14
View File
@@ -12,20 +12,20 @@ from app.utils.string import StringUtils
class Qbittorrent:
_host: str = None
_host: Optional[str] = None
_port: int = None
_username: str = None
_password: str = None
_category: bool = False
_sequentail: bool = False
_force_resume: bool = False
_username: Optional[str] = None
_password: Optional[str] = None
_category: Optional[bool] = False
_sequentail: Optional[bool] = False
_force_resume: Optional[bool] = False
qbc: Client = None
def __init__(self, host: str = None, port: int = None,
username: str = None, password: str = None,
category: bool = False, sequentail: bool = False,
force_resume: bool = False, first_last_piece=False,
def __init__(self, host: Optional[str] = None, port: int = None,
username: Optional[str] = None, password: Optional[str] = None,
category: Optional[bool] = False, sequentail: Optional[bool] = False,
force_resume: Optional[bool] = False, first_last_piece=False,
**kwargs):
"""
若不设置参数,则创建配置文件设置的下载器
@@ -236,11 +236,11 @@ class Qbittorrent:
def add_torrent(self,
content: Union[str, bytes],
is_paused: bool = False,
download_dir: str = None,
is_paused: Optional[bool] = False,
download_dir: Optional[str] = None,
tag: Union[str, list] = None,
category: str = None,
cookie=None,
category: Optional[str] = None,
cookie: Optional[str] = None,
**kwargs
) -> bool:
"""