def process(self): """Main method that process input directory and write converted files to output directory. Each input file is parsed using `snakes.lang.python` to an AST that is then traversed for processing. """ for dirpath, dirnames, filenames in os.walk(self.path): for name in sorted(filenames): if not name.endswith(".py") or name.startswith("."): continue path = os.path.join(dirpath, name) if not self.openout(path): continue node = parse(open(path).read()) if ".plugins." in self.module: self.visit_plugin(node) else: self.visit_module(node)
def process (self) : """Main method that process input directory and write converted files to output directory. Each input file is parsed using `snakes.lang.python` to an AST that is then traversed for processing. """ for dirpath, dirnames, filenames in os.walk(self.path) : for name in sorted(filenames) : if not name.endswith(".py") or name.startswith(".") : continue path = os.path.join(dirpath, name) if not self.openout(path) : continue node = parse(open(path).read()) if ".plugins." in self.module : self.visit_plugin(node) else : self.visit_module(node)
def unlet (expr, *names) : if not names : names = ["let"] drop = DropLet(names) new = DropTrue().visit(drop.visit(parse(expr))) return unparse(new), drop.calls
def unlet(expr, *names): if not names: names = ["let"] drop = DropLet(names) new = DropTrue().visit(drop.visit(parse(expr))) return unparse(new), drop.calls