<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import datetime
import json
import os
import re
import uuid

from concurrent.futures import ThreadPoolExecutor

import tornado
import tornado.options
from tornado.log import app_log
from tornado.web import RequestHandler, HTTPError

from tornado import gen, web

import dockworker
import spawnpool

class BaseHandler(RequestHandler):
    def write_error(self, status_code, **kwargs):
        if status_code == 404:
            self.render("error/404.html", status_code = status_code)
        else:
            self.render("error/500.html", status_code = status_code)


class LoadingHandler(BaseHandler):
    def get(self, path=None):
        if self.allow_origin:
            self.set_header("Access-Control-Allow-Origin", self.allow_origin)
        self.render("loading.html", path=path)
<commit_msg>Added property objects for CORS headers in BaseHandler<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

import datetime
import json
import os
import re
import uuid

from concurrent.futures import ThreadPoolExecutor

import tornado
import tornado.options
from tornado.log import app_log
from tornado.web import RequestHandler, HTTPError

from tornado import gen, web

import dockworker
import spawnpool

class BaseHandler(RequestHandler):
    def write_error(self, status_code, **kwargs):
        if status_code == 404:
            self.render("error/404.html", status_code = status_code)
        else:
            self.render("error/500.html", status_code = status_code)

    @property
    def allow_origin(self):
        return self.settings['allow_origin']

    @property
    def expose_headers(self):
        return self.settings['expose_headers']

    @property
    def max_age(self):
        return self.settings['max-age']

    @property
    def allow_credentials(self):
        return self.settings['allow-credentials']

    @property
    def allow_methods(self):
        return self.settings['allow_methods']

    @property
    def allow_headers(self):
        return self.settings['allow_headers']

class LoadingHandler(BaseHandler):
    def get(self, path=None):
        if self.allow_origin:
            self.set_header("Access-Control-Allow-Origin", self.allow_origin)
        self.render("loading.html", path=path)

{'fraction_non_alphanumeric': 0.09643788010425716, 'fraction_numerical': 0.008688097306689836, 'mean_word_length': 3.4892787524366473, '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': '3253214', 'n_tokens_mistral': 680, 'n_tokens_neox': 648, 'n_words': 171}