if isinstance(elt, tuple):
elts = elts + flatten(elt)
def __contains__(self, elt):
self.pop = self.stack.pop
def __getitem__(self, index): # needed by visitContinue()
MANGLE_LEN = 256 # magic constant from compile.c
if not name.startswith('__'):
if len(name) + 2 >= MANGLE_LEN:
tlen = len(klass) + len(name)
klass = klass[:MANGLE_LEN-tlen]
return "_%s%s" % (klass, name)
def set_filename(filename, tree):
"""Set the filename attribute to filename on every node in tree"""
worklist.extend(node.getChildNodes())