<commit_before>import pyglet

from pyglet_gui.scrollbars import VScrollbar
from pyglet_gui.widgets import Widget, Rectangle
from pyglet_gui.controllers import Controller


class Document(Controller, Widget):
    """
    Allows you to embed a document within the GUI, which includes a
    vertical scrollbar.
    """
    def __init__(self, document, width=0, height=0, is_fixed_size=False):
        Widget.__init__(self, width, height)
        Controller.__init__(self)

        self.max_height = height
        if isinstance(document, str):
            self._document = pyglet.text.document.UnformattedDocument(document)
        else:
            self._document = document
        self._content = None
        self.content_width = width
        self._scrollbar = None
        self.set_document_style = False
        self.is_fixed_size = is_fixed_size

    def hit_test(self, x, y):
        if self._content is not None:
            return Rectangle(self._content.x, self._content.y, self._content.width, self._content.height).hit_test(x, y)
        else:
            return False<commit_msg>Fixed error on document's hit_test.<commit_after>import pyglet

from pyglet_gui.scrollbars import VScrollbar
from pyglet_gui.widgets import Widget
from pyglet_gui.controllers import Controller


class Document(Controller, Widget):
    """
    Allows you to embed a document within the GUI, which includes a
    vertical scrollbar.
    """
    def __init__(self, document, width=0, height=0, is_fixed_size=False):
        Widget.__init__(self, width, height)
        Controller.__init__(self)

        self.max_height = height
        if isinstance(document, str):
            self._document = pyglet.text.document.UnformattedDocument(document)
        else:
            self._document = document
        self._content = None
        self.content_width = width
        self._scrollbar = None
        self.set_document_style = False
        self.is_fixed_size = is_fixed_size

    def hit_test(self, x, y):
        if self._content is not None:
            return self._content.x <= x < self._content.x + self._content.width and\
                self._content.y <= y < self._content.y + self._content.height
        else:
            return False
{'fraction_non_alphanumeric': 0.08098434004474273, 'fraction_numerical': 0.0017897091722595079, 'mean_word_length': 2.6476345840130504, 'pattern_counts': {'":': 0, '<': 7, '<?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': '5794531', 'n_tokens_mistral': 634, 'n_tokens_neox': 625, 'n_words': 166}