试图移植

This commit is contained in:
2025-11-02 23:42:53 +08:00
parent f86187868b
commit 0e08fb3a41
18 changed files with 689 additions and 156 deletions

View File

@@ -33,3 +33,14 @@ class ConfigFile:
def get(self, key: str, default: typing.Any = None) -> typing.Any:
"""获取配置值,如果不存在返回默认值"""
return self.data.get(key, default)
def __getitem__(self, key: str) -> typing.Any:
return self.data[key]
def __setitem__(self, key: str, value: typing.Any):
self.data[key] = value
self.save()
def __contains__(self, key: str) -> bool:
"""支持 in 语法"""
return key in self.data