From 701105a6b68676f44f72d41a58ca348c40bf0db2 Mon Sep 17 00:00:00 2001 From: wt Date: Fri, 7 Jan 2022 14:05:35 +0800 Subject: [PATCH] [skip e2e] Add new func on utils (#14993) Signed-off-by: wangting0128 --- tests/benchmark/milvus_benchmark/utils.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/benchmark/milvus_benchmark/utils.py b/tests/benchmark/milvus_benchmark/utils.py index ea8929af8d..e9ddce48cd 100644 --- a/tests/benchmark/milvus_benchmark/utils.py +++ b/tests/benchmark/milvus_benchmark/utils.py @@ -371,3 +371,20 @@ def get_image_tag(): except: print("Can not get the tag list") return "master-latest" + + +def dict_recursive_key(_dict, key=None): + if isinstance(_dict, dict): + key_list = list(_dict.keys()) + + for k in key_list: + if isinstance(_dict[k], dict): + dict_recursive_key(_dict[k], key) + + if key is None: + if _dict[k] is key: + del _dict[k] + else: + if _dict[k] == key: + del _dict[k] + return _dict