From e8b3c8a1d8b2e544bc691e3f54facfd082a42d2e Mon Sep 17 00:00:00 2001 From: En-Cu-Kou Date: Fri, 22 Oct 2010 14:26:39 -0600 Subject: [PATCH] Added check_moves.py. --- util/check_moves.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 util/check_moves.py diff --git a/util/check_moves.py b/util/check_moves.py new file mode 100644 index 0000000..4f7f5ec --- /dev/null +++ b/util/check_moves.py @@ -0,0 +1,15 @@ +"""Check if moves of pokemon in species.xml match moves in moves.xml + +Useful for finding capitalization errors/misspellings +""" + +from xml.etree import ElementTree + +mt=ElementTree.parse(open('moves.xml')) +movenames = set(m.attrib['name'] for m in mt.findall('move')) + +t=ElementTree.parse(open('species.xml')) +parent_map = dict((c, p) for p in t.getiterator() for c in p) + +for m in [m for m in t.findall('*/*/*/move') if m.text not in movenames]: + print parent_map[parent_map[parent_map[m]]].attrib['name'] + ':', m.text