--- a/svghmi/hmi_tree.py Mon Mar 27 10:19:14 2023 +0200
+++ b/svghmi/hmi_tree.py Fri Oct 28 12:39:15 2022 +0800
@@ -6,8 +6,8 @@
#
# See COPYING file for copyrights details.
-from __future__ import absolute_import
-from itertools import izip, imap
+
+
from pprint import pformat
import weakref
import hashlib
@@ -22,7 +22,7 @@
"HMI_REAL":{}
}
-HMI_TYPES = HMI_TYPES_DESC.keys()
+HMI_TYPES = list(HMI_TYPES_DESC.keys())
class HMITreeNode(object):
def __init__(self, path, name, nodetype, iectype = None, vartype = None, cpath = None, hmiclass = None):
@@ -56,7 +56,7 @@
for child in self.children:
if child.path is not None:
in_common = 0
- for child_path_item, node_path_item in izip(child.path, node.path):
+ for child_path_item, node_path_item in zip(child.path, node.path):
if child_path_item == node_path_item:
in_common +=1
else:
@@ -105,7 +105,7 @@
res = etree.Element(self.nodetype, **attribs)
if hasattr(self, "children"):
- for child_etree in imap(lambda c:c.etree(), self.children):
+ for child_etree in map(lambda c:c.etree(), self.children):
res.append(child_etree)
return res
@@ -150,7 +150,7 @@
s = hashlib.new('md5')
self._hash(s)
# limit size to HMI_HASH_SIZE as in svghmi.c
- return map(ord,s.digest())[:8]
+ return list(map(ord,s.digest()))[:8]
def _hash(self, s):
s.update(str((self.name,self.nodetype)))