<commit_before>import os
from functools import wraps

import flask
from flask import request, json

USERNAME = 'fickle'

def Response(data, status = 200):
    body = json.dumps(data)
    return flask.Response(body, status = status, mimetype = 'application/json')

def SuccessResponse(dataset_id = None):
    return Response({ 'success': True, 'id': dataset_id })

def ErrorResponse(status = 400):
    return Response({ 'success': False }, status = status)

def check_auth(username, password):
    setting = os.environ.get('FICKLE_PASSWORD')
    if setting:
        return username == USERNAME and password == setting
    else:
        return True

def requires_auth(f):
    if not bool(os.environ.get('FICKLE_PASSWORD')):
        return f
    @wraps(f)
    def decorated(*args, **kwargs):
        auth = request.authorization
        if not auth or not check_auth(auth.username, auth.password):
            return ErrorResponse(403)<commit_msg>Drop body from error responses<commit_after>import os
from functools import wraps

import flask
from flask import request, json

USERNAME = 'fickle'

def Response(data = None, status = 200):
    if data:
        body = json.dumps(data)
    else:
        body = None
    return flask.Response(body, status = status, mimetype = 'application/json')

def SuccessResponse(dataset_id = None):
    return Response({ 'success': True, 'id': dataset_id })

def ErrorResponse(status = 400):
    return Response(status = status)

def check_auth(username, password):
    setting = os.environ.get('FICKLE_PASSWORD')
    if setting:
        return username == USERNAME and password == setting
    else:
        return True

def requires_auth(f):
    if not bool(os.environ.get('FICKLE_PASSWORD')):
        return f
    @wraps(f)
    def decorated(*args, **kwargs):
        auth = request.authorization
        if not auth or not check_auth(auth.username, auth.password):
            return ErrorResponse(403)
{'fraction_non_alphanumeric': 0.10531750129065565, 'fraction_numerical': 0.009292720702116675, 'mean_word_length': 3.4145785876993164, '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': '2040647', 'n_tokens_mistral': 588, 'n_tokens_neox': 566, 'n_words': 172}