<commit_before># This script is the main script
# It responds to HTTP requests and connects to the server

import tornado.ioloop
import tornado.web
import motor.motor_tornado
import json
import rec #rename modules
import modules #rename config
import client

class apiSubmitData(tornado.web.RequestHandler):
	def post(self):#TODO: use request.body and json
		payload = json.loads(self.request.body.decode('utf-8'))
		db = self.settings['db']
		out = rec.rec.addData(payload, db)
		self.set_status(out[0])
		self.write(out[1])

class apiGetTrust(tornado.web.RequestHandler):
	def get(self):
		db = self.settings['db']
		self.write(rec.rec.gTrust(self.get_argument('sessionID'),
			self.get_argument('userID'), db))

class apiRegisterUser(tornado.web.RequestHandler):
	def post(self):
		payload = json.loads(self.request.body.decode('utf-8'))
		db = self.settings['db']
		out = rec.rec.copyData(payload)
		self.set_status(out[0])
		self.write(out[1])

class collect(tornado.web.RequestHandler):
	def get(self):
		self.set_header("Content-Type", 'application/javascript; charset="utf-8"')
		self.render('collect.js', collectors=rec.mods.fxns,
			colList = json.dumps(rec.mods.fxnNames))

db = motor.motor_tornado.MotorClient().hijackingPrevention

def makeApp():
	return(tornado.web.Application([
		(r"/api/sub_dat", apiSubmitData),
		(r"/api/get_trust", apiGetTrust),
		(r"/api/reg_usr", apiRegisterUser),
		(r"/static/(.*)", tornado.web.StaticFileHandler, {'path': 'static/'}),
		(r"/dynamic/collect.js", collect)
	], db=db, template_path='templates/'))

if __name__ == '__main__':<commit_msg>Fixed yielding<commit_after># This script is the main script
# It responds to HTTP requests and connects to the server

import tornado.ioloop
import tornado.web
import motor.motor_tornado
import json
import rec #rename modules
import modules #rename config
import client
from tornado import gen

class apiSubmitData(tornado.web.RequestHandler):
	@gen.coroutine
	def post(self):#TODO: use request.body and json
		payload = json.loads(self.request.body.decode('utf-8'))
		db = self.settings['db']
		out = yield rec.rec.addData(payload, db)
		self.set_status(out[0])
		self.write(out[1])

class apiGetTrust(tornado.web.RequestHandler):
	@gen.coroutine
	def get(self):
		db = self.settings['db']
		self.write((yield rec.rec.gTrust(self.get_argument('sessionID'),
			self.get_argument('userID'), db)))

class apiRegisterUser(tornado.web.RequestHandler):
	@gen.coroutine
	def post(self):
		payload = json.loads(self.request.body.decode('utf-8'))
		db = self.settings['db']
		out = yield rec.rec.copyData(payload, db)
		self.set_status(out[0])
		self.write(out[1])

class collect(tornado.web.RequestHandler):
	def get(self):
		self.set_header("Content-Type", 'application/javascript; charset="utf-8"')
		self.render('collect.js', collectors=rec.mods.fxns,
			colList = json.dumps(rec.mods.fxnNames))

db = motor.motor_tornado.MotorClient().hijackingPrevention

def makeApp():
	return(tornado.web.Application([
		(r"/api/sub_dat", apiSubmitData),
		(r"/api/get_trust", apiGetTrust),
		(r"/api/reg_usr", apiRegisterUser),
		(r"/static/(.*)", tornado.web.StaticFileHandler, {'path': 'static/'}),
		(r"/dynamic/collect.js", collect)
	], db=db, template_path='templates/'))

if __name__ == '__main__':
{'fraction_non_alphanumeric': 0.15696434014020116, 'fraction_numerical': 0.004266991770801585, 'mean_word_length': 5.447937131630648, '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': '5019090', 'n_tokens_mistral': 1230, 'n_tokens_neox': 1153, 'n_words': 223}