<commit_before>from mcapp import app
from decorators import crossdomain, apikey, jsonp
from flask import request, g
import error
import rethinkdb as r
import dmutil
import json
import args

@app.route('/samples', methods=['GET'])
@jsonp
def get_all_samples():
    rr = r.table('samples').order_by(r.desc('birthtime'))
    selection = list(rr.run(g.conn, time_format='raw'))
    return args.json_as_format_arg(selection)

@app.route('/samples/<sample_id>', methods=['GET'])
@jsonp
def get_sample(sample_id):
    return dmutil.get_single_from_table('samples', sample_id)


@app.route('/samples/new', methods=['POST'])
@apikey
@crossdomain(origin='*')
def create_sample():
    j = request.get_json()
    print j
    sample = dict()
    sample['model'] = dmutil.get_required('model', j)
    sample['material'] = dmutil.get_required('material', j)
    sample['birthtime'] = r.now()
    sample['owner'] = dmutil.get_required('owner', j)
    return dmutil.insert_entry('samples', sample)
<commit_msg>removed print statement<commit_after>from mcapp import app
from decorators import crossdomain, apikey, jsonp
from flask import request, g
import error
import rethinkdb as r
import dmutil
import json
import args

@app.route('/samples', methods=['GET'])
@jsonp
def get_all_samples():
    rr = r.table('samples').order_by(r.desc('birthtime'))
    selection = list(rr.run(g.conn, time_format='raw'))
    return args.json_as_format_arg(selection)

@app.route('/samples/<sample_id>', methods=['GET'])
@jsonp
def get_sample(sample_id):
    return dmutil.get_single_from_table('samples', sample_id)


@app.route('/samples/new', methods=['POST'])
@apikey
@crossdomain(origin='*')
def create_sample():
    j = request.get_json()
    sample = dict()
    sample['model'] = dmutil.get_required('model', j)
    sample['material'] = dmutil.get_required('material', j)
    sample['birthtime'] = r.now()
    sample['owner'] = dmutil.get_required('owner', j)
    return dmutil.insert_entry('samples', sample)

{'fraction_non_alphanumeric': 0.15725806451612903, 'fraction_numerical': 0.0, 'mean_word_length': 5.508196721311475, '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': '4190903', 'n_tokens_mistral': 671, 'n_tokens_neox': 659, 'n_words': 146}