From afdb5d4328c65d55591f04e5581e0e0fe44c5e92 Mon Sep 17 00:00:00 2001 From: Bean Date: Sat, 20 Jul 2024 11:56:37 +0800 Subject: [PATCH] feat: Config add get function --- src/yuanfen/config.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/yuanfen/config.py b/src/yuanfen/config.py index 09826d7..c79f19b 100644 --- a/src/yuanfen/config.py +++ b/src/yuanfen/config.py @@ -31,6 +31,9 @@ def __new__(cls, path, poll=True, logger=None): def __getitem__(self, key): return self.data.get(key, None) + def get(self, key, default=None): + return self.data.get(key, default) + def load(self): with open(self.file_path, "r", encoding="utf-8") as f: if self.file_path.endswith(".json"):