round-12: ruff hygiene on migration code (import sort, narrow store except)
- test_chv_muse_round12.py: drop unused socket/time imports, drop unnecessary sys.path.insert (P3 pattern needs none), sort method-local imports (activity/capabilities, approval_card/channel/sentinel) - audit_trail.py: single-line method-local imports (I001) - swarm.py / presentation.py / browser_tasks.py: store-path fail-safe except narrowed from bare Exception to (sqlite3.Error, OSError) (DB/file failures only); transport spawn/ping/close handlers in browser_tasks.py deliberately stay bare Exception (arbitrary transport errors must map to failed/False/close_error) - NOT fixed (pre-existing style, left as-is): UP031 % formatting (used throughout the codebase incl. the copied lines), BLE001/ TRY004 in untouched code, F401 atomic_write + RUF059 swarm (P7/P8 pre-existing)
This commit is contained in:
1 parent
da8d0c29fd
commit
414e245752
5 files changed
+21
-24
No files matched your search
@@ -338,8 +338,7 @@ class StoreAuditTrail:
|
||||
|
||||
def _open_store(self):
|
||||
"""打开宿主级状态库(每次调用新建连接,用完即关)。"""
|
||||
from cloud.chv.app_state import AppStateStore, \
|
||||
host_state_db_path
|
||||
from cloud.chv.app_state import AppStateStore, host_state_db_path
|
||||
store = AppStateStore(host_state_db_path(self.state_dir))
|
||||
store.open()
|
||||
return store
|
||||
@@ -453,8 +452,7 @@ def migrate_jsonl_to_store(path: str, state_dir: str) -> int:
|
||||
raise ValueError("JSONL 审计链校验失败,拒绝迁移:行 %d"
|
||||
% bad)
|
||||
rows = trail._read_all()
|
||||
from cloud.chv.app_state import AppStateStore, \
|
||||
host_state_db_path
|
||||
from cloud.chv.app_state import AppStateStore, host_state_db_path
|
||||
store = AppStateStore(host_state_db_path(state_dir))
|
||||
store.open()
|
||||
try:
|
||||
|
||||
Reference in new issue
Block a user