<commit_before>from ..external.qt import QWidget, QPainter, QPoint
from ..display.qt import LinearQImagePainter, TwoDimQImagePainter

class DisplayWidget(QWidget):
    """A Display widget for one- and twodimensional configs.

    Based on zasim.display."""

    def __init__(self, simulator, width=None, height=None, **kwargs):
        """Initialize the DisplayWidget.

        :param width: The width of the image to build.
        :param height: The height of the image to build.
        :param queue_size: The amount of histories that may pile up before
                           forcing a redraw.
        """
        super(DisplayWidget, self).__init__(**kwargs)

        self._sim = simulator

        scale = 1

        shape = simulator.shape
        if len(shape) == 1:
            if width is None:
                width = shape[0]
            else:
                scale = width / shape[0]
                assert shape[0] * scale == width, "Width not a whole multiple of config width"
            if height is None:
                height = width

            self.display = LinearQImagePainter(simulator, height, scale=scale)<commit_msg>fix a docstring<commit_after>from ..external.qt import QWidget, QPainter, QPoint
from ..display.qt import LinearQImagePainter, TwoDimQImagePainter

class DisplayWidget(QWidget):
    """A Display widget for one- and twodimensional configs.

    Based on `zasim.display.qt`"""

    def __init__(self, simulator, width=None, height=None, **kwargs):
        """Initialize the DisplayWidget.

        :param width: The width of the image to build.
        :param height: The height of the image to build.
        :param queue_size: The amount of histories that may pile up before
                           forcing a redraw.
        """
        super(DisplayWidget, self).__init__(**kwargs)

        self._sim = simulator

        scale = 1

        shape = simulator.shape
        if len(shape) == 1:
            if width is None:
                width = shape[0]
            else:
                scale = width / shape[0]
                assert shape[0] * scale == width, "Width not a whole multiple of config width"
            if height is None:
                height = width

            self.display = LinearQImagePainter(simulator, height, scale=scale)
{'fraction_non_alphanumeric': 0.0842013888888889, 'fraction_numerical': 0.004340277777777778, 'mean_word_length': 2.0449141347424042, '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': '746922', 'n_tokens_mistral': 635, 'n_tokens_neox': 588, 'n_words': 217}