<commit_before>import json
from datetime import datetime
from dateutil.relativedelta import relativedelta
from dateutil.parser import parse
from flask import Flask, Blueprint, request, make_response
from flask_restful import Resource, Api
from sqlalchemy import or_

from .models import *
from .engine import session
from .lib import *


api_bp = Blueprint('api', __name__)
api = Api(api_bp)

    
class Register(Resource):
    def post(self):
        data = request.get_json()
        u = User(**data)
        try:
            session.add(u)
            session.commit()
            resp = make_response(json.dumps({}))
            resp.set_cookie('token', u.token)
            resp.status = '201'
            return resp
        except :
            return {}, 400


class IsFree(Resource):<commit_msg>rollback in register session<commit_after>import json
from datetime import datetime
from dateutil.relativedelta import relativedelta
from dateutil.parser import parse
from flask import Flask, Blueprint, request, make_response
from flask_restful import Resource, Api
from sqlalchemy import or_

from .models import *
from .engine import session
from .lib import *


api_bp = Blueprint('api', __name__)
api = Api(api_bp)

    
class Register(Resource):
    def post(self):
        data = request.get_json()
        u = User(**data)
        try:
            session.add(u)
            session.commit()
            resp = make_response(json.dumps({}))
            resp.set_cookie('token', u.token)
            resp.status = '201'
            return resp
        except :
            sesson.rollback()
            return {}, 400


class IsFree(Resource):
{'fraction_non_alphanumeric': 0.08771929824561403, 'fraction_numerical': 0.007259528130671506, 'mean_word_length': 2.5956521739130434, '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': '2695873', 'n_tokens_mistral': 480, 'n_tokens_neox': 459, 'n_words': 141}