<commit_before># -*- coding: utf-8 -*-
"""
Exceptions
~~~~~~~~~~

"""
from odinweb.resources import Error


class ImmediateHttpResponse(Exception):
    """
    A response that should be returned immediately.
    """
    def __init__(self, resource, status=200, headers=None):
        self.resource = resource
        self.status = status
        self.headers = headers


class ImmediateErrorHttpResponse(ImmediateHttpResponse):
    """
    An error response that should be returned immediately.
    """
    def __init__(self, status, code, message, developer_message=None, meta=None, headers=None):
        super(ImmediateErrorHttpResponse, self).__init__(
            Error(status, code, message, developer_message, meta),
            status, headers
        )


class PermissionDenied(ImmediateErrorHttpResponse):
    """
    Permission to access the specified resource is denied.
    """
    def __init__(self, message=None, developer_method=None, headers=None):
        super(PermissionDenied, self).__init__(
            403, 40300, message or "Permission Denied",
            developer_method, None, headers
        )
<commit_msg>Simplified ImmediateErrorHttpResponse name to just HttpError<commit_after># -*- coding: utf-8 -*-
"""
Exceptions
~~~~~~~~~~

"""
from odinweb.resources import Error


class ImmediateHttpResponse(Exception):
    """
    A response that should be returned immediately.
    """
    def __init__(self, resource, status=200, headers=None):
        self.resource = resource
        self.status = status
        self.headers = headers


class HttpError(ImmediateHttpResponse):
    """
    An error response that should be returned immediately.
    """
    def __init__(self, status, code, message, developer_message=None, meta=None, headers=None):
        super(HttpError, self).__init__(
            Error(status, code, message, developer_message, meta),
            status, headers
        )


class PermissionDenied(HttpError):
    """
    Permission to access the specified resource is denied.
    """
    def __init__(self, message=None, developer_method=None, headers=None):
        super(PermissionDenied, self).__init__(
            403, 40300, message or "Permission Denied",
            developer_method, None, headers
        )

{'fraction_non_alphanumeric': 0.10670194003527336, 'fraction_numerical': 0.010582010582010581, 'mean_word_length': 3.1556776556776556, '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': '1032750', 'n_tokens_mistral': 612, 'n_tokens_neox': 585, 'n_words': 167}