MCPcopy
hub / github.com/tickmao/Novel / __init__

Method __init__

scripts/safe_updater.py:44–60  ·  view source on GitHub ↗

初始化安全更新器 Args: base_dir: 基础目录,默认为 sources/legado

(self, base_dir: Path = None)

Source from the content-addressed store, hash-verified

42 ]
43
44 def __init__(self, base_dir: Path = None):
45 """
46 初始化安全更新器
47
48 Args:
49 base_dir: 基础目录,默认为 sources/legado
50 """
51 self.base_dir = resolve_legado_dir(base_dir)
52 self.main_dir = self.base_dir / 'main'
53 self.backup_dir = self.main_dir / 'backups'
54 self.main_file = canonical_source_file(self.base_dir)
55 self.compatibility_file = compatibility_source_file(self.base_dir)
56 self.policy = SourcePolicy(self.base_dir.parent.parent)
57
58 # 确保目录存在
59 self.main_dir.mkdir(parents=True, exist_ok=True)
60 self.backup_dir.mkdir(parents=True, exist_ok=True)
61
62 def validate_sources(self, sources: List[Dict]) -> Tuple[bool, str]:
63 """

Callers

nothing calls this directly

Calls 4

resolve_legado_dirFunction · 0.90
canonical_source_fileFunction · 0.90
SourcePolicyClass · 0.90

Tested by

no test coverage detected