This commit is contained in:
HuangHai
2026-01-20 14:05:19 +08:00
parent 646f3acd6d
commit d89388ab51
89 changed files with 12526 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
from typing import TypedDict, Optional
from pathlib import Path
import yaml
class DownloadConfig(TypedDict):
max_concurrent: int
chunk_size: int
retry_times: int
timeout: int
class LoggingConfig(TypedDict):
level: str
file_path: str
max_size: int
backup_count: int
class Config:
def __init__(self, config_path: Path):
with open(config_path) as f:
self.config = yaml.safe_load(f)
@property
def download_config(self) -> DownloadConfig:
return self.config.get('download', {})
@property
def logging_config(self) -> LoggingConfig:
return self.config.get('logging', {})