<commit_before>def prune_old_authorization_codes():
    from .compat import now
    from .models import AuthorizationCode
    
    AuthorizationCode.objects.filter(expires_at__lt=now()).delete()


def get_handler(handler_name):
    from .conf import options
    
    handlers = options.handlers
    
    for handler in handlers:
        handler_path = handler.split(".")
        name = handler_path[-2]
        
        if handler_name == name:
            handler_module = __import__(".".join(handler_path[:-1]), {}, {}, str(handler_path[-1]))
            
            return getattr(handler_module, handler_path[-1])()
    
    return None


def request_error_header(exception):
    from .conf import options
    
    header = "Bearer realm=\"%s\"" % (options.realm, )
    
    if hasattr(exception, "error"):
        header = header + ", error=\"%s\"" % (exception.error, )
    
    return header


def total_seconds(delta):
    return delta.days * 86400 + delta.seconds<commit_msg>Added error_description support for if error has a reason<commit_after>def prune_old_authorization_codes():
    from .compat import now
    from .models import AuthorizationCode
    
    AuthorizationCode.objects.filter(expires_at__lt=now()).delete()


def get_handler(handler_name):
    from .conf import options
    
    handlers = options.handlers
    
    for handler in handlers:
        handler_path = handler.split(".")
        name = handler_path[-2]
        
        if handler_name == name:
            handler_module = __import__(".".join(handler_path[:-1]), {}, {}, str(handler_path[-1]))
            
            return getattr(handler_module, handler_path[-1])()
    
    return None


def request_error_header(exception):
    from .conf import options
    
    header = "Bearer realm=\"%s\"" % (options.realm, )
    
    if hasattr(exception, "error"):
        header = header + ", error=\"%s\"" % (exception.error, )
    
    if hasattr(exception, "reason"):
        header = header + ", error_description=\"%s\"" % (exception.reason, )
    
    return header


def total_seconds(delta):
    return delta.days * 86400 + delta.seconds
{'fraction_non_alphanumeric': 0.1218369259606373, 'fraction_numerical': 0.008434864104967198, 'mean_word_length': 2.674698795180723, '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': '4687304', 'n_tokens_mistral': 636, 'n_tokens_neox': 622, 'n_words': 140}