How to use the astor.parsefile function in astor

To help you get started, we’ve selected a few astor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dantarion / bbtools / bbcpex_script_rebuilder.py View on Github external
def rebuild_bbscript(sourceFilename,outFilename):
    global output
    sourceAST = astor.parsefile(sourceFilename)
    f = open(outFilename+".txt","w")
    f.write(astor.dump(sourceAST))
    f.close()
    output = open(outFilename,"wb")
    Rebuilder().visit(sourceAST)
    output.close()
    #output = open(outFilename,"rb")
github dantarion / bbtools / gg_rev_script_rebuilder.py View on Github external
def rebuild_bbscript(sourceFilename,outFilename):
    global output
    sourceAST = astor.parsefile(sourceFilename)
    if(os.path.isfile(sourceFilename+".txt")):
        os.remove(sourceFilename+".txt")
    f = open(sourceFilename+".txt","w")
    f.write(astor.dump(sourceAST))
    f.close()
    output = open(outFilename,"wb")
    Rebuilder().visit(sourceAST)
    output.close()
github dantarion / bbtools / dbfz_script_rebuilder.py View on Github external
def rebuild_dbzfscript(sourceFilename,outFilename):
    global output
    sourceAST = astor.parsefile(sourceFilename)
    if(os.path.isfile(sourceFilename+".txt")):
        os.remove(sourceFilename+".txt")
    f = open(sourceFilename+".txt","w")
    f.write(astor.dump(sourceAST))
    f.close()
    output = open(outFilename,"wb")
    Rebuilder().visit(sourceAST)
    output.close()
github dantarion / bbtools / bbcf_bbtag_script_rebuilder.py View on Github external
def rebuild_bbscript(sourceFilename,outFilename):
    global output
    sourceAST = astor.parsefile(sourceFilename)
    output = open(outFilename,"wb")
    Rebuilder().visit(sourceAST)
    output.close()
    #output = open(outFilename,"rb")
github caioariede / pyq / pyq / astmatch.py View on Github external
def match(self, selector, filename):
        module = astor.parsefile(filename)
        for match in super(ASTMatchEngine, self).match(selector, module.body):
            lineno = match.lineno
            if isinstance(match, (ast.ClassDef, ast.FunctionDef)):
                for d in match.decorator_list:
                    lineno += 1
            yield match, lineno