加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-fix-deprecated-getiterator-function.patch 1.78 KB
一键复制 编辑 原始数据 按行查看 历史
HuaxinLu 提交于 2022-01-29 04:40 . fix for python upgrade
From b0adc1d53780def4a95e310b6d26bb91ee97177e Mon Sep 17 00:00:00 2001
From: Vojtech Polasek <vpolasek@redhat.com>
Date: Mon, 8 Jun 2020 13:27:41 +0200
Subject: [PATCH] fix deprecated getiterator function
Signed-off-by: HuaxinLu <luhuaxin1@huawei.com>
---
ssg/build_cpe.py | 6 +++---
ssg/id_translate.py | 2 +-
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/ssg/build_cpe.py b/ssg/build_cpe.py
index 2e5d24a5da..8c046777a5 100644
--- a/ssg/build_cpe.py
+++ b/ssg/build_cpe.py
@@ -17,7 +17,7 @@ def extract_subelement(objects, sub_elem_type):
"""
for obj in objects:
- for subelement in obj.getiterator():
+ for subelement in obj.iter():
if subelement.get(sub_elem_type):
sub_element = subelement.get(sub_elem_type)
return sub_element
@@ -44,12 +44,12 @@ def extract_referred_nodes(tree_with_refs, tree_with_ids, attrname):
reflist = []
elementlist = []
- for element in tree_with_refs.getiterator():
+ for element in tree_with_refs.iter():
value = element.get(attrname)
if value is not None:
reflist.append(value)
- for element in tree_with_ids.getiterator():
+ for element in tree_with_ids.iter():
if element.get("id") in reflist:
elementlist.append(element)
diff --git a/ssg/id_translate.py b/ssg/id_translate.py
index 72b07be181..ba92259049 100644
--- a/ssg/id_translate.py
+++ b/ssg/id_translate.py
@@ -64,7 +64,7 @@ class IDTranslator(object):
)
def translate(self, tree, store_defname=False):
- for element in tree.getiterator():
+ for element in tree.iter():
idname = element.get("id")
if idname:
# store the old name if requested (for OVAL definitions)
--
2.30.0
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化