<commit_before>import os
import re
import json

import tornado.auth
import tornado.httpserver
import tornado.ioloop
import tornado.web
import torndb

import nltk
from nltk.corpus import wordnet as wn

from tornado.options import options, define

define("port", default="8080")
define("mysql_host", default="127.0.0.1:3306")
define("mysql_database", default="saxons")
define("mysql_user", default="root")
define("mysql_password", default="<PASSWORD>")


'''
,

            (r"/help", FeedHandler),
            (r"/setting", SettingHandler),
            (r"/auth/login", AuthLoginHandler),
            (r"/auth/logout", AuthLogoutHandler),
'''


class Application(tornado.web.Application):
	def __init__(self):
		handlers = [
			(r"/", EntryHandler),
			(r"/publicpack", LangPackBrowseHandler),
			(r"/getword/(.*)", LangPackContentHandler)
		]
		settings = dict(
			template_path=os.path.join(os.path.dirname(__file__), "templates"),
			static_path=os.path.join(os.path.dirname(__file__), "static"),
			# ui_modules={"Entry": EntryModule},
			xsrf_cookies=True,
			cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
			login_url="/auth/login",
			debug=True,
		)
		tornado.web.Application.__init__(self, handlers, **settings)

		self.db = torndb.Connection(
			host=options.mysql_host, database=options.mysql_database,
			user=options.mysql_user, password=options.mysql_password)

		
class EntryHandler(tornado.web.RequestHandler):
	def get(self):
		self.render("home.html")

		
class BaseHandler(tornado.web.RequestHandler):
	@property
	def db(self):
		return self.application.db

	def get_current_user(self):
		return self.get_secret_cookie("userid")


class HomeHandler(BaseHandler):
	def get(self):
		self.render("main.html", user=self.current_user)


class LearningProcessHandler(BaseHandler):
	def get(self):
		if not self.current_user:
			self.redirect("/")

			return

<commit_msg>updata main.py<commit_after>import os
import re
import json

import tornado.auth
import tornado.httpserver
import tornado.ioloop
import tornado.web
import torndb

import nltk
from nltk.corpus import wordnet as wn

from tornado.options import options, define

define("port", default="8080")
define("mysql_host", default="127.0.0.1:3306")
define("mysql_database", default="saxons")
define("mysql_user", default="root")
define("mysql_password", default="<PASSWORD>")


'''
,

            (r"/help", FeedHandler),
            (r"/setting", SettingHandler),
            (r"/auth/login", AuthLoginHandler),
            (r"/auth/logout", AuthLogoutHandler),
'''


class Application(tornado.web.Application):
	def __init__(self):
		handlers = [
			(r"/", EntryHandler),
			(r"/quiz", TempQuizHandler),
			(r"/packs", LangPacksHandler),
			(r"/publicpack", LangPackBrowseHandler),
			(r"/getword/(.*)", LangPackContentHandler)
		]
		settings = dict(
			template_path=os.path.join(os.path.dirname(__file__), "templates"),
			static_path=os.path.join(os.path.dirname(__file__), "static"),
			# ui_modules={"Entry": EntryModule},
			xsrf_cookies=True,
			cookie_secret="__TODO:_GENERATE_YOUR_OWN_RANDOM_VALUE_HERE__",
			login_url="/auth/login",
			debug=True,
		)
		tornado.web.Application.__init__(self, handlers, **settings)

		self.db = torndb.Connection(
			host=options.mysql_host, database=options.mysql_database,
			user=options.mysql_user, password=options.mysql_password)

		
class EntryHandler(tornado.web.RequestHandler):
	def get(self):
		self.render("home.html")

class TempQuizHandler(tornado.web.RequestHandler):
	def get(self):
		self.render("quiz.html")
		
class LangPacksHandler(tornado.web.RequestHandler):
	def get(self):
		self.render("packs.html")

class BaseHandler(tornado.web.RequestHandler):
	@property
	def db(self):
		return self.application.db

	def get_current_user(self):
		return self.get_secret_cookie("userid")


class HomeHandler(BaseHandler):
	def get(self):
		self.render("main.html", user=self.current_user)


class LearningProcessHandler(BaseHandler):
	def get(self):
		if not self.current_user:
			self.redirect("/")

			return


{'fraction_non_alphanumeric': 0.14268112370625924, 'fraction_numerical': 0.006899950714637753, 'mean_word_length': 4.969117647058823, 'pattern_counts': {'":': 2, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '5576840', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1339, 'n_words': 235}