コード例 #1
0
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
コード例 #2
0
ファイル: models.py プロジェクト: kapetan/bitless
    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)
コード例 #3
0
ファイル: models.py プロジェクト: kapetan/bitless
    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)
コード例 #4
0
ファイル: controllers.py プロジェクト: kapetan/bitless
 def destroy(self, info_hash):
     man = bittorrent.client.halt_manager(base.parse(info_hash, bytes))
     if man is None:
         raise cherrypy.HTTPError(404)
コード例 #5
0
ファイル: controllers.py プロジェクト: kapetan/bitless
 def destroy(self, info_hash):
     man = bittorrent.client.halt_manager(base.parse(info_hash, bytes))
     if man is None:
         raise cherrypy.HTTPError(404)
コード例 #6
0
		def get_tree(self):
			return base.parse(self.code)
コード例 #7
0
		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)