<commit_before># -*- coding: utf-8 -*-
'''
    Mango HTTP records handlers.
'''

# This file is part of mango.

# Distributed under the terms of the last AGPL License.
# The full license is in the file LICENCE, distributed as part of this software.

__author__ = '<NAME>'


import time
import arrow
import motor

import logging

# import numpy as np
import pandas as pd

from bson import json_util

from tornado import gen
from tornado import web

from mango.system import accounts
from mango.system import records

from mango.tools import content_type_validation
from mango.tools import check_json
from mango.tools import check_times
from mango.tools import errors
from mango.tools import new_resource

from mango.handlers import BaseHandler


@content_type_validation
class Handler(records.Records, accounts.Accounts, BaseHandler):
    '''
        Records HTTP request handlers
    '''

    @gen.coroutine
    def get(self, record_uuid=None, start=None, end=None, page_num=0, lapse='hours'):
        '''
            Get records handler
        '''

        logging.info('Get records handler, time stuff up sounds cool at this moment.')

        # -- logging info
        logging.info(self.request.arguments)

        #account = (self.request.arguments.get('account', [None])[0] if not account else account)

        # query string checked from string to boolean
        #checked = str2bool(str(self.request.arguments.get('checked', [False])[0]))

        if record_uuid:
            record_uuid = record_uuid.rstrip('/')

            if self.current_user:
                user = self.current_user
                record = yield self.get_record(user, record_uuid)
            else:
                record = yield self.get_record(None, record_uuid)

            if not record:
                self.set_status(400)
                system_error = errors.Error('missing')
                error = system_error.missing('record', record_uuid)
                self.finish(error)
                return<commit_msg>wut wut wut<commit_after># -*- coding: utf-8 -*-
'''
    Mango HTTP records handlers.
'''

# This file is part of mango.

# Distributed under the terms of the last AGPL License.
# The full license is in the file LICENCE, distributed as part of this software.

__author__ = '<NAME>'


import time
import arrow
import motor

import logging

# import numpy as np
import pandas as pd

from bson import json_util

from tornado import gen
from tornado import web

from mango.system import accounts
from mango.system import records

from mango.tools import content_type_validation
from mango.tools import check_json
from mango.tools import check_times
from mango.tools import errors
from mango.tools import new_resource

from mango.handlers import BaseHandler


@content_type_validation
class Handler(records.Records, accounts.Accounts, BaseHandler):
    '''
        Records HTTP request handlers
    '''

    @gen.coroutine
    def get(self, record_uuid=None, start=None, end=None, page_num=0, lapse='hours'):
        '''
            Get records handler
        '''

        logging.info('Get records handler')

        # -- logging info
        logging.info(self.request.arguments)

        #account = (self.request.arguments.get('account', [None])[0] if not account else account)

        # query string checked from string to boolean
        #checked = str2bool(str(self.request.arguments.get('checked', [False])[0]))

        if record_uuid:
            record_uuid = record_uuid.rstrip('/')

            if self.current_user:
                user = self.current_user
                record = yield self.get_record(user, record_uuid)
            else:
                record = yield self.get_record(None, record_uuid)

            if not record:
                self.set_status(400)
                system_error = errors.Error('missing')
                error = system_error.missing('record', record_uuid)
                self.finish(error)
                return
{'fraction_non_alphanumeric': 0.0852029241240232, 'fraction_numerical': 0.00403327451474666, 'mean_word_length': 2.6007259528130673, 'pattern_counts': {'":': 0, '<': 5, '<?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': '484344', 'n_tokens_mistral': 1108, 'n_tokens_neox': 1051, 'n_words': 349}