diff options
author | Andrey Lihatskiy <alihatskiy@productengine.com> | 2022-02-28 21:55:28 +0200 |
---|---|---|
committer | Andrey Lihatskiy <alihatskiy@productengine.com> | 2022-02-28 21:55:28 +0200 |
commit | 201f83472c604e837b40c12f3750602e30d79d0b (patch) | |
tree | b5e983c44eb9913c5778f0773ac986d6bf038e20 /scripts/content_tools/arche_tool.py | |
parent | 696795a368a8825fb083627e39f65dcc30266122 (diff) | |
parent | 6ca09a94554ec01f5c94ec60fffd01d7e33f3546 (diff) |
Merge branch 'master' into DRTVWR-543-maint
Diffstat (limited to 'scripts/content_tools/arche_tool.py')
-rw-r--r-- | scripts/content_tools/arche_tool.py | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/scripts/content_tools/arche_tool.py b/scripts/content_tools/arche_tool.py index f99d7be39a..677af62d2f 100644 --- a/scripts/content_tools/arche_tool.py +++ b/scripts/content_tools/arche_tool.py @@ -1,4 +1,4 @@ -#!runpy.sh +#!/usr/bin/env python3 """\ @@ -42,23 +42,23 @@ def node_key(e): def compare_matched_nodes(key,items,summary): tags = list(set([e.tag for e in items])) if len(tags) != 1: - print "different tag types for key",key + print("different tag types for key",key) summary.setdefault("tag_mismatch",0) summary["tag_mismatch"] += 1 return - all_attrib = list(set(chain.from_iterable([e.attrib.keys() for e in items]))) + all_attrib = list(set(chain.from_iterable([list(e.attrib.keys()) for e in items]))) #print key,"all_attrib",all_attrib for attr in all_attrib: vals = [e.get(attr) for e in items] #print "key",key,"attr",attr,"vals",vals if len(set(vals)) != 1: - print key,"- attr",attr,"multiple values",vals + print(key,"- attr",attr,"multiple values",vals) summary.setdefault("attr",{}) summary["attr"].setdefault(attr,0) summary["attr"][attr] += 1 def compare_trees(file_trees): - print "compare_trees" + print("compare_trees") summary = {} all_keys = list(set([node_key(e) for tree in file_trees for e in tree.getroot().iter() if node_key(e)])) #print "keys",all_keys @@ -70,14 +70,14 @@ def compare_trees(file_trees): items = [] for nodes in tree_nodes: if not key in nodes: - print "file",i,"missing item for key",key + print("file",i,"missing item for key",key) summary.setdefault("missing",0) summary["missing"] += 1 else: items.append(nodes[key]) compare_matched_nodes(key,items,summary) - print "Summary:" - print summary + print("Summary:") + print(summary) def dump_appearance_params(tree): vals = [] @@ -88,7 +88,7 @@ def dump_appearance_params(tree): vals.append("{" + e.get("id") + "," +e.get("u8") + "}") #print e.get("id"), e.get("name"), e.get("group"), e.get("u8") if len(vals)==253: - print ", ".join(vals) + print(", ".join(vals)) if __name__ == "__main__": @@ -101,9 +101,9 @@ if __name__ == "__main__": args = parser.parse_args() - print "files",args.files + print("files",args.files) file_trees = [etree.parse(filename) for filename in args.files] - print args + print(args) if args.compare: compare_trees(file_trees) if args.appearance_params: |