Skip to content

The only downloader you need. 下载器的集大成者。

style: 删掉最近提交里写的注释

XiaoYouChR070aec941a3e
diff --git a/Ghost-Downloader-3.py b/Ghost-Downloader-3.py
index dcbeb74f..60d8859e 100644
--- a/Ghost-Downloader-3.py
+++ b/Ghost-Downloader-3.py
@@ -149,7 +149,7 @@ def startApp(application, isSilent=False):
from PySide6.QtCore import QEventLoop
from app.view.windows.oobe_window import OobeWindow
- engine.start() # OOBE 期间可完成扩展配对
+ engine.start()
oobe = OobeWindow(browserService, engine.browserServer, coroutineRunner, featureService, engine.runtimeStatusService)
def onOobePairRequestChanged(request):
diff --git a/app/engine.py b/app/engine.py
index 813c339d..a3055ed2 100644
--- a/app/engine.py
+++ b/app/engine.py
@@ -1,4 +1,3 @@
-"""桌面和 Android 共用的服务图与启停顺序。平台差异在构造时注入。"""
from __future__ import annotations
from app.config.cfg import cfg
@@ -14,8 +13,6 @@ from app.services.task_service import NameConflictChoice, TaskService
class Engine:
- """不发信号、不持有 View;View 直接连接各服务的信号。coroutineRunner 由组合根创建并启停。"""
-
def __init__(self, coroutineRunner, fileWatcher, loadCrx, deleteRecoverably) -> None:
self.coroutineRunner = coroutineRunner
self.categoryService = CategoryService()
diff --git a/app/services/aria2_rpc.py b/app/services/aria2_rpc.py
index 527959f3..1c2a46aa 100644
--- a/app/services/aria2_rpc.py
+++ b/app/services/aria2_rpc.py
@@ -105,11 +105,6 @@ def toHeaders(options: dict) -> dict[str, str]:
class Aria2RpcService:
- """aria2 JSON-RPC 的最小兼容:getVersion、getGlobalOption 与 addUri,HTTP POST 与 WebSocket 共用 /jsonrpc。
-
- handle 在 loop 线程运行;解析完成的 Task 在 dispatcher 线程交给 addTask,或经 taskDraftRequested 进草稿。
- """
-
taskDraftRequested = Signal(list)
parseFailed = Signal(str, object)
diff --git a/app/services/browser_service.py b/app/services/browser_service.py
index 92a9d90b..6b801c1b 100644
--- a/app/services/browser_service.py
+++ b/app/services/browser_service.py
@@ -184,8 +184,6 @@ def toTaskSummary(task: Task) -> dict:
class BrowserService:
- """浏览器扩展的协议适配器。handle 在 loop 线程收发帧;会话与 Pair Request 只在 dispatcher 线程读写。"""
-
pairRequestChanged = Signal(object)
connectionChanged = Signal()
protocolMismatched = Signal()
diff --git a/app/services/loopback_server.py b/app/services/loopback_server.py
index 23abc3d6..0fd11ba9 100644
--- a/app/services/loopback_server.py
+++ b/app/services/loopback_server.py
@@ -42,7 +42,6 @@ def createSocket(host: str, port: int) -> socket.socket:
family = socket.AF_INET6 if ":" in host else socket.AF_INET
sock = socket.socket(family, socket.SOCK_STREAM)
try:
- # Windows 的 SO_REUSEADDR 允许抢占正在监听的端口,那样端口冲突就检测不到了
if sys.platform != "win32":
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
if family == socket.AF_INET6:
@@ -57,11 +56,6 @@ def createSocket(host: str, port: int) -> socket.socket:
class LoopbackServer:
- """按 isEnabled/port 配置在 127.0.0.1 与 ::1 上监听,拥有全部连接。
-
- 公开方法只在 dispatcher 线程调用;socket 只在 loop 线程上按提交顺序打开和关闭。
- """
-
stateChanged = Signal(object)
def __init__(self, coroutineRunner, handle: Handle, *, isEnabled, port) -> None:
diff --git a/app/services/websocket_stream.py b/app/services/websocket_stream.py
index 71743284..08fac14c 100644
--- a/app/services/websocket_stream.py
+++ b/app/services/websocket_stream.py
@@ -19,8 +19,6 @@ async def readHead(reader: asyncio.StreamReader) -> bytes | None:
class WebSocketStream:
- """RFC 6455 服务端连接:ping、close 回应、分片重组、大小上限由 ServerProtocol 处理。只在 loop 线程使用。"""
-
def __init__(self, protocol: ServerProtocol, reader: asyncio.StreamReader, writer: asyncio.StreamWriter) -> None:
self._protocol = protocol
self._reader = reader
@@ -30,7 +28,6 @@ class WebSocketStream:
async def open(cls, reader: asyncio.StreamReader, writer: asyncio.StreamWriter,
head: bytes, maxSize: int) -> WebSocketStream | None:
protocol = ServerProtocol(max_size=maxSize)
- # ServerProtocol 只认自己解析出的握手;手工构造 Request 会让它停在 HTTP 解析状态,吞掉后续帧
protocol.receive_data(head)
protocol.send_response(protocol.accept(protocol.events_received()[0]))
stream = cls(protocol, reader, writer)
diff --git a/app/signal.py b/app/signal.py
index 1af61cdc..ddc591ab 100644
--- a/app/signal.py
+++ b/app/signal.py
@@ -29,7 +29,6 @@ class BoundSignal:
self._slots: list[Callable | weakref.WeakMethod] = []
def connect(self, slot: Callable, owner=None) -> None:
- """owner 是比信号源短命的 QObject:它销毁时自动断开,否则被引用环拖住的包装对象会让槽打到已删除的控件上。"""
entry: Callable | weakref.WeakMethod = slot
if hasattr(slot, "__self__") and hasattr(slot, "__func__"):
try:
diff --git a/app/startup.py b/app/startup.py
index 8e967dd0..a798f0f1 100644
--- a/app/startup.py
+++ b/app/startup.py
@@ -1,4 +1,3 @@
-"""桌面端独有的准备步骤,每步自成一体、不碰 View。各步的顺序和服务与 View 之间的接线由入口 Ghost-Downloader-3.py 决定。"""
from __future__ import annotations
diff --git a/features/bili_pack/android.py b/features/bili_pack/android.py
index 6331fa4e..eca29aed 100644
--- a/features/bili_pack/android.py
+++ b/features/bili_pack/android.py
@@ -49,8 +49,6 @@ def init(pack) -> dict:
return {"accountState": _account.accountChanged, "qrState": _account.qrStateChanged}
-# ---- task/draft serialization (called by bridge.py internally) ----
-
def taskFields(task) -> dict:
return {
"fileSelectKind": "season" if task.isSeason else "pages",
@@ -125,8 +123,6 @@ def draftFields(task) -> dict:
}
-# ---- draft mutations (called by bridge.py setDraft dispatcher) ----
-
def setControl(task, controlId: str, value: str):
if controlId == "video":
task.isVideoEnabled = bool(value)
diff --git a/tests/test_android_name_conflict.py b/tests/test_android_name_conflict.py
index b7348e9f..4da3c8b2 100644
--- a/tests/test_android_name_conflict.py
+++ b/tests/test_android_name_conflict.py
@@ -1,4 +1,3 @@
-"""bridge 只把 NameConflictQueue 的询问投影给 Kotlin,并把回复转回队列。"""
import json
from pathlib import Path
from types import SimpleNamespace
diff --git a/tests/test_github_probe.py b/tests/test_github_probe.py
index 44f54ae5..1ccc52d0 100644
--- a/tests/test_github_probe.py
+++ b/tests/test_github_probe.py
@@ -1,7 +1,3 @@
-"""GitHub 加速的选站:响应判定规则与竞速。
-
-使用本地 aiohttp 服务器模拟 Proxy Site,不连外网。
-"""
from __future__ import annotations
import asyncio
diff --git a/tests/test_http_subworker.py b/tests/test_http_subworker.py
index e1b7384a..d41c1aa5 100644
--- a/tests/test_http_subworker.py
+++ b/tests/test_http_subworker.py
@@ -641,7 +641,6 @@ class TestStallRecovery:
releaseHang.set()
async def test_dead_client_retries_on_a_new_one(self, server, tmp_path, monkeypatch):
- """A client that cannot fetch is closed, and the next attempt finishes the file on a new one."""
content = buildFileContent(500)
firstAttempt = True
@@ -685,7 +684,6 @@ class TestStallRecovery:
class TestInitialStart:
async def test_initial_subworkers_start_together(self, server, tmp_path, monkeypatch):
- """Only split subworkers wait their turn. The initial ones send their requests at once."""
content = buildFileContent(800)
rangeHandler = buildRangeHandler(content)
requestTimes = []
diff --git a/tests/test_name_conflict_queue.py b/tests/test_name_conflict_queue.py
index 7a673f46..3b95f56b 100644
--- a/tests/test_name_conflict_queue.py
+++ b/tests/test_name_conflict_queue.py
@@ -1,4 +1,3 @@
-"""逐个询问 Name Conflict:同一轮加入的冲突收齐后再问,询问内容是不会变的快照。"""
from pathlib import Path
from types import SimpleNamespace
diff --git a/tests/test_task_layout.py b/tests/test_task_layout.py
index 15e8cc39..a196b80a 100644
--- a/tests/test_task_layout.py
+++ b/tests/test_task_layout.py
@@ -1,8 +1,3 @@
-"""Task 在 Output Folder 中的布局:Placeholder、Part Path。
-
-Seam P1: TaskStore.add / Task.deleteFiles / deletePlaceholders / placeholderPaths
-Seam P2: Task.run
-"""
from __future__ import annotations
from dataclasses import dataclass