def reduce_ElementTree(e): attrs = {axon.as_unicode(name):val for name,val in e.attrib.items()} if e.text: vals = [e.text] else: vals = [] for child in e.getchildren(): vals.append(child) if child.tail: vals.append(child.tail) child.tail = None if len(attrs) == 0: attrs = None if len(vals) == 0: vals = None return axon.node(axon.as_unicode(e.tag), attrs, vals)
def random_string(n): text = ''.join(chr(ord('a')+random.randint(1,20)) for i in range(20)) text = axon.as_unicode(text) return text
def random_string(n): text = ''.join(chr(ord('a') + random.randint(1, 20)) for i in range(20)) text = axon.as_unicode(text) return text