<commit_before>import os
import sys
import ConfigParser

from sockjs.tornado import SockJSRouter
from tornado import web, ioloop

from assets.websocket import TerminalClient


class EntrypointHandler(web.RequestHandler):

    def get(self):
        if not TerminalClient.is_alive(self.get_cookie("term")):
            self.clear_cookie("term")
            self.set_cookie("term", TerminalClient.create_session())
        self.render("templates/terminal.html")


def main():
    # CLI Argument parser
    args = sys.argv[1:]
    if len(args) >= 1:
        config_path = args
    else:
        config_path = ["production.ini"]

    base_path = os.path.dirname(os.path.realpath(__file__))
    config = ConfigParser.ConfigParser()
    config.readfp(open(os.path.join(base_path, 'conf', 'defaults.ini')))
    config.read(config_path)

    # Read configurations<commit_msg>Fixed missing cookie bug<commit_after>import os
import sys
import ConfigParser

from sockjs.tornado import SockJSRouter
from tornado import web, ioloop

from assets.websocket import TerminalClient


class EntrypointHandler(web.RequestHandler):

    def get(self):
        term = self.get_cookie("term")
        if term and not TerminalClient.is_alive(term):
            self.clear_cookie("term")
            self.set_cookie("term", TerminalClient.create_session())
        elif not term:
            self.set_cookie("term", TerminalClient.create_session())
        self.render("templates/terminal.html")


def main():
    # CLI Argument parser
    args = sys.argv[1:]
    if len(args) >= 1:
        config_path = args
    else:
        config_path = ["production.ini"]

    base_path = os.path.dirname(os.path.realpath(__file__))
    config = ConfigParser.ConfigParser()
    config.readfp(open(os.path.join(base_path, 'conf', 'defaults.ini')))
    config.read(config_path)

    # Read configurations
{'fraction_non_alphanumeric': 0.11093247588424437, 'fraction_numerical': 0.0021436227224008574, 'mean_word_length': 3.4033018867924527, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '2169630', 'n_tokens_mistral': 583, 'n_tokens_neox': 549, 'n_words': 121}