<commit_before>import tornado.web
import tornado.websocket
import json

json_data = open('cards.json').read()
stack = json.loads(json_data)

global ProjSocket
ProjSocket = None

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

class StackHandler(tornado.web.RequestHandler):
	def get(self):
		self.write(json.dumps(stack))

class PushToScreen(tornado.web.RequestHandler):
	def get(self):
		if ProjSocket:
			data = {}
			data['message'] = self.get_query_argument('message')
			print data
			ProjSocket.write_message(json.dumps(data))
			self.write("SUCCESS")
		else:
			self.write("NO SOCKET")

# Communicates with the projector HTML5 screen
class ProjectorWebSocket(tornado.websocket.WebSocketHandler):
    def open(self):
    	global ProjSocket
    	ProjSocket = self
        print "Opened socket to Projector"

    def on_message(self, message):
        self.write_message(u"You said: " + message)

    def on_close(self):
        print "WebSocket closed"<commit_msg>Better query message handling<commit_after>import tornado.web
import tornado.websocket
import json

json_data = open('cards.json').read()
stack = json.loads(json_data)

global ProjSocket
ProjSocket = None

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

class StackHandler(tornado.web.RequestHandler):
	def get(self):
		self.write(json.dumps(stack))

class PushToScreen(tornado.web.RequestHandler):
	def get(self):
		if ProjSocket:
			#data = {}
			#data['message'] = self.get_query_argument('message')
			print self.request.arguments
			ProjSocket.write_message(json.dumps(self.request.arguments))
			self.write("SUCCESS")
		else:
			self.write("NO SOCKET")

# Communicates with the projector HTML5 screen
class ProjectorWebSocket(tornado.websocket.WebSocketHandler):
    def open(self):
    	global ProjSocket
    	ProjSocket = self
        print "Opened socket to Projector"

    def on_message(self, message):
        self.write_message(u"You said: " + message)

    def on_close(self):
        print "WebSocket closed"
{'fraction_non_alphanumeric': 0.11142857142857143, 'fraction_numerical': 0.0009523809523809524, 'mean_word_length': 4.305555555555555, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1638791', 'n_tokens_mistral': 715, 'n_tokens_neox': 671, 'n_words': 144}