<commit_before>__author__ = 'hunt3r'

"""
A base handlers module
"""

import json
import tornado.web
from bson.objectid import ObjectId
import logging
from pymongo.errors import InvalidDocument, InvalidOperation, InvalidId
from bson import json_util
from jsonschema import ValidationError
from document import AsyncSchedulableDocumentRevisionStack, BaseAsyncMotorDocument
from tornado.gen import coroutine
from tornado.web import authenticated
from tornado.gen import Return
import uuid

class BaseHandler(tornado.web.RequestHandler):
    """A class to collect common handler methods that can be useful in your individual implementation,
    this includes functions for working with query strings and Motor/Mongo type documents
    """

    def initialize(self):
        self.logger = logging.getLogger(self.__class__.__name__)

    def load_json(self):
        """Load JSON from the request body and store them in
        self.request.arguments, like Tornado does by default for POSTed form
        parameters.<commit_msg>Change `import document` to `import caesium.document`<commit_after>__author__ = 'hunt3r'

"""
A base handlers module
"""

import json
import logging
import uuid

from bson.objectid import ObjectId
from bson import json_util
from jsonschema import ValidationError
from pymongo.errors import InvalidDocument, InvalidOperation, InvalidId
import tornado.web
from tornado.gen import coroutine, Return
from tornado.web import authenticated

from caesium.document import AsyncSchedulableDocumentRevisionStack, BaseAsyncMotorDocument


class BaseHandler(tornado.web.RequestHandler):
    """A class to collect common handler methods that can be useful in your individual implementation,
    this includes functions for working with query strings and Motor/Mongo type documents
    """

    def initialize(self):
        self.logger = logging.getLogger(self.__class__.__name__)

    def load_json(self):
        """Load JSON from the request body and store them in
        self.request.arguments, like Tornado does by default for POSTed form
        parameters.
{'fraction_non_alphanumeric': 0.054966248794599805, 'fraction_numerical': 0.0009643201542912247, 'mean_word_length': 4.623306233062331, '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': '6914975', 'n_tokens_mistral': 536, 'n_tokens_neox': 515, 'n_words': 209}