<commit_before>from tornado.web import RequestHandler, HTTPError
from hbpush.channel import Channel


class PubSubHandler(RequestHandler):
    exception_mapping = {
        Channel.DoesNotExist: 404,
        Channel.Duplicate: 409,
        Channel.Gone: 410,
        Channel.NotModified: 304,
    }

    def __init__(self, *args, **kwargs):
        self.registry = kwargs.pop('registry', None)
        super(PubSubHandler, self).__init__(*args, **kwargs)

    def add_vary_header(self):
        self.set_header('Vary', 'If-Modified-Since, If-None-Match')

    def _handle_request_exception(self, e):
        if e.__class__ in self.exception_mapping:
            e = HTTPError(self.exception_mapping[e.__class__], str(e))

        super(PubSubHandler, self)._handle_request_exception(e)

    errback = _handle_request_exception
<commit_msg>message doesnotexist is a 404<commit_after>from tornado.web import RequestHandler, HTTPError
from hbpush.channel import Channel
from hbpush.message import Message


class PubSubHandler(RequestHandler):
    exception_mapping = {
        Channel.DoesNotExist: 404,
        Channel.Duplicate: 409,
        Channel.Gone: 410,
        Channel.NotModified: 304,
        Message.DoesNotExist: 404,
    }

    def __init__(self, *args, **kwargs):
        self.registry = kwargs.pop('registry', None)
        super(PubSubHandler, self).__init__(*args, **kwargs)

    def add_vary_header(self):
        self.set_header('Vary', 'If-Modified-Since, If-None-Match')

    def _handle_request_exception(self, e):
        if e.__class__ in self.exception_mapping:
            e = HTTPError(self.exception_mapping[e.__class__], str(e))

        super(PubSubHandler, self)._handle_request_exception(e)

    errback = _handle_request_exception

{'fraction_non_alphanumeric': 0.10430839002267574, 'fraction_numerical': 0.017006802721088437, 'mean_word_length': 3.4235588972431077, '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': '7358827', 'n_tokens_mistral': 569, 'n_tokens_neox': 532, 'n_words': 108}