def do_file(testfile, name, do_print=False, notfile=None, workfile=None): if notfile is None: keepnot = False else: keepnot = True if workfile is None: keepwork = False else: keepwork = True # Attempt to parse the file contents into an AST try: tree = base.parse(''.join(testfile.readlines())) testfile.close() except Exception, e: # If we fail then make a note of it as appropriate if keepnot: notfile.write(name+'\n') notfile.flush() # And output more information if asked to if do_print: testfile.seek(0) print ''.join(testfile.readlines()) print print str(e) print "Error parsing input." # Now quit (we can't go any further) #sys.exit(0) return
def find(cls, info_hash): info_hash = base.parse(info_hash, bytes) man = cls._find(info_hash) if man is None: return None return cls._from_bittorrent_peer_manager(man)
def destroy(self, info_hash): man = bittorrent.client.halt_manager(base.parse(info_hash, bytes)) if man is None: raise cherrypy.HTTPError(404)
def get_tree(self): return base.parse(self.code)
if keepnot: notfile.write(name+'\n') notfile.flush() # And output more information if asked to if do_print: print repr(tree) print print str(e) print "Error generating code" # Now quit (we can't go any further) #sys.exit(0) return # Attempt to parse the generated code into an AST try: new_tree = base.parse(code) # Get rid of the code now that we don't need it del(code) except Exception, e: # If we fail then make a note of it if asked to if keepnot: notfile.write(name+'\n') notfile.flush() # And output more information if asked to if do_print: print code print print str(e) print "Error parsing generated code" # Now quit (we can't go any further) #sys.exit(0)