Server IP : 85.214.239.14 / Your IP : 13.59.54.188 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/python2.7/compiler/ |
Upload File : |
def flatten(tup): elts = [] for elt in tup: if isinstance(elt, tuple): elts = elts + flatten(elt) else: elts.append(elt) return elts class Set: def __init__(self): self.elts = {} def __len__(self): return len(self.elts) def __contains__(self, elt): return elt in self.elts def add(self, elt): self.elts[elt] = elt def elements(self): return self.elts.keys() def has_elt(self, elt): return elt in self.elts def remove(self, elt): del self.elts[elt] def copy(self): c = Set() c.elts.update(self.elts) return c class Stack: def __init__(self): self.stack = [] self.pop = self.stack.pop def __len__(self): return len(self.stack) def push(self, elt): self.stack.append(elt) def top(self): return self.stack[-1] def __getitem__(self, index): # needed by visitContinue() return self.stack[index] MANGLE_LEN = 256 # magic constant from compile.c def mangle(name, klass): if not name.startswith('__'): return name if len(name) + 2 >= MANGLE_LEN: return name if name.endswith('__'): return name try: i = 0 while klass[i] == '_': i = i + 1 except IndexError: return name klass = klass[i:] tlen = len(klass) + len(name) if tlen > MANGLE_LEN: 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 = [tree] while worklist: node = worklist.pop(0) node.filename = filename worklist.extend(node.getChildNodes())