From b27979ef48a32b5a47e99a1f9cd90d91f27518e9 Mon Sep 17 00:00:00 2001 From: lixiaoyong1 Date: Wed, 11 Dec 2024 10:14:48 -0500 Subject: [PATCH] Add function get_str_v --- common/global_call.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/common/global_call.py b/common/global_call.py index 3433ef7..4289d94 100644 --- a/common/global_call.py +++ b/common/global_call.py @@ -22,6 +22,23 @@ class GlobalCall: output_hotspot_file = "hotspotInfo.txt" output_custom_file = "custom.txt" + @staticmethod + def get_str_v(k , default ): + cfg = Config.get_json_dict() + arr = k.strip().split('.') + + while 1 < len(arr): + if arr[0] not in cfg: + return False, default + + cfg = cfg[arr[0]] + arr.remove(arr[0]) + + if arr[0] in cfg: + return True, str(cfg[arr[0]]) + else: + return False, default + @staticmethod def get_json_value(k , default, cfg = Config.get_json_dict()): ''' -- Gitee